Reputation: 273
I am transition to ver 5 of the twilio library.
I am successfully sending text messages with:
/* attempt to send the message */
$twilio_client->messages->create(
"+1".$recipient,
array (
'From' => "+1".$org,
'Body' => $txtmsg,
'StatusCallback' => CALLBACK_LINK
)
);
I am successfully sending voice calls with:
$client->calls->create(
"1".$recipient, "1"+$org
array (
'Url' => MSG_XML,
'StatusCallback' => CALLBACK_LINK,
"StatusCallbackEvent" => array(
"initiated", "ringing", "answered", "completed", "failed"
)
)
);
In both cases how do I immediately obtain the message SID following the call? I need the SID prior to any callback url being called by Twilio.
Upvotes: 0
Views: 54
Reputation: 56
You can get the response as such:
$msg = $twilio_client->messages->create(
"+1".$recipient,
array (
'From' => "+1".$org,
'Body' => $txtmsg,
'StatusCallback' => CALLBACK_LINK
)
);
echo $msg->sid;
Upvotes: 2