dtwye28880 2017-06-21 09:31
浏览 97
已采纳

致命错误:/twilio-php/Twilio/Rest/Client.php中带有'未知域通知'消息的未捕获异常'Twilio \ Exceptions \ TwilioException'

Am trying to send push notifications to mobile devices using Twilio Notify with PHP, For this first creating a user using following code

require_once 'vendor/autoload.php';
use Twilio\Rest\Client;

$accountSid = "sid";
$authToken = "your_auth_token";

$serviceSid = "serviceSid";

// Initialize the client
$client = new Client($accountSid, $authToken);
// Create a user
$user = $client
    ->notify->services($serviceSid)
    ->users->create([
        'identity' => 'push token', //am not sure what is identity also?
        'segment' => ['segmentName']
    ]);
// print_r($user);
echo $user->sid;

Getting an exception in

Fatal error: Uncaught exception 'Twilio\Exceptions\TwilioException' with message 'Unknown domain notify' in Twilio/Rest/Client.php

How to solve this? Googled a lot but no luck.

  • 写回答

2条回答 默认 最新

  • donglao4370 2017-06-21 10:32
    关注

    Twilio developer evangelist here.

    You are currently using Twilio PHP 5.11.0. Twilio Notify is a beta product right now so is not included in the main library.

    You will need to install the alpha version of the library that includes beta and preview products. You can install this with composer with

    composer require twilio/sdk:5.11.0-alpha1
    

    As for the identity, that refers to the identity of a User in Notify. To send notifications you need to create bindings, which are addresses for your users to receive notifications on. Then when you create a notification you supply the identity of the user to send the notification to.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图