【发布时间】:2018-09-19 04:39:57
【问题描述】:
我使用以下代码使用 Nexmo 发送消息。它运行成功,我得到了唯一的 messageId 作为响应。
$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);
响应:“message_id”:“0D000000890273B7”。
发送短信后,我的客户回复了短信。我正在尝试跟踪消息并存储到数据库中。 我在 Nexmo 设置中设置了 webhooks 回调 URL。它也在运行并转储响应。
[msisdn] => 121#######
[message_id] => 0B000000CB352009
[to] => 1#########
[message_timestamp] => 2018-04-09 15:04:45
[keyword] => YES
[text] => Hello I am replying the message.
这里我注意到 messageId 不同了,那么我们如何跟踪回复的消息与这个 messageId “0D000000890273B7”相关?请帮帮我。我无法匹配电话号码,因为我们没有使用唯一的电话号码。
【问题讨论】: