Thin wrapper around SendBird Server REST API
npm install sendbird-nodejs --save
See SendBird Documentation for payload and response details.
You don't need to pass the auth
field on the payload, you provide it when creating a new instance of SendBird
and it is attached to all requests.
var SendBird = require('sendbird-nodejs');
var sb = new SendBird(config.sendBird.appToken);
The sb
instance we just created has a field for each endpoint in the SendBird Server API that is an object with the endpoints methods.
sb.user
sb.channel
sb.messaging
sb.admin
sb.migration
So, to create a user you would simply need to have something like this:
var payload = {
"id": string, // User ID
"nickname": string, // User nickname
"image_url": string, // User profile image URL
"issue_access_token": boolean // Default is false. Use only if you want to create an access token for this user
};
sb.user.create(payload)
.then(function (response) {
// do something with SendBird response
});
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D