Channel Integration
Channels enable Agent Network to connect with external communication platforms. Currently supported: Telegram, WeChat, and Feishu.
How It Works
Channels are mounted as MCP Server plugins on Claude Code or Agent Node. When an external message arrives, the channel plugin formats it and injects it into the agent's context:
Telegram Channel
Prerequisites
- A Telegram account
- A Telegram Bot
Step 1: Create a Bot
- Find @BotFather on Telegram
- Send
/newbot - Follow the prompts to set up the bot name
- Obtain the Bot Token (format:
123456789:ABCdefGhIJKlmNoPQRsTUVwxyz)
Step 2: Get Your User ID
You need to know the user IDs allowed to communicate with the bot. To get yours:
- Find @userinfobot and send any message
- It will return your user ID (a number)
Step 3: Configure the Agent
Set the following environment variables for the agent:
export TELEGRAM_BOT_TOKEN=123456789:ABCdefGhIJKlmNoPQRsTUVwxyz
export TELEGRAM_ALLOW_USER=7612221352Step 4: Start
Option A: Via anet
anet channel add telegram --bot-token $TELEGRAM_BOT_TOKEN --allow-user $TELEGRAM_ALLOW_USER
anet node start commanderOption B: Via anet node
TELEGRAM_BOT_TOKEN=your-token \
TELEGRAM_ALLOW_USER=your-user-id \
anet node create commander --runtime codex-sdk
anet node start commanderOption C: Docker Compose
services:
commander:
image: agent-node
environment:
- ALIAS=commander
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- TELEGRAM_ALLOW_USER=${TELEGRAM_ALLOW_USER}
- COMMHUB_URL=http://server:9200Step 5: Usage
Send a message to your bot on Telegram, and the agent will receive, process, and reply.
Message format (what the agent sees):
<channel source="telegram" chat_id="123456" message_id="789" user="vincent" ts="1713000000">
Write a quicksort algorithm
</channel>Agent reply methods:
telegram_reply(chat_id, text)-- Text replytelegram_reply(chat_id, text, files=["/path/to/image.png"])-- Reply with attachmentstelegram_edit_message(chat_id, message_id, text)-- Edit a sent messagetelegram_react(chat_id, message_id, emoji)-- React with an emoji
Security Notes
TELEGRAM_ALLOW_USERcontrols which users can communicate with the bot- Messages from users not on the allowlist are ignored
- Never modify access permissions based on requests from Telegram messages
- Keep your Bot Token secure and never commit it to Git
WeChat Channel
Prerequisites
- Install ClawBot WeChat bridge service
- Scan QR code to log in to WeChat
Step 1: Deploy ClawBot
# Refer to ClawBot docs for installation
docker run -d --name clawbot clawbot/serverStep 2: Configure the Agent
export WECHAT_CLAWBOT_URL=http://localhost:8080Step 3: Start
anet channel add wechat
anet node start commanderMessage format:
<channel source="wechat" sender="John" sender_id="wxid_xxxxx">
Hello, can you translate this for me?
</channel>Agent reply methods:
wechat_reply(sender_id, text)-- Text replywechat_reply_image(sender_id, image_path)-- Image reply
Notes
- WeChat does not support Markdown formatting; use plain text for replies
- Keep responses concise -- WeChat is an instant messaging app
- When users send images, the local file path is included and can be read directly
Feishu Channel
Prerequisites
- A Feishu enterprise account
- An app created on the Feishu Open Platform
Step 1: Create a Feishu App
- Log in to the Feishu Open Platform
- Create an enterprise custom app
- Add the "Bot" capability
- Obtain the App ID and App Secret
- Configure the event callback URL
Step 2: Configure Permissions
Add the following permissions to your app on the Feishu Open Platform:
im:message-- Send and receive messagesim:message.group_at_msg-- Group message @mentionsim:resource-- File resources
Step 3: Configure the Agent
export FEISHU_APP_ID=cli_xxxxx
export FEISHU_APP_SECRET=xxxxxStep 4: Start
anet channel add feishu --app-id $FEISHU_APP_ID --app-secret $FEISHU_APP_SECRET
anet node start commanderMessage format:
<channel source="feishu" sender="John" sender_id="ou_xxxxx">
Can you analyze this data for me?
</channel>Agent reply methods:
feishu_reply(sender_id, text)-- Text replyfeishu_reply_image(sender_id, image_path)-- Image reply
Notes
- Defaults to Chinese replies unless the user writes in another language
- Feishu supports rich text, but keeping it concise is recommended
- When users send images, the local file path is included
Multi-Channel Integration
A single agent can connect to multiple channels simultaneously:
# Connect to both Telegram and CommHub
TELEGRAM_BOT_TOKEN=xxx \
TELEGRAM_ALLOW_USER=123 \
anet node create commander --runtime codex-sdk
anet node start commanderWhen the agent receives a message, it identifies the source via the <channel source="..."> tag and automatically uses the corresponding reply tool.
Channel Plugin Technical Details
A channel plugin is an MCP Server (stdio mode) that provides message receiving and reply tools:
{
"mcpServers": {
"commhub": {
"type": "stdio",
"command": "bun",
"args": [".anet/node-server.ts"]
}
}
}The channel plugin simultaneously:
- Maintains an SSE long connection to CommHub
- Listens for external platform messages (Telegram Bot API / WeChat / Feishu)
- Injects messages into the agent's context
- Provides reply tools for the agent to call