使用 twilio 通知服务未收到短信,控制台中没有调试错误? [英] Not recieving sms using twilio notify service, no debug error in console?

查看:98
本文介绍了使用 twilio 通知服务未收到短信,控制台中没有调试错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Twilio 通知 API 发送批量短信.我查看了文档和其他 StackOverflow 资源,但还没有发现问题.我正在做的是:

I am trying to send bulk SMS using Twilio notify API. I had looked at the documentation, and other StackOverflow resources but did not find the issue yet. What I am doing is:

$sid = "AC1e590cbb8eee064c3c71axxxxxxxxxxx";
$token = "94c2dc3e2e407c4ebd28cxxxxxxxxxxx";
$twilio = new Client($sid, $token);
$serviceSid = "IS32913ae9b083b809b1c06xxxxxxxxxxx";

$recipients = array();
foreach($phone_nos as $phone_no) {
   array_push($recipients, $phone_no['phone_no']);
}

//recipients array print value is 
//Array
//(
    //[0] => +923105653361
    //[1] => +923491457062
//)

$binding = array();
foreach ($recipients as $recipient) { 
   $binding[] = '{"binding_type":"sms", "address":"'.$recipient.'"}';
}

//binding array is print value is
//Array
//(
    //[0] => {"binding_type":"sms", "address":"+923105653361"}
    //[1] => {"binding_type":"sms", "address":"+923491457062"}
//)

$service = $twilio->notify->v1->services->create();
$notification = $twilio->notify->services($serviceSid)
   ->notifications->create([
   "toBinding" => $binding,
   "body" => 'Test message 5 notify'
]);

echo $notification->body;
echo '<pre>';print_r($notification->sid);exit;

通知控制台显示消息发送没有错误.

The notify console is showing the messages are sent with no error.

推荐答案

Twilio 开发人员布道者在这里.

Twilio developer evangelist here.

您似乎尚未将消息服务和电话号码连接到您的通知服务.按照此处文档中的说明进行设置,然后尝试再次发送消息.

It looks like you haven’t connected a messaging service and a phone number to your Notify service. Follow the instructions in the documentation here to set that up, then try sending the messages again.

这篇关于使用 twilio 通知服务未收到短信,控制台中没有调试错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆