Skip to content

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:

ChannelTransportDifficulty
TelegramBot API (long-polling)Easy
SlackSocket ModeModerate
Feishu / LarkWebSocketModerate

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:ABCdefGHIjklMNOpqrsTUVwxyz

Step 2: Configure DeerFlow

config.yaml
channels:
telegram:
enabled: true
bot_token: $TELEGRAM_BOT_TOKEN
.env
TELEGRAM_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 bot
  • chat:write - Send messages
  • im:history - Read direct messages
  • im:read - View direct message channels
  • im:write - Start direct messages
  • files:write - Upload files

Step 3: Enable Socket Mode

This is crucial. Socket Mode lets your app connect to Slack without a public URL.

  1. Go to “Socket Mode” in your app settings
  2. Enable it
  3. 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 channel
  • message.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-).

config.yaml
channels:
slack:
enabled: true
bot_token: $SLACK_BOT_TOKEN # xoxb-...
app_token: $SLACK_APP_TOKEN # xapp-...
.env
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 messages
  • im:message.p2p_msg:readonly - Read direct messages
  • im: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.

config.yaml
channels:
feishu:
enabled: true
app_id: $FEISHU_APP_ID
app_secret: $FEISHU_APP_SECRET
.env
FEISHU_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 chat
  • slack:C12345678 - A Slack channel
  • feishu: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:

CommandDescription
/newStart a new conversation
/statusShow current thread info
/modelsList available models
/memoryView memory
/helpShow 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:

config.yaml
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: true

This configuration:

  • Uses mobile_agent for all Telegram users by default
  • Disables thinking mode (faster responses on mobile)
  • Gives user 123456789 access to vip_agent with 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

FeatureWeb UI OnlyWith IM Channels
Mobile accessBrowser neededNative apps
Quick questionsOpen appSend message
NotificationsManual checkPush notifications
Team collaborationSingle userShared channels
Workflow integrationNoneChatOps

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?

  1. Check your tokens are correct
  2. Verify the bot is enabled in config
  3. Look at DeerFlow logs for errors
  4. 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:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments