4
votes

I have sent the SMS via laravel. In twilio delivery status not showing for that SMS. If I try to sent via Javascript it shows delivery status.

$client->account->sms_messages->create($from, $sms_to, "Test SMS" , array());

2
Welcome to StackOverflow! Please update your question to show what you have already tried, showcasing the code that creates the specific problem you are facing in a minimal reproducible example. For further information, please see How to Ask, and take the tour of the site :) - 0mpurdy
Next to no information in the question to even start with help. But those single quotes around the $from look suspect... I would look at that first. - Symeon Quimby
Yeah, the single quotes around $from are definitely going to break things. - ceejayoz

2 Answers

1
votes

Twilio developer evangelist here.

You are using the deprecated SMS/Messages endpoint with that call. The deprecated endpoint does not include delivery statuses.

Instead, you should call:

$client->account->messages->create($from, $sms_to, "Test SMS" , array());

Note that is messages not sms_messages.

Let me know if that helps at all.

-1
votes

You need to assign the result to a variable, then, see what the method returns in order to print something.

$message = $client->account->sms_messages->create('$from', $sms_to, "Test SMS" , array());
print_r($message);

If you need further info, check the documentation and select your version: https://twilio.github.io/twilio-php/