1

我正在尝试制作一个聊天沙盒 api,也就是创建用户、频道并将用户添加到频道。问题是每次我调用 restApi 来创建一个新用户时,它都不会使用属性或友好名称。代码如下:

$user->chat->services($serviceSid)->users->create(
        array(
            'identity'     => $identity,
            'friendlyName' => $friendlyName,
            'attributes'   => $attributes,
            'roleSid'      => $roleSid
        )
    );

谢谢。

4

1 回答 1

2

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

您创建用户的代码并不完全正确。create将标识作为第一个参数,然后将数组中的可选参数作为第二个参数。试试这个:

$user->chat->services($serviceSid)->users->create(
    $identity,
    array(
        'friendlyName' => $friendlyName,
        'attributes'   => $attributes,
        'roleSid'      => $roleSid
    )
);

让我知道这是否有帮助。

于 2018-03-13T04:41:05.393 回答