无法在 twilio ip 消息传递中将成员添加到频道

问题描述 投票:0回答:1

我在twilio中使用rest api创建了一个频道,接下来我尝试向其中添加成员,但失败了。这是我的代码

require('Services/Twilio.php');

// Find your Account Sid and Token at twilio.com/user/account
$sid = "ACCOUNT_SID";
$token = "AUTH_TOKEN";

// Initialize the client
$client = new IPMessaging_Services_Twilio($sid, $token);

// Retrieve the service
$service = $client->services->get("SERVICE_SID");

// Retrieve the channel
$channel = $service->channels->get("CHANNEL_ID");

// Add the member
$member = $channel->members.create(array(
    "identity" => "JOHN",
));
print $member;

我收到错误:

致命错误:调用中未定义的函数create() twilio/sendsms.php 上线 101

如果我把它改成

$member = $channel->members->create(array(
    "identity" => "JOHN",
));

错误:未捕获异常“Services_Twilio_RestException” 消息“帖子正文中缺少必需的参数身份” twilio/twilio-php-master/服务/Twilio.php:297

请向我通报这方面的最新情况。

php rest twilio twilio-php
1个回答
0
投票

您应该使用第一个大写字母的密钥“Identity”

$member = $channel->members->create(数组( “身份”=>“约翰”,));

© www.soinside.com 2019 - 2024. All rights reserved.