0
votes

I am trying use Twilio api to send SMS to my customers. When i use trial account, i'm using this code:

<?php 
        require('Services/Twilio.php'); 
        $account_sid = '{my_sid}'; 
        $auth_token = '{my_token}'; 
        $client = new Services_Twilio($account_sid, $auth_token); 
        $callback=$client->account->messages->create(array( 
            'To' => "+84974366xxx", 
            'From' => "+14845280xxx", 
            'Body' => "hello world",   
        ));
        print_r($callback);
?>

The sms i received had "Send from twilio trial account" before "hello world". Now i upgraded my account and test this code again. It's still respone successfully, but my phone number isn't receive SMS. Now how can i check status of $callback and resend sms?

1
what does the log in your account say. Was the message delivered? If yes check, to which number it was delivered. - vaibhavmande
Check your user account log in the Twilio app monitor: twilio.com/user/account/log/messages to see where the message was delivered to, or if it was delivered at all! - phalt

1 Answers

0
votes

You can make use of the status call back parameter. This allows you to configure a url that Twilio will call, in this you will receive various details about the action that you configured it with. For sms, you can expect status values like failed, sent, delivered that is just to mention a few. you can then use these values to determine if further action is required, such as resend the message and so on.

for more details I suggest looking at the Twilio message api here https://www.twilio.com/docs/api/rest/sending-messages#post-parameters-optional

I hope this helps