Reputation: 33
I am trying to make a chat sandboxing api, aka creating the user, channel and adding the user to the channel. The problem is that every time i call the restApi to create a new user, it doesn't take the attributes or the friendlyName. The code is the following:
$user->chat->services($serviceSid)->users->create(
array(
'identity' => $identity,
'friendlyName' => $friendlyName,
'attributes' => $attributes,
'roleSid' => $roleSid
)
);
Thanks.
Upvotes: 1
Views: 621
Reputation: 73029
Twilio developer evangelist here.
Your code to create the user isn't quite right there. create
takes the identity as the first argument and then the optional arguments in an array as the second. Try this instead:
$user->chat->services($serviceSid)->users->create(
$identity,
array(
'friendlyName' => $friendlyName,
'attributes' => $attributes,
'roleSid' => $roleSid
)
);
Let me know if that helps at all.
Upvotes: 2