无法在twilio ip消息中向通道添加成员


unable to add member to channel in twilio ip messaging

我在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",包含中的消息"帖子正文中缺少必需的参数Identity"twilio/twilio-php-master/Services/twilio.php:297

请向我介绍这方面的最新情况。

您应该在上使用带有第一个大写字母的密钥"Identity"

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