I have used below code to send the message using Nexmo. which is running successfully and I am getting unique messageId in response.
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
'api_key' => env("NEXMO_API_KEY"),
'api_secret' => env("NEXMO_API_SECRET"),
'to' => $data['to'],
'from' => $data['from'],
'text' => 'Hi I am sending the message',
'callback' => $data['callbackUrl']
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response);
Response: "message_id": "0D000000890273B7".
After sending the SMS, my customer replied the SMS. and I am trying to track the messages and stored into DB. I have set the webhooks callback URL on Nexmo setting. which is also running and dumped the response.
[msisdn] => 121#######
[message_id] => 0B000000CB352009
[to] => 1#########
[message_timestamp] => 2018-04-09 15:04:45
[keyword] => YES
[text] => Hello I am replying the message.
Here I noticed that messageId is coming different, so How can we track the replied message is related to this messageId "0D000000890273B7"? Please help me out. I cannot match with phone number because we are not using phone number as unique.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire