After creating a channel in the Twilio Programmable Chat service, I am listening to the client events.
One of those events is the channelAdded
event. In the hook, I have to retrieve the Members of the channel (in order to get the opposite members name in a binary room) like so
channel.getMembers()
When I do this, Twilio returns:
name: "SyncError"
message: "Access forbidden for identity (status: 403, code: 54007)"
status: 403
code: 54007
It would make sense if the user that is accessing that method wouldn't also be the author and a member of that channel.
Do I need to grant the author some special rights to access the channel?
Additional, secondary question
When I create a binary channel (2 members), I need to manually add the author as the member of the channel also like so:
var channel = await this.client.createChannel({
friendlyName: command.roomName,
isPrivate: command.isPrivateRoom
})
var p1 = channel.add(command.currentUserId);
var p2 = channel.add(command.oppositeUserId);
await Promise.all([p1,p2])
return command.roomName;
Is there a shortcut or a way to auto, add the Member on creation?