docs/chat-apps.md
Connect nanobot to your favorite chat platform. Want to build your own? See the Channel Plugin Guide.
| Channel | What you need |
|---|---|
| Telegram | Bot token from @BotFather |
| Discord | Bot token + Message Content intent |
QR code scan (nanobot channels login whatsapp) | |
| WeChat (Weixin) | QR code scan (nanobot channels login weixin) |
| Feishu | App ID + App Secret |
| DingTalk | App Key + App Secret |
| Slack | Bot token + App-Level token |
| Matrix | Homeserver URL + Access token |
| IMAP/SMTP credentials | |
| App ID + App Secret | |
| Wecom | Bot ID + Bot Secret |
| Microsoft Teams | App ID + App Password + public HTTPS endpoint |
| Mochat | Claw token (auto-setup available) |
| Signal | signal-cli daemon + phone number |
1. Create a bot
@BotFather/newbot, follow prompts2. Configure
{
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"allowFrom": ["YOUR_USER_ID"]
}
}
}
You can find your User ID in Telegram settings. It is shown as
@yourUserId. Copy this value without the@symbol and paste it into the config file.
3. Run
nanobot gateway
Webhook mode (optional)
Telegram uses long polling by default. To receive updates through a webhook, expose
a public HTTPS URL that forwards to nanobot's local listener and set mode to
webhook:
{
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"mode": "webhook",
"webhookUrl": "https://example.com/telegram",
"webhookListenHost": "127.0.0.1",
"webhookListenPort": 8081,
"webhookPath": "/telegram",
"webhookSecretToken": "CHANGE_ME_RANDOM_SECRET",
"webhookMaxConnections": 4,
"allowFrom": ["YOUR_USER_ID"]
}
}
}
</details> <details> <summary><b>Mochat (Claw IM)</b></summary>
webhookSecretTokenis required in webhook mode. Do not expose the local webhook listener directly to the public internet without a reverse proxy or tunnel in front of it. TLS/Host policy is handled by your proxy; nanobot only listens onwebhookListenHost:webhookListenPortand validates Telegram's webhook secret token.webhookMaxConnectionsdefaults to4; nanobot still serializes Telegram updates per conversation before forwarding them to the agent.
webhookUrlis the public HTTPS URL registered with Telegram.webhookPathis the local path nanobot listens on. They often use the same path, but may differ when a reverse proxy or tunnel rewrites the request path.
Uses Socket.IO WebSocket by default, with HTTP polling fallback.
1. Ask nanobot to set up Mochat for you
Simply send this message to nanobot (replace xxx@xxx with your real email):
Read https://raw.githubusercontent.com/HKUDS/MoChat/refs/heads/main/skills/nanobot/skill.md and register on MoChat. My Email account is xxx@xxx Bind me as your owner and DM me on MoChat.
nanobot will automatically register, configure ~/.nanobot/config.json, and connect to Mochat.
2. Restart gateway
nanobot gateway
That's it — nanobot handles the rest!
<details> <summary>Manual configuration (advanced)</summary>If you prefer to configure manually, add the following to ~/.nanobot/config.json:
Keep
claw_tokenprivate. It should only be sent inX-Claw-Tokenheader to your Mochat API endpoint.
{
"channels": {
"mochat": {
"enabled": true,
"base_url": "https://mochat.io",
"socket_url": "https://mochat.io",
"socket_path": "/socket.io",
"claw_token": "claw_xxx",
"agent_user_id": "6982abcdef",
"sessions": ["*"],
"panels": ["*"],
"reply_delay_mode": "non-mention",
"reply_delay_ms": 120000
}
}
}
1. Create a bot
2. Enable intents
3. Get your User ID
4. Configure
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"allowFrom": ["YOUR_USER_ID"],
"allowChannels": [],
"groupPolicy": "mention",
"streaming": true
}
}
}
groupPolicycontrols how the bot responds in group channels:
"mention"(default) — Only respond when @mentioned"open"— Respond to all messages DMs always respond when the sender is inallowFrom.- If you set group policy to open create new threads as private threads and then @ the bot into it. Otherwise the thread itself and the channel in which you spawned it will spawn a bot session.
allowChannelsrestricts the bot to specific Discord channel IDs. Empty (default) means respond in every channel the bot can see. Example:["1234567890", "0987654321"]. The filter applies afterallowFrom, so both must pass. Discord threads under an allowed parent channel are also allowed; for Forum channels, allowing the parent Forum channel allows all threads/posts in that forum.streamingdefaults totrue. Disable it only if you explicitly want non-streaming replies.
5. Invite the bot
botSend Messages, Read Message History6. Run
nanobot gateway
Install Matrix dependencies first:
pip install nanobot-ai[matrix]
[!NOTE] Matrix is not supported on Windows.
matrix-nio[e2e]depends onpython-olm, which has no pre-built Windows wheel and is skipped by thematrixextra onsys_platform == 'win32'. The command above will still succeed on Windows but withoutmatrix-nioinstalled, so enabling the Matrix channel will fail at startup. Use macOS, Linux, or WSL2.
1. Create/choose a Matrix account
matrix.org).2. Get credentials
userId (example: @nanobot:matrix.org)password(Note: accessToken and deviceId are still supported for legacy reasons, but
for reliable encryption, password login is recommended instead. If the
password is provided, accessToken and deviceId will be ignored.)
3. Configure
{
"channels": {
"matrix": {
"enabled": true,
"homeserver": "https://matrix.org",
"userId": "@nanobot:matrix.org",
"password": "mypasswordhere",
"e2eeEnabled": true,
"sasVerification": true,
"allowFrom": ["@your_user:matrix.org"],
"groupPolicy": "open",
"groupAllowFrom": [],
"allowRoomMentions": false,
"maxMediaBytes": 20971520
}
}
}
Keep a persistent
matrix-store— encrypted session state is lost if these change across restarts.
| Option | Description |
|---|---|
allowFrom | User IDs allowed to interact. Empty denies all; use ["*"] to allow everyone. |
groupPolicy | open (default), mention, or allowlist. |
groupAllowFrom | Room allowlist (used when policy is allowlist). |
allowRoomMentions | Accept @room mentions in mention mode. |
e2eeEnabled | E2EE support (default true). Set false for plaintext-only. |
sasVerification | Auto-complete SAS device verification requests from allowed users (default false). Useful for Element X, which does not expose manual trust for third-party devices. |
maxMediaBytes | Max attachment size (default 20MB). Set 0 to block all media. |
4. Run
nanobot gateway
Requires Node.js ≥18.
1. Link device
nanobot channels login whatsapp
# Scan QR with WhatsApp → Settings → Linked Devices
2. Configure
{
"channels": {
"whatsapp": {
"enabled": true,
"allowFrom": ["+1234567890"]
}
}
}
3. Run (two terminals)
# Terminal 1
nanobot channels login whatsapp
# Terminal 2
nanobot gateway
</details> <details> <summary><b>Feishu</b></summary>WhatsApp bridge updates are not applied automatically for existing installations. After upgrading nanobot, rebuild the local bridge with:
rm -rf ~/.nanobot/bridge && nanobot channels login whatsapp
Uses WebSocket long connection — no public IP required.
1. Create a Feishu bot
im:message (send messages) and im:message.p2p_msg:readonly (receive messages)cardkit:card:write (often labeled Create and update cards in the Feishu developer console). Required for CardKit entities and streamed assistant text. Older apps may not have it yet — open Permission management, enable the scope, then publish a new app version if the console requires it.cardkit:card:write, set "streaming": false under channels.feishu (see below). The bot still works; replies use normal interactive cards without token-by-token streaming.im.message.receive_v1 (receive messages)
2. Configure
{
"channels": {
"feishu": {
"enabled": true,
"appId": "cli_xxx",
"appSecret": "xxx",
"encryptKey": "",
"verificationToken": "",
"allowFrom": ["ou_YOUR_OPEN_ID"],
"groupPolicy": "mention",
"reactEmoji": "OnIt",
"doneEmoji": "DONE",
"toolHintPrefix": "🔧",
"streaming": true,
"domain": "feishu"
}
}
}
streamingdefaults totrue. Usefalseif your app does not havecardkit:card:write(see permissions above).encryptKeyandverificationTokenare optional for Long Connection mode.allowFrom: Add your open_id (find it in nanobot logs when you message the bot). Use["*"]to allow all users.groupPolicy:"mention"(default — respond only when @mentioned),"open"(respond to all group messages). Private chats always respond.reactEmoji: Emoji for "processing" status (default:OnIt). See available emojis.doneEmoji: Optional emoji for "completed" status (e.g.,DONE,OK,HEART). When set, bot adds this reaction after removingreactEmoji.toolHintPrefix: Prefix for inline tool hints in streaming cards (default:🔧).domain:"feishu"(default) for China (open.feishu.cn),"lark"for international Lark (open.larksuite.com).
3. Run
nanobot gateway
</details> <details> <summary><b>QQ (QQ单聊)</b></summary>[!TIP] Feishu uses WebSocket to receive messages — no webhook or public IP needed!
Uses botpy SDK with WebSocket — no public IP required. Currently supports private messages only.
1. Register & create bot
2. Set up sandbox for testing
3. Configure
allowFrom: Add your openid (find it in nanobot logs when you message the bot). Use["*"]for public access.msgFormat: Optional. Use"plain"(default) for maximum compatibility with legacy QQ clients, or"markdown"for richer formatting on newer clients.- For production: submit a review in the bot console and publish. See QQ Bot Docs for the full publishing flow.
{
"channels": {
"qq": {
"enabled": true,
"appId": "YOUR_APP_ID",
"secret": "YOUR_APP_SECRET",
"allowFrom": ["YOUR_OPENID"],
"msgFormat": "plain"
}
}
}
4. Run
nanobot gateway
Now send a message to the bot from QQ — it should respond!
</details> <details> <summary><b>DingTalk (钉钉)</b></summary>Uses Stream Mode — no public IP required.
1. Create a DingTalk bot
2. Configure
{
"channels": {
"dingtalk": {
"enabled": true,
"clientId": "YOUR_APP_KEY",
"clientSecret": "YOUR_APP_SECRET",
"allowFrom": ["YOUR_STAFF_ID"]
}
}
}
allowFrom: Add your staff ID. Use["*"]to allow all users.
3. Run
nanobot gateway
Uses Socket Mode — no public URL required.
1. Create a Slack app
2. Configure the app
connections:write scope → copy it (xapp-...)chat:write, reactions:write, app_mentions:read, files:read, files:write, channels:history, groups:history, im:history, mpim:historymessage.im, message.channels, app_mention → Save Changesxoxb-...)
files:readis required to read files users send to nanobot.files:writeis required for nanobot to send images, videos, and other file uploads. If you add either scope later, reinstall the Slack app to the workspace and restart nanobot so it uses the updated bot token.
3. Configure nanobot
{
"channels": {
"slack": {
"enabled": true,
"botToken": "xoxb-...",
"appToken": "xapp-...",
"allowFrom": ["YOUR_SLACK_USER_ID"],
"groupPolicy": "mention"
}
}
}
4. Run
nanobot gateway
DM the bot directly or @mention it in a channel — it should respond!
</details> <details> <summary><b>Email</b></summary>[!TIP]
groupPolicy:"mention"(default — respond only when @mentioned),"open"(respond to all channel messages), or"allowlist"(restrict to specific channels).- DM policy defaults to open. Set
"dm": {"enabled": false}to disable DMs.
Give nanobot its own email account. It polls IMAP for incoming mail and replies via SMTP — like a personal email assistant.
1. Get credentials (Gmail example)
[email protected])2. Configure
consentGrantedmust betrueto allow mailbox access. This is a safety gate — setfalseto fully disable.allowFrom: Add your email address. Use["*"]to accept emails from anyone.smtpUseTlsandsmtpUseSsldefault totrue/falserespectively, which is correct for Gmail (port 587 + STARTTLS). No need to set them explicitly.- Set
"autoReplyEnabled": falseif you only want to read/analyze emails without sending automatic replies.allowedAttachmentTypes: Save inbound attachments matching these MIME types —["*"]for all, e.g.["application/pdf", "image/*"](default[]= disabled).maxAttachmentSize: Max size per attachment in bytes (default2000000/ 2MB).maxAttachmentsPerEmail: Max attachments to save per email (default5).
{
"channels": {
"email": {
"enabled": true,
"consentGranted": true,
"imapHost": "imap.gmail.com",
"imapPort": 993,
"imapUsername": "[email protected]",
"imapPassword": "your-app-password",
"smtpHost": "smtp.gmail.com",
"smtpPort": 587,
"smtpUsername": "[email protected]",
"smtpPassword": "your-app-password",
"fromAddress": "[email protected]",
"allowFrom": ["[email protected]"],
"allowedAttachmentTypes": ["application/pdf", "image/*"]
}
}
}
3. Run
nanobot gateway
Uses HTTP long-poll with QR-code login via the ilinkai personal WeChat API. No local WeChat desktop client is required.
1. Install with WeChat support
pip install "nanobot-ai[weixin]"
2. Configure
{
"channels": {
"weixin": {
"enabled": true,
"allowFrom": ["YOUR_WECHAT_USER_ID"]
}
}
}
allowFrom: Add the sender ID you see in nanobot logs for your WeChat account. Use["*"]to allow all users.token: Optional. If omitted, log in interactively and nanobot will save the token for you.routeTag: Optional. When your upstream Weixin deployment requires request routing, nanobot will send it as theSKRouteTagheader.stateDir: Optional. Defaults to nanobot's runtime directory for Weixin state.pollTimeout: Optional long-poll timeout in seconds.
3. Login
nanobot channels login weixin
Use --force to re-authenticate and ignore any saved token:
nanobot channels login weixin --force
4. Run
nanobot gateway
Here we use wecom-aibot-sdk-python (community Python version of the official @wecom/aibot-node-sdk).
Uses WebSocket long connection — no public IP required.
1. Install the optional dependency
pip install nanobot-ai[wecom]
2. Create a WeCom AI Bot
Go to the WeCom admin console → Intelligent Robot → Create Robot → select API mode with long connection. Copy the Bot ID and Secret.
3. Configure
{
"channels": {
"wecom": {
"enabled": true,
"botId": "your_bot_id",
"secret": "your_bot_secret",
"allowFrom": ["your_id"]
}
}
}
4. Run
nanobot gateway
Direct-message text in/out, tenant-aware OAuth, conversation reference persistence. Uses a public HTTPS webhook — no WebSocket; you need a tunnel or reverse proxy.
1. Install the optional dependency
pip install nanobot-ai[msteams]
2. Create a Teams / Azure bot app registration
Create or reuse a Microsoft Teams / Azure bot app registration. Set the bot messaging endpoint to a public HTTPS URL ending in /api/messages.
3. Configure
{
"channels": {
"msteams": {
"enabled": true,
"appId": "YOUR_APP_ID",
"appPassword": "YOUR_APP_SECRET",
"tenantId": "YOUR_TENANT_ID",
"host": "0.0.0.0",
"port": 3978,
"path": "/api/messages",
"allowFrom": ["*"],
"replyInThread": true,
"mentionOnlyResponse": "Hi — what can I help with?",
"validateInboundAuth": true,
"refTtlDays": 30,
"pruneWebChatRefs": true,
"pruneNonPersonalRefs": true,
"refTouchIntervalS": 300
}
}
}
replyInThread: truereplies to the triggering Teams activity when a storedactivity_idis available.mentionOnlyResponsecontrols what Nanobot receives when a user sends only a bot mention (<at>Nanobot</at>). Set to""to ignore mention-only messages.validateInboundAuth: trueenables inbound Bot Framework bearer-token validation (signature, issuer, audience, lifetime,serviceUrl). This is the safe default for public deployments. Only set it tofalsefor local development or tightly controlled testing.refTtlDays(default30) controls how old stored conversation refs can be before they are pruned.pruneWebChatRefs(defaulttrue) drops refs withwebchat.botframework.comservice URLs.pruneNonPersonalRefs(defaulttrue) drops refs whoseconversation_typeis notpersonal.refTouchIntervalS(default300) throttles how often successful sends refreshupdated_atfor active refs.
4. Run
nanobot gateway
Uses signal-cli daemon in HTTP mode — receive messages via SSE, send via JSON-RPC.
1. Install signal-cli
Install signal-cli and register a phone number:
signal-cli -u +1234567890 register
signal-cli -u +1234567890 verify <CODE>
Start the daemon:
signal-cli -a +1234567890 daemon --http localhost:8080
2. Configure
{
"channels": {
"signal": {
"enabled": true,
"phoneNumber": "+1234567890",
"daemonHost": "localhost",
"daemonPort": 8080,
"dm": {
"enabled": true,
"policy": "open"
},
"group": {
"enabled": true,
"policy": "open",
"requireMention": true
}
}
}
}
phoneNumber: Your registered Signal phone number.daemonHost/daemonPort: Where signal-cli daemon is listening (defaultlocalhost:8080).dm.policy:"open"(anyone can DM) or"allowlist"(only listed numbers/UUIDs). When"allowlist", unlisted DM senders receive a pairing code.dm.allowFrom: List of allowed phone numbers or UUIDs (used when policy is"allowlist").group.policy:"open"(all groups) or"allowlist"(only listed group IDs).group.requireMention: Whentrue(default), the bot only responds in groups when @mentioned.group.allowFrom: List of allowed group IDs (used when group policy is"allowlist").attachmentsDir: Override the directory where signal-cli stores inbound attachments. Defaults to~/.local/share/signal-cli/attachments(the Linux default). Set this if signal-cli runs with a customXDG_DATA_HOMEor on macOS/Windows.groupMessageBufferSize: Number of recent group messages kept for context (default20, must be > 0).
3. Run
nanobot gateway
</details>[!TIP] The channel automatically reconnects to the signal-cli daemon with exponential backoff if the connection drops. Markdown in bot replies is automatically converted to Signal text styles (bold, italic, code, etc.).