AWS Chime Messaging: How to add a new user to a channel using the JavaScript SDK

Viewed 254

I'm building the back-end of a meeting app that will use AWS Chime Messaging SDK for JavaScript. The idea is that when a user enters a meeting, an AppInstanceUser is created and associated with the Channel of that meeting.

Creating the channel and associating the user with it looks quite simple with the JavaScript SDK, however I can't find a way to create the user other than through the CLI, which I don't think is the correct way, because I need to create a new AppInstanceUser for each new user.

How should I do this? Is there a method to create the AppInstanceUser using the SDK that I didn't find? Or is there a way to add the new user to the channel without creating a new AppInstanceUser?

1 Answers

AWS SDK provides a client for creating AppInstanceUser's. If you are using NodeJS, you can access it with aws-sdk/clients/chime. After you initialize the client, you can call createAppInstanceUser, provide it your AppInstanceArn, AppInstanceUserId and create your users, associate them to channels with createChannelMembership, etc.

Last note, you still have to save your AppInstanceUserArn in your user data, then use the stored ARNs in your application, client or server (at least that is my experience).

Related