Skip to main content

Overview

The Channel Members API allows you to add users to channels, update their preferences, and remove them from channels. Each channel member has individual settings for notifications, visibility, and favorites. All operations require authentication and appropriate permissions.

Methods

channelMember.create

Adds the current user to a channel. The userId is automatically set from the authenticated user. Requires permission to join the channel (e.g., public channels or organization admin).
channelId
string
required
Channel ID to join
data
ChannelMember
transactionId
string
Transaction ID for optimistic updates
const result = await client.channelMember.create({
  channelId: "ch-abc123"
});
Errors:
  • ChannelNotFoundError - Channel doesn’t exist
  • UnauthorizedError - User lacks permission to join channel
  • InternalServerError - Unexpected server error

channelMember.update

Updates channel member preferences and settings. Members can update their own preferences (mute, hide, favorite). Organization admins can update any member’s settings.
id
string
required
Channel member ID to update
isHidden
boolean
Whether to hide the channel in the sidebar
isMuted
boolean
Whether to mute notifications for this channel
isFavorite
boolean
Whether to mark the channel as favorite
lastSeenMessageId
string | null
ID of the last message seen by the user
notificationCount
number
Number of unread notifications (typically managed by system)
data
ChannelMember
Updated channel member object (see channelMember.create for structure)
transactionId
string
Transaction ID for optimistic updates
const result = await client.channelMember.update({
  id: "cm-xyz789",
  isMuted: true
});
Errors:
  • ChannelMemberNotFoundError - Channel member doesn’t exist
  • UnauthorizedError - User lacks permission to update member
  • InternalServerError - Unexpected server error

channelMember.delete

Removes a user from a channel (soft delete). Members can leave channels themselves. Organization admins can remove any member from a channel.
id
string
required
Channel member ID to delete
transactionId
string
Transaction ID for optimistic updates
const result = await client.channelMember.delete({
  id: "cm-xyz789"
});
Errors:
  • ChannelMemberNotFoundError - Channel member doesn’t exist
  • UnauthorizedError - User lacks permission to remove member
  • InternalServerError - Unexpected server error

channelMember.clearNotifications

Clears the notification count for the current user in a specific channel. Called when a user views/enters a channel to reset their unread notification count.
channelId
string
required
Channel ID to clear notifications for
transactionId
string
Transaction ID for optimistic updates
const result = await client.channelMember.clearNotifications({
  channelId: "ch-abc123"
});
Note: This operation also deletes all notification records for this channel. Errors:
  • ChannelNotFoundError - Channel doesn’t exist
  • UnauthorizedError - User is not a member of the channel
  • InternalServerError - Unexpected server error

Usage Example

// Join a channel
const membership = await client.channelMember.create({
  channelId: "ch-abc123"
});

// Update preferences
await client.channelMember.update({
  id: membership.data.id,
  isFavorite: true,
  isMuted: false
});

// Clear notifications when viewing channel
await client.channelMember.clearNotifications({
  channelId: "ch-abc123"
});

// Leave channel
await client.channelMember.delete({
  id: membership.data.id
});

Build docs developers (and LLMs) love