channels.md +261 −0 created
1> ## Documentation Index
2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt
3> Use this file to discover all available pages before exploring further.
4
5# Push events into a running session with channels
6
7> Use channels to push messages, alerts, and webhooks into your Claude Code session from an MCP server. Forward CI results, chat messages, and monitoring events so Claude can react while you're away.
8
9<Note>
10 Channels are in [research preview](#research-preview) and require Claude Code v2.1.80 or later. They require claude.ai login. Console and API key authentication is not supported. Team and Enterprise organizations must [explicitly enable them](#enterprise-controls).
11</Note>
12
13A channel is an MCP server that pushes events into your running Claude Code session, so Claude can react to things that happen while you're not at the terminal. Channels can be two-way: Claude reads the event and replies back through the same channel, like a chat bridge. Events only arrive while the session is open, so for an always-on setup you run Claude in a background process or persistent terminal.
14
15You install a channel as a plugin and configure it with your own credentials. Telegram and Discord are included in the research preview.
16
17When Claude replies through a channel, you see the inbound message in your terminal but not the reply text. The terminal shows the tool call and a confirmation (like "sent"), and the actual reply appears on the other platform.
18
19This page covers:
20
21* [Supported channels](#supported-channels): Telegram and Discord setup
22* [Install and run a channel](#quickstart) with fakechat, a localhost demo
23* [Who can push messages](#security): sender allowlists and how you pair
24* [Enable channels for your organization](#enterprise-controls) on Team and Enterprise
25
26To build your own channel, see the [Channels reference](/en/channels-reference).
27
28## Supported channels
29
30Each supported channel is a plugin that requires [Bun](https://bun.sh). For a hands-on demo of the plugin flow before connecting a real platform, try the [fakechat quickstart](#quickstart).
31
32<Tabs>
33 <Tab title="Telegram">
34 View the full [Telegram plugin source](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram).
35
36 <Steps>
37 <Step title="Create a Telegram bot">
38 Open [BotFather](https://t.me/BotFather) in Telegram and send `/newbot`. Give it a display name and a unique username ending in `bot`. Copy the token BotFather returns.
39 </Step>
40
41 <Step title="Install the plugin">
42 In Claude Code, run:
43
44 ```
45 /plugin install telegram@claude-plugins-official
46 ```
47
48 If Claude Code reports that the plugin is not found in any marketplace, run `/plugin marketplace add anthropics/claude-plugins-official` first and retry the install.
49 </Step>
50
51 <Step title="Configure your token">
52 Run the configure command with the token from BotFather:
53
54 ```
55 /telegram:configure <token>
56 ```
57
58 This saves it to `~/.claude/channels/telegram/.env`. You can also set `TELEGRAM_BOT_TOKEN` in your shell environment before launching Claude Code.
59 </Step>
60
61 <Step title="Restart with channels enabled">
62 Exit Claude Code and restart with the channel flag. This starts the Telegram plugin, which begins polling for messages from your bot:
63
64 ```bash theme={null}
65 claude --channels plugin:telegram@claude-plugins-official
66 ```
67 </Step>
68
69 <Step title="Pair your account">
70 Open Telegram and send any message to your bot. The bot replies with a pairing code.
71
72 <Note>If your bot doesn't respond, make sure Claude Code is running with `--channels` from the previous step. The bot can only reply while the channel is active.</Note>
73
74 Back in Claude Code, run:
75
76 ```
77 /telegram:access pair <code>
78 ```
79
80 Then lock down access so only your account can send messages:
81
82 ```
83 /telegram:access policy allowlist
84 ```
85 </Step>
86 </Steps>
87 </Tab>
88
89 <Tab title="Discord">
90 View the full [Discord plugin source](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord).
91
92 <Steps>
93 <Step title="Create a Discord bot">
94 Go to the [Discord Developer Portal](https://discord.com/developers/applications), click **New Application**, and name it. In the **Bot** section, create a username, then click **Reset Token** and copy the token.
95 </Step>
96
97 <Step title="Enable Message Content Intent">
98 In your bot's settings, scroll to **Privileged Gateway Intents** and enable **Message Content Intent**.
99 </Step>
100
101 <Step title="Invite the bot to your server">
102 Go to **OAuth2 > URL Generator**. Select the `bot` scope and enable these permissions:
103
104 * View Channels
105 * Send Messages
106 * Send Messages in Threads
107 * Read Message History
108 * Attach Files
109 * Add Reactions
110
111 Open the generated URL to add the bot to your server.
112 </Step>
113
114 <Step title="Install the plugin">
115 In Claude Code, run:
116
117 ```
118 /plugin install discord@claude-plugins-official
119 ```
120
121 If Claude Code reports that the plugin is not found in any marketplace, run `/plugin marketplace add anthropics/claude-plugins-official` first and retry the install.
122 </Step>
123
124 <Step title="Configure your token">
125 Run the configure command with the bot token you copied:
126
127 ```
128 /discord:configure <token>
129 ```
130
131 This saves it to `~/.claude/channels/discord/.env`. You can also set `DISCORD_BOT_TOKEN` in your shell environment before launching Claude Code.
132 </Step>
133
134 <Step title="Restart with channels enabled">
135 Exit Claude Code and restart with the channel flag. This connects the Discord plugin so your bot can receive and respond to messages:
136
137 ```bash theme={null}
138 claude --channels plugin:discord@claude-plugins-official
139 ```
140 </Step>
141
142 <Step title="Pair your account">
143 DM your bot on Discord. The bot replies with a pairing code.
144
145 <Note>If your bot doesn't respond, make sure Claude Code is running with `--channels` from the previous step. The bot can only reply while the channel is active.</Note>
146
147 Back in Claude Code, run:
148
149 ```
150 /discord:access pair <code>
151 ```
152
153 Then lock down access so only your account can send messages:
154
155 ```
156 /discord:access policy allowlist
157 ```
158 </Step>
159 </Steps>
160 </Tab>
161</Tabs>
162
163You can also [build your own channel](/en/channels-reference) for systems that don't have a plugin yet.
164
165## Quickstart
166
167Fakechat is an officially supported demo channel that runs a chat UI on localhost, with nothing to authenticate and no external service to configure.
168
169Once you install and enable fakechat, you can type in the browser and the message arrives in your Claude Code session. Claude replies, and the reply shows up back in the browser. After you've tested the fakechat interface, try out [Telegram](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram) or [Discord](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord).
170
171To try the fakechat demo, you'll need:
172
173* Claude Code [installed and authenticated](/en/quickstart#step-1-install-claude-code) with a claude.ai account
174* [Bun](https://bun.sh) installed. The pre-built channel plugins are Bun scripts. Check with `bun --version`; if that fails, [install Bun](https://bun.sh/docs/installation).
175* **Team/Enterprise users**: your organization admin must [enable channels](#enterprise-controls) in managed settings
176
177<Steps>
178 <Step title="Install the fakechat channel plugin">
179 Start a Claude Code session and run the install command:
180
181 ```text theme={null}
182 /plugin install fakechat@claude-plugins-official
183 ```
184
185 If Claude Code reports that the plugin is not found in any marketplace, run `/plugin marketplace add anthropics/claude-plugins-official` first and retry the install.
186 </Step>
187
188 <Step title="Restart with the channel enabled">
189 Exit Claude Code, then restart with `--channels` and pass the fakechat plugin you installed:
190
191 ```bash theme={null}
192 claude --channels plugin:fakechat@claude-plugins-official
193 ```
194
195 The fakechat server starts automatically.
196
197 <Tip>
198 You can pass several plugins to `--channels`, space-separated.
199 </Tip>
200 </Step>
201
202 <Step title="Push a message in">
203 Open the fakechat UI at [http://localhost:8787](http://localhost:8787) and type a message:
204
205 ```text theme={null}
206 hey, what's in my working directory?
207 ```
208
209 The message arrives in your Claude Code session as a `<channel source="fakechat">` event. Claude reads it, does the work, and calls fakechat's `reply` tool. The answer shows up in the chat UI.
210 </Step>
211</Steps>
212
213If Claude hits a permission prompt while you're away from the terminal, the session pauses until you approve locally. For unattended use, [`--dangerously-skip-permissions`](/en/permissions#permission-modes) bypasses prompts, but only use it in environments you trust.
214
215## Security
216
217Every approved channel plugin maintains a sender allowlist: only IDs you've added can push messages, and everyone else is silently dropped.
218
219Telegram and Discord bootstrap the list by pairing:
220
2211. Find your bot in Telegram or Discord and send it any message
2222. The bot replies with a pairing code
2233. In your Claude Code session, approve the code when prompted
2244. Your sender ID is added to the allowlist
225
226On top of that, you control which servers are enabled each session with `--channels`, and on Team and Enterprise plans your organization controls availability with [`channelsEnabled`](#enterprise-controls).
227
228Being in `.mcp.json` isn't enough to push messages: a server also has to be named in `--channels`.
229
230## Enterprise controls
231
232Channels are controlled by the `channelsEnabled` setting in [managed settings](/en/settings).
233
234| Plan type | Default behavior |
235| :------------------------- | :------------------------------------------------------------- |
236| Pro / Max, no organization | Channels available; users opt in per session with `--channels` |
237| Team / Enterprise | Channels disabled until an admin explicitly enables them |
238
239### Enable channels for your organization
240
241Admins can enable channels from [**claude.ai → Admin settings → Claude Code → Channels**](https://claude.ai/admin-settings/claude-code), or by setting `channelsEnabled` to `true` in managed settings.
242
243Once enabled, users in your organization can use `--channels` to opt channel servers into individual sessions. If the setting is disabled or unset, the MCP server still connects and its tools work, but channel messages won't arrive. A startup warning tells the user to have an admin enable the setting.
244
245## Research preview
246
247Channels are a research preview feature. Availability is rolling out gradually, and the `--channels` flag syntax and protocol contract may change based on feedback.
248
249During the preview, `--channels` only accepts plugins from an Anthropic-maintained allowlist. The channel plugins in [claude-plugins-official](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins) are the approved set. If you pass something that isn't, Claude Code starts normally but the channel doesn't register, and the startup notice tells you why.
250
251To test a channel you're building, use `--dangerously-load-development-channels`. See [Test during the research preview](/en/channels-reference#test-during-the-research-preview) for information about testing custom channels that you build.
252
253Report issues or feedback on the [Claude Code GitHub repository](https://github.com/anthropics/claude-code/issues).
254
255## Next steps
256
257Once you have a channel running, explore these related features:
258
259* [Build your own channel](/en/channels-reference) for systems that don't have plugins yet
260* [Remote Control](/en/remote-control) to drive a local session from your phone instead of forwarding events into it
261* [Scheduled tasks](/en/scheduled-tasks) to poll on a timer instead of reacting to pushed events