Invite Users to Group

Prev Next
Post
/api/v1/groups.invite

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
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
Invite by IDs
{
  "roomId": "ByehQjC44FwMeiLbX",
  "userId": "nSYqWzZ4GsKTX4dyK"
}
Invite by names
{
  "roomName": "private-abc",
  "username": "john.doe"
}
Invite multiple users by ID
{
  "roomId": "ByehQjC44FwMeiLbX",
  "userIds": [
    "nSYqWzZ4GsKTX4dyK",
    "SYqWzZ4Gsasdfgh"
  ]
}
Invite multiple users by username
{
  "roomName": "private-abc",
  "usernames": [
    "john.doe",
    "jane.doe"
  ]
}
object
roomId
string

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.
ExampleByehQjC44FwMeiLbX
roomName
string

The group name. This parameter is required if no roomId is provided.

Exampleprivate-abc
userId
string

The ID of the user to be invited. This parameter is required if no username, userIds, or usernames is provided.

ExamplenSYqWzZ4GsKTX4dyK
username
string

The username of the user to be invited. This parameter is required if no userId, userIds, or usernames is provided.

Examplejohn.doe
userIds
Array of string

An array of user IDs to invite. This parameter is required if no userId, username, or usernames is provided.

Example[ "nSYqWzZ4GsKTX4dyK", "SYqWzZ4Gsasdfgh" ]
string
usernames
Array of string

An array of usernames to invite. This parameter is required if no userId, username, or userIds is provided.

Example[ "john.doe", "jane.doe" ]
string
Responses
200

OK

Success
{
  "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
}
Expand All
object
group
object
_id
string
ts
string
t
string
name
string
usernames
Array of string
string
u
object
_id
string
username
string
msgs
integer
_updatedAt
string
lm
string
success
boolean
400

Bad Request

Room parameter required
{
  "success": false,
  "error": "The parameter \"roomId\" or \"roomName\" is required [error-room-param-not-provided]",
  "errorType": "error-room-param-not-provided"
}
User parameter required
{
  "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"
}
Permission required
{
  "success": false,
  "error": "Not allowed [error-not-allowed]",
  "errorType": "error-not-allowed",
  "details": {
    "method": "addUsersToRoom"
  }
}
Expand All
object
success
boolean
error
string
errorType
string
details
object
method
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string