gpt4 book ai didi

twilio - 通过 Twilio 通知获取短信发送状态

转载 作者:行者123 更新时间:2023-12-04 03:01:39 24 4
gpt4 key购买 nike

我已使用 Twilio api 发送通知消息。消息发送正常。

$notification = $client
->notify->services($serviceSid)
->notifications->create([
"toBinding" => [
'{"binding_type":"sms", "address":"+971444444444"}',
'{"binding_type":"sms", "address":"+971444444445"}'
],
'body' => 'Test message 8'
]);

请求的响应是 201 并返回以 'NT' 开头的 sid。如何跟踪此消息的状态?

最佳答案

应该是这样的:

PHP:

$notification = $client
->notify->services($serviceSid)
->notifications->create([
"toBinding" => [
'{"binding_type":"sms", "address":"+971444444444"}',
'{"binding_type":"sms", "address":"+971444444445"}'
],
'body' => 'Test message 8'
'sms' => ['status_callback' => 'https://youcallbackurl.com']
]);

或者Javascript

const service = twilio.notify.services(notifyId);
const bindings = numbers.map(number => {
return JSON.stringify({
binding_type: 'sms',
address: number,
});
});

service.notifications.create({
        toBinding: bindings,
        body: message,
sms: {
status_callback: 'https://youcallbackurl.com'
}
  })

关于twilio - 通过 Twilio 通知获取短信发送状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48686819/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com