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.

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
Example
{
  "roomId": "ByehQjC44FwMeiLbX",
  "userId": "nSYqWzZ4GsKTX4dyK"
}
object
roomId
string Required

The group ID. 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.
userId
string Required

The ID of the user to be invited. You can also use the parameter userIds as an array to invite more than one user. For example, ["nSYqWzZ4GsKTX4dyK", "SYqWzZ4Gsasdfgh"]

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

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