Menu

Callback - status of message

2005-03-05
2013-04-11
  • Aleksandar Markovic

    >>do you know if they support 'status of the sms' - if the sms arrived??
    >>and how can I activate it with HTTP

    Yes, Clickatell support such function. But it is little complicated to
    make that work.

    Clickatell call that "callback".

    Here is some steps that You need to done:

    1) In SMS-API enable callback support, var $callback = 3;

    2) In Clickatell Central (Members Area), under HTTP-API product,
    specify callback url.
    This URL is full path to your new script that You need to make. For
    example: http://your-site.com/sms_engine/callback.php

    3) You need to store all messages that are send in some DB along with
    returned message_id

    4) You need to make callback.php script !

    So how all this work?

    When You send a SMS message, Clickatell gateway will return unique ID
    for that message. You need to store that ID, because You will need it
    later.
    Clickatell gateway now will try to deliver that SMS to mobile user.

    Status of that message (does it delivered or not, rooting error ..)
    will be forwarded to callback URL that You specify. In short,
    Clickatell engine will call Your callback.php script and will pass
    several variables to it including message_id (this will happened
    several seconds later).

    Callback.php need to do a DB query and find message by message_id that
    You send in previous step. Here You will update status of that message
    with status that Clickatell returned to Your script.

    Here are example variables that Clickatell gateway will return to your
    script (callback) via GET method

       [api_id] => 368727
       [apiMsgId] => ec8d468e36363cd042ba8d974a90629f   <<-- You need this
       [cliMsgId] =>
       [status] => 003          <<-- 003 means that is delivered sucessfuly
       [timestamp] => 1098977353
       [to] => (null)
       [from] => (null)
       [charge] => 1.000000   <<-- how much sms credits messgae cost

    Basically, callback.php need only to do simple DB update query like this one:

    $query = "UPDATE `sms_outboox` SET `message_status` =
    '".$_GET['status']."' WHERE `message_id` = '".$_GET['apiMsgId']."'
    LIMIT 1";
    exec_sql ($query);

    Regards,
    Aleksandar

     
    • tia25

      tia25 - 2005-08-26

      Hi..

      You couldn't involve this callback thing into sms_api class? That would be cool. I am currently using it, and it is great! :D

      Regards,

      Tone Irene Andersen

       
  • Natasha Williams

    Post awaiting moderation.

Log in to post a comment.