Post
/api/v1/channels.invite
Add a user or bulk users to a channel.
For a user to invite other users, they must match at least one of the following premises:
- The user is part of a room of any type and has the
add-user-to-joined-room
permission. - The user is part of a public room
(t: 'c')
and has theadd-user-to-any-c-room
permission. - The user is part of a private room
(t: 'p')
and has theadd-user-to-any-p-room
permission.
Changelog
Version | Description |
---|---|
0.48.0 | Added |
Header parameters
X-Auth-Token
stringRequired
The authToken
of the authenticated user.
ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired
The userId
of the authenticated user.
ExamplerbAXPnMktTFbNpwtJ
Body parameters
object
OneOf
object
object
roomId
string Required
The channel's ID.
ExamplenSYqWzZ4GsKTX4dyK
userId
string Required
The user id to be invited.
ExampleByehQjC44FwMeiLbX
object
object
roomId
string Required
The channel's id
ExamplenSYqWzZ4GsKTX4dyK
userIds
Array of object Required
An array of the userId of users to be invited
object
type
string
value
string
You can enter the user ID of one user or add multiple users. Use any one of the objects above as the body parameters.
Responses
200
OK
Add bulk users
{
"channel": {
"_id": "ByehQjC44FwMeiLbX",
"ts": "2016-11-30T21:23:04.737Z",
"t": "c",
"name": "testing",
"usernames": [
"testing",
"testing1"
],
"msgs": 1,
"_updatedAt": "2016-12-09T12:50:51.575Z",
"lm": "2016-12-09T12:50:51.555Z"
},
"success": true
}
Add a user
{
"channel": {
"_id": "ByehQjC44FwMeiLbX",
"ts": "2016-11-30T21:23:04.737Z",
"t": "c",
"name": "testing",
"usernames": "testing",
"msgs": 1,
"_updatedAt": "2016-12-09T12:50:51.575Z",
"lm": "2016-12-09T12:50:51.555Z"
},
"success": true
}
object
channel
object
_id
string
fname
string
customFields
object
description
string
broadcast
boolean
encrypted
boolean
federated
boolean
name
string
t
string
msgs
integer
usersCount
integer
u
object
_id
string
username
string
ts
string
ro
boolean
default
boolean
sysMes
boolean
_updatedAt
string
lm
string
lastMessage
object
_id
string
t
string
msg
string
groupable
boolean
blocks
Array of object
object
type
string
blockId
string
callId
string
appId
string
ts
string
u
object
_id
string
username
string
name
string
rid
string
_updatedAt
string
urls
Array of object
object
mentions
Array of object
object
channels
Array of object
object
success
boolean
401
Unauthorized
Authorization Error
{
"status": "error",
"message": "You must be logged in to do this."
}
object
status
string
message
string