GuidesTelegram, Discord, Feishu, SMS
DocsGuidesHow to connect an AI agent to Telegram, Discord, Feishu or SMS

How to connect an AI agent to Telegram, Discord, Feishu or SMS

Each chat app becomes an inbox of files an agent reads with receive and answers with reply: co telegram, co discord, co feishu, co lark and co sms. The listeners dial out, so no public webhook.

Each chat app is one co command that turns a bot into an inbox of files: co telegram, co discord, co feishu (and co lark) and co sms. listen holds the connection and writes every message to ~/.co/inbox/, receive hands the agent the next one as a JSON line, and reply answers it. The listeners dial out, so you don't host a webhook server or open a public endpoint.

1. Telegram

Create a bot with @BotFather and put its token in ~/.co/keys.env as TELEGRAM_BOT_TOKEN. Sending is stable; listen, receive and reply are experimental.

co telegram send 123456789 "The deployment needs attention"
co telegram listen
co telegram receive

2. Discord (experimental)

Create an application at discord.com/developers, add a bot and put its token in ~/.co/keys.env as DISCORD_BOT_TOKEN. The listener uses Discord's Gateway, so no public endpoint.

co discord check
co discord listen
co discord receive

3. Feishu or Lark

co auth feishu prints a QR code; scan it and the bot application is created in your own tenant. It uses the official SDK's long connection, so it runs behind NAT.

pip install lark-oapi
co auth feishu
co feishu listen

4. SMS

Pair an Android phone running OpenOnion Messages. The phone gets an upload-only credential; SMS are decrypted locally.

co sms pair
co sms inbox --pending

5. Answer every message with an agent

Every inbox has the same verbs. consume runs a command per message and replies with its stdout.

co telegram consume -- claude -p
co feishu consume -- claude -p

FAQ

Do I need a server or public URL?

No. The Telegram, Discord and Feishu listeners dial out to the platform, so they run on a laptop behind NAT.

Does it use OpenOnion credits?

Telegram, Discord and Feishu call the platform directly with your own bot, so no OpenOnion credit or credential is involved.

Which verbs are the same across apps?

listen, receive, send, reply, done, check, ls, chats, log and consume, on Telegram, Discord, Feishu and Lark (and WhatsApp).

Which parts are experimental?

co discord as a whole, and Telegram's listen, receive and reply. Both were tested against fakes and not yet a live bot, and they say so in their help.

Updated 2026-09-26. Commands checked against ConnectOnion 1.8.8.

Star us on GitHub

If ConnectOnion saves you time, a ⭐ goes a long way — and earns you a coffee chat with our founder.