Direct Message Channel Users

Using the Direct Message Channel Users endpoint you are able to add and remove individual users from a channel. If you wish to set the entire list of users for a channel use the Direct Message Channels endpoint.

Get Direct Channel Users

Get all users that belong to a specified channel

GET /direct_message_channels/{channel_id}/users

Pagination

The maximum number of users that will be returned in a single request is 100. If there are more than 100 users you can specify a page parameter great than 1 to get more data. The response will contain information about how many pages of data are available.

Query Parameters

Parameter

Default

Description

page

1

Specifies which page of results to return

per_page

100

Specifies maximum number of channels to return in a given request. The maximum you can specify is 100.

Success Response

A successful response will have an HTTP status of 200

Response Properties

Property

Description

page

Current page number of data returned

per_page

Maximum number of users returned per page

total_pages

Number of pages of data available

response_count

The number of users that were returned from the given request

total_count

Total number of users that are available

channel

Information about the specified channel

users

Collection of users

Example response

The sample response below indicates that you have received the second page of results. There are 2 pages available. The current page contains 21 of the total 121 channels.

{
    "page": 2,
    "per_page": 100,
    "total_pages": 2,
    "response_count": 21,
    "total_count": 121,
    "channel": {
        "id": "chat.groupdm.7357e053-3306-4f41-b7a1-06b8aac46589",
        "name": "Buddies"
    },
    "users": [
      {...},
      {...}
    ]
}

Add a Direct Message Channel User

PUT /direct_message_channels/{channel_id}/users

Path Parameters

Parameter

Description

channel_id

Id of the channel you are adding a user to.

Body Parameters

Parameter

Required

Description

id

Yes

Id of the user you are adding to the channel

Example Request Body

{
   "id": "d4fa7488-7a58-4bd0-956a-9f8c5b0a87f1"
}

Success Response

A successful channel user add response will have an HTTP status of 200. The payload of the response is the same as you will see when requesting information about a specific user.

Error Response

If there was a problem creating the channel you will receive a response that contains status and message properties.

Example error response:

{
    "status": 422,
    "message": {
        "error": "Invalid Users",
        "invalid_user_ids": [
            "my-bogus-id"
        ]
    }
}

Remove a Channel User

Remove a specified user from a specified channel

DELETE /direct_message_channels/{channel_id}/users/{user_id}

Path Parameters

Parameter

Description

channel_id

Id of the channel you are removing a user to.

user_id

Id of the user you wish to remove from the channel

Direct Message Channels must contain at least 2 users. If you attempt to remove too many users you will receive an error response.

Success Response

A successful channel creation response will have an HTTP status of 200. The payload of the response is the same as you will see when requesting information about a specific user.

Error Response

Example Error Response

{
    "status": 422,
    "message": {
        "error": "Direct Message Channel must contain at least 2 users.  Use DELETE if this channel is no longer needed."
    }
}

Last updated

Logo

© Copyright 2024 ALO.ai, Inc. • All Rights Reserved