2

I create a Client and a private Channel I join. Then trying to add another user using:

Channel.add(identity) 

I get

50200 - User not found

I know a member has to be a user first. How do I create a user using the JavaScript SDK?

EDIT: The most important part of philnash answer is The first time a new Identity is encountered by Chat. So, I just created another client using this identity and it actually has created the user. Simple.

1 Answers1

1

Twilio developer evangelist here.

You don't explicitly create users from the JavaScript SDK, from the documentation:

The first time a new Identity is encountered by Chat within a Service instance, a new User instance will be created using the Identity encountered. If the Identity exists, the existing User record will be used for that session/request. This is true for endpoints and Access Tokens, and for creating Members in a POST to the Members resource.

If you need to use a user before the identity is encountered via the SDK, then you can create a user using the REST API.

philnash
  • 70,667
  • 10
  • 60
  • 88