Skip to main content
The Channel interface represents a channel or conversation container that can hold multiple threads. It provides methods for posting messages, iterating threads and messages, and managing channel-level state.

Properties

id

Unique channel ID. Format: {adapter}:{channelId} Examples:
  • Slack: slack:C123ABC
  • Teams: teams:{base64(conversationId)}
  • Google Chat: gchat:spaces/ABC123

adapter

The adapter this channel belongs to.

isDM

Whether this is a direct message conversation.

name

Channel name (e.g., “#general”). Null until fetchMetadata() is called.

state

Get the current channel state. Returns null if no state has been set.

messages

Iterate channel-level messages newest first (backward from most recent). Auto-paginates lazily.
This returns top-level channel messages, NOT thread replies. For threaded platforms like Slack, this returns messages posted to the channel directly (not in threads).

Methods

post()

Post a message to the channel (top-level, not in a thread).
string | PostableMessage | CardJSXElement
required
Message content to post
SentMessage
A SentMessage with methods to edit, delete, or add reactions
Streaming at the channel level accumulates all chunks before posting as a single message, since channel-level streaming is not typically supported.

postEphemeral()

Post an ephemeral message visible only to a specific user in this channel.
string | Author
required
User ID string or Author object (from message.author or event.user)
AdapterPostableMessage | CardJSXElement
required
Message content (string, markdown, card, etc.)
PostEphemeralOptions
required
EphemeralMessage | null
EphemeralMessage with usedFallback: true if DM was used, or null if unsupported and fallbackToDM is false

setState()

Set the channel state. Merges with existing state by default.
Partial<TState>
required
State object to set (will be merged with existing state unless replace: true)
object

startTyping()

Show typing indicator in the channel.
string
Optional status text shown where supported

fetchMetadata()

Fetch channel metadata from the platform (name, member count, etc.).
ChannelInfo
Channel metadata object

threads()

Iterate threads in this channel, most recently active first. Returns lightweight ThreadSummary objects for efficiency.
Returns an empty iterable on threadless platforms (platforms that don’t support threaded conversations).
AsyncIterable<ThreadSummary>
Async iterable of thread summaries

mentionUser()

Get a platform-specific mention string for a user.
string
required
Platform-specific user ID
string
Formatted mention string (e.g., <@U123>)

Type Parameters

object
default:"Record<string, unknown>"
Custom state type stored per-channel
unknown
default:"unknown"
Platform-specific raw message type

Usage Examples

Channel Announcements

Welcome New Members

List Active Threads

Slash Command Response

Channel State Management

See Also