Invite one user or bulk users to a private channel. Any of the following permissions are required:
add-user-to-joined-room: This permission is required if you want to add users to the channel that you have joined.add-user-to-any-p-room: This permission is required to add users to any private channel.
You can identify the group by roomId or roomName, and the user(s) by userId, username, userIds, or usernames.
Changelog
| Version | Description |
|---|---|
| 0.48.0 | Added |
The authToken of the authenticated user.
The userId of the authenticated user.
{
"roomId": "ByehQjC44FwMeiLbX",
"userId": "nSYqWzZ4GsKTX4dyK"
}{
"roomName": "private-abc",
"username": "john.doe"
}{
"roomId": "ByehQjC44FwMeiLbX",
"userIds": [
"nSYqWzZ4GsKTX4dyK",
"SYqWzZ4Gsasdfgh"
]
}{
"roomName": "private-abc",
"usernames": [
"john.doe",
"jane.doe"
]
}The group ID. This parameter is required if no roomName is provided. You can find the IDs by using any of the following endpoints:
- Get List of User Groups: This endpoint returns all private channels in the workspace, if you have the required permissions to view them.
- Get Groups: This endpoint returns the private channels that you are a member of.
The group name. This parameter is required if no roomId is provided.
The ID of the user to be invited. This parameter is required if no username, userIds, or usernames is provided.
The username of the user to be invited. This parameter is required if no userId, userIds, or usernames is provided.
An array of user IDs to invite. This parameter is required if no userId, username, or usernames is provided.
An array of usernames to invite. This parameter is required if no userId, username, or userIds is provided.
OK
{
"group": {
"_id": "ByehQjC44FwMeiLbX",
"ts": "2016-11-30T21:23:04.737Z",
"t": "p",
"name": "testing",
"usernames": [
"testing",
"testing1"
],
"u": {
"_id": "aobEdbYhXfu5hkeqG",
"username": "testing1"
},
"msgs": 1,
"_updatedAt": "2016-12-09T12:50:51.575Z",
"lm": "2016-12-09T12:50:51.555Z"
},
"success": true
}Bad Request
{
"success": false,
"error": "The parameter \"roomId\" or \"roomName\" is required [error-room-param-not-provided]",
"errorType": "error-room-param-not-provided"
}{
"success": false,
"error": "Please provide \"userId\" or \"username\" or \"userIds\" or \"usernames\" as param [error-users-params-not-provided]",
"errorType": "error-users-params-not-provided"
}{
"success": false,
"error": "Not allowed [error-not-allowed]",
"errorType": "error-not-allowed",
"details": {
"method": "addUsersToRoom"
}
}Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}