How to Use DeerFlow with Telegram, Slack, and Feishu Chatbots
I deployed DeerFlow on my server. It worked great through the web UI. But then I tried to use it from my phone. Problem: I had to open a browser, type the URL, wait for the page to load. Too many steps for a quick question.
I needed a way to chat with my AI agent from my phone without the browser friction. That’s when I discovered DeerFlow’s IM Channels.
The Problem: AI Agents Locked to Web UI
Most AI agents only work through their web interface. This creates real friction:
- Can’t access from mobile easily
- No push notifications
- Can’t integrate with existing team workflows
- Have to switch contexts every time
I wanted to send a message and get a response. Like texting a colleague.
The Solution: IM Channel Integration
DeerFlow supports three messaging platforms out of the box:
Telegram ────┐ │Slack ───────┼──▶ MessageBus ──▶ ChannelManager ──▶ LangGraph Agent │Feishu ──────┘Each platform uses a different transport method:
| Channel | Transport | Difficulty |
|---|---|---|
| Telegram | Bot API (long-polling) | Easy |
| Slack | Socket Mode | Moderate |
| Feishu / Lark | WebSocket | Moderate |
The best part? No public IP required for any channel. Everything works through outbound connections.
Setting Up Telegram (Easiest)
I started with Telegram because it’s the simplest.
Step 1: Create a bot
Open Telegram and search for @BotFather. Send /newbot and follow the prompts. BotFather gives you an HTTP API token that looks like:
123456789:ABCdefGHIjklMNOpqrsTUVwxyzStep 2: Configure DeerFlow
channels: telegram: enabled: true bot_token: $TELEGRAM_BOT_TOKENTELEGRAM_BOT_TOKEN=123456789:ABCdefGHI...Step 3: Start DeerFlow
That’s it. No webhooks, no SSL certificates, no public IP. Telegram uses long-polling, which means DeerFlow actively fetches new messages from Telegram’s servers.
I opened Telegram, found my bot, sent “Hello” and got a response. It worked.
Setting Up Slack (Moderate)
Slack requires more configuration but enables team collaboration.
Step 1: Create a Slack App
Go to api.slack.com/apps and create a new app. Choose “From scratch” and select your workspace.
Step 2: Add Bot Token Scopes
Navigate to “OAuth & Permissions” and add these scopes:
app_mentions:read- Hear when someone mentions the botchat:write- Send messagesim:history- Read direct messagesim:read- View direct message channelsim:write- Start direct messagesfiles:write- Upload files
Step 3: Enable Socket Mode
This is crucial. Socket Mode lets your app connect to Slack without a public URL.
- Go to “Socket Mode” in your app settings
- Enable it
- Generate an App-Level Token (starts with
xapp-)
Step 4: Subscribe to Events
Go to “Event Subscriptions” and enable it. Subscribe to:
app_mention- When someone mentions the bot in a channelmessage.im- When someone sends a direct message
Step 5: Install and Configure
Install the app to your workspace. You’ll get a Bot Token (starts with xoxb-).
channels: slack: enabled: true bot_token: $SLACK_BOT_TOKEN # xoxb-... app_token: $SLACK_APP_TOKEN # xapp-...SLACK_BOT_TOKEN=xoxb-...SLACK_APP_TOKEN=xapp-...I tested it by mentioning my bot in a channel: @deerflow hello. It responded.
Setting Up Feishu / Lark (Moderate)
Feishu is popular in China. Lark is the international version. They use the same API.
Step 1: Create an App
Go to the Feishu Open Platform (open.feishu.cn for China, open.larksuite.com for international). Create a new app.
Step 2: Enable Bot Capability
In the app settings, find “Bot” and enable it.
Step 3: Add Permissions
Add these permissions:
im:message- Send and receive messagesim:message.p2p_msg:readonly- Read direct messagesim:resource- Access resources
Step 4: Subscribe to Events
Subscribe to im.message.receive_v1 event.
Step 5: Configure Long Connection
In “Event Subscriptions”, select “Long Connection” mode. This is similar to Socket Mode - no public IP needed.
channels: feishu: enabled: true app_id: $FEISHU_APP_ID app_secret: $FEISHU_APP_SECRETFEISHU_APP_ID=cli_...FEISHU_APP_SECRET=...How It Works Under the Hood
I was curious about the architecture. Here’s what I found.
MessageBus is the central hub. It’s an async pub/sub system:
User Message → Channel (Telegram/Slack/Feishu) ↓ MessageBus (publishes InboundMessage) ↓ ChannelManager (dispatches to agent) ↓ LangGraph Agent (processes) ↓ MessageBus (publishes OutboundMessage) ↓ Channel (sends reply)Store maps conversations to threads. The key format is channel:chat[:topic]. For example:
telegram:123456789- A Telegram chatslack:C12345678- A Slack channelfeishu:ou_xxx- A Feishu user
ChannelManager creates threads and routes commands. When you send a message, it either continues an existing thread or creates a new one.
Available Commands
All channels support these commands:
| Command | Description |
|---|---|
/new | Start a new conversation |
/status | Show current thread info |
/models | List available models |
/memory | View memory |
/help | Show help |
If you send a message without a command prefix, DeerFlow treats it as a regular chat. It creates a thread and responds conversationally.
Per-Channel Configuration
I wanted different settings for different channels. DeerFlow supports this:
channels: telegram: enabled: true bot_token: $TELEGRAM_BOT_TOKEN session: assistant_id: mobile_agent context: thinking_enabled: false users: "123456789": assistant_id: vip_agent context: thinking_enabled: true subagent_enabled: trueThis configuration:
- Uses
mobile_agentfor all Telegram users by default - Disables thinking mode (faster responses on mobile)
- Gives user
123456789access tovip_agentwith thinking and subagent enabled
Streaming Responses
Different platforms handle streaming differently.
Feishu uses interactive cards with incremental updates:
┌─────────────────────────────┐│ 🤔 Thinking... │ ← Initial card│ ││ [Running indicator] │└─────────────────────────────┘ ↓ (patch)┌─────────────────────────────┐│ Here's the answer: │ ← Updated card│ The weather is sunny... │└─────────────────────────────┘Slack and Telegram wait for the complete response and send it as a single message. This is simpler but less interactive.
Why This Matters
| Feature | Web UI Only | With IM Channels |
|---|---|---|
| Mobile access | Browser needed | Native apps |
| Quick questions | Open app | Send message |
| Notifications | Manual check | Push notifications |
| Team collaboration | Single user | Shared channels |
| Workflow integration | None | ChatOps |
I now use DeerFlow from Telegram for quick questions. My team uses Slack for collaborative tasks. The same backend, different interfaces.
Troubleshooting
Bot not responding?
- Check your tokens are correct
- Verify the bot is enabled in config
- Look at DeerFlow logs for errors
- For Slack, make sure Socket Mode is enabled
Messages going to wrong thread?
The store maps channel:chat to thread IDs. If something goes wrong, you can delete the store file to reset mappings.
Feishu not connecting?
Make sure you selected “Long Connection” mode, not “Webhook” mode. Webhook mode requires a public IP.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 DeerFlow GitHub Repository
- 👨💻 Telegram Bot API Documentation
- 👨💻 Slack Socket Mode Documentation
- 👨💻 Feishu Open Platform Documentation
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments