How do i create a user and join that user into a channel with a friendly name ?
All the examples in the documentation located here assumes that a user with appropriate friendlyName is already present in the service instance.
So, if i want to join a user in my system to a channel, Do i need to first create a user using users rest api endpoint and then add that user as a member of a channel ?
channel.members.create(user.identity)
Above code above throws 409 conflict error if i re-create a user. So i am forced to fetch a user, see if the user exists then create the user. If user already exists, then I have to update the user with friendlyName.
I am forced to check if the user in my system exists in that service instance everytime that user joins a channel.
Is there a way I can join a user to a channel with friendly name so Twilio creates if the user doesn't exist and update friendly name if user already is in twilio service instance ?
This is the sequence of events I would like to see:
- User in my system clicks join room button
- Either from client side or server side, I join the user into that channel with identity and friendlyName.
- Twilio creates a user/member in service instance and channel if the user/member doesnt exist Twilio updates a user/members friendly name if the user already exists.