addChannelMembers
Requires an authenticated session.
Adds people to a channel. Every person must belong to the same organization as the channel, otherwise the whole request is refused. Only an admin or manager, or an admin of that channel, can do this. Needs a signed-in user.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation AddChannelMembers($channelId: String!, $memberIds: [String!]!) {
addChannelMembers(channelId: $channelId, memberIds: $memberIds) {
id
name
createdAt
createdBy
description
isDefault
conversation {
id
title
type
createdAt
channelId
isGroup
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AddChannelMembers($channelId: String!, $memberIds: [String!]!) {\n addChannelMembers(channelId: $channelId, memberIds: $memberIds) {\n id\n name\n createdAt\n createdBy\n description\n isDefault\n conversation {\n id\n title\n type\n createdAt\n channelId\n isGroup\n }\n }\n}",
"variables": {
"channelId": "string",
"memberIds": [
"string"
]
}
}
EOF
Variables:
{
"channelId": "string",
"memberIds": [
"string"
]
}
Response:
{
"data": {
"addChannelMembers": {
"id": "id",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"createdBy": "string",
"description": "string",
"isDefault": true,
"conversation": {
"id": "id",
"title": "string",
"type": "string",
"createdAt": "2025-01-15T00:00:00Z",
"channelId": "string",
"isGroup": true
}
}
}
}
addChannelMembers(
channelId: String!
memberIds: [String!]!
): ChatChannel!
Arguments
addChannelMembers.channelId ● String! non-null scalar
The ID of the chat channel.
addChannelMembers.memberIds ● [String!]! non-null scalar
The IDs of the people to add.
Type
ChatChannel object
A chat channel that people can join.