Configure · IM bots

Talk to agents in your chat app.

Attach Slack, 飞书, Telegram or 微信 bots to any agent. Every connection is outbound — Socket Mode, long connection, long polling — so you need no public URL, webhook or open port. Each thread becomes a DayMug conversation you can also open in the browser.

Where bots are configured

  1. Open the agent Settings → Agents → pick an agent (or New Agent) → edit.
  2. Add a bot under the attached-bots section, choose the platform, and fill in the credentials from the platform guides below.
  3. Click “Test connection” — a read-only check of the token, required scopes/permissions and platform switches. It sends nothing to any channel.
  4. Write channel rules — without a matching rule the bot stays silent (see Channel rules).
  5. Save — bots hot-reload; only bots whose credentials changed reconnect. The page shows each bot's live status, and failed connections retry automatically (5 s → 5 min back-off).

Per-bot options:

ModelModel for new threads. Empty = the agent's default.
Maximum conversation durationDefault 12h, counted from a thread's first message. After it, the next message in the same thread starts a fresh conversation and session. 0 = reuse forever.
Unconfigured replySent when someone @-mentions or DMs the bot where no rule covers them. No agent runs.
Unauthorized replySent when someone outside allowed_user_ids @-mentions or DMs the bot.

Slack

  1. Create an app at api.slack.com/apps and turn on Socket Mode. Generate an App-Level Token (xapp-…) with connections:write.
  2. Bot Token Scopes: app_mentions:read, chat:write, channels:history, groups:history, im:history, users:read. Add files:read to receive files and files:write to send the agent's files back.
  3. Event Subscriptions → bot events: app_mention, message.channels, message.groups, message.im.
  4. Install the app to get the Bot Token (xoxb-…) and invite the bot to your channels.
  5. In DayMug paste both tokens: Bot token = xoxb-…, App-level token = xapp-….

飞书 / Feishu

  1. In the Feishu Open Platform create a custom app (企业自建应用) and enable the bot capability.
  2. Permissions: im:message, im:message:send_as_bot, im:resource. Add im:message.group_msg to read every group message (needed for auto_reply). Optional: contact:user.base:readonly so group members show by name instead of open_id.
  3. Events: subscribe to im.message.receive_v1 using long connection (长连接) mode.
  4. Publish a version, get it approved, and add the bot to your groups.
  5. In DayMug paste the App ID and App secret.

Telegram

  1. Message @BotFather, run /newbot, and copy the token (123456789:AA…).
  2. Run /setprivacy → your bot → Disable if you want auto_reply in groups. With privacy on, the bot only sees commands, @-mentions and replies to itself — enough for mention-only use.
  3. If the bot ever had a webhook, delete it (deleteWebhook). A leftover webhook blocks long polling; "Test connection" reports it.
  4. Add the bot to your group. Enable Topics in the group if you want one conversation per topic.

Conversations are per chat (a DM, a group, or a forum topic). Telegram offers no history API, so a new conversation starts at the triggering message, and messages sent while DayMug was restarting are not answered afterwards.

微信 / WeChat

WeChat uses Tencent's iLink Bot protocol: you pair a personal WeChat account by scanning a QR code — no official account, WeCom or reverse-engineered client involved.

  1. Add a bot, choose WeChat, and click pair. Scan the QR code with WeChat on your phone and confirm.
  2. New WeChat bots start with a rule that lets anyone DM the bot: [{ "channel": "dm", "allowed_user_ids": ["*"] }]. Replace "*" with your own user id to keep it private.
  3. WeChat has no threads. Send /new to start a fresh conversation, or /new your question to start one and ask in the same message. Other /commands pass through to the agent.
Heads-up

WeChat can't edit sent messages, so you'll see a typing indicator and queue notices rather than a live-updating reply. If the session expires (errcode -14) you need to scan again. Group chats are not verified to work — treat WeChat as 1:1.

Channel rules

Each bot has a JSON array of rules deciding where it answers and who may trigger it. No matching rule means no reply — in groups and DMs alike. Matching order: exact channel id first, then "dm" / "*"; an exact rule with "enabled": false overrides "*".

channel rules · example
[
  {
    "channel": "C0123456789",
    "require_mention": true,
    "allowed_user_ids": ["U0123456789", "U0987654321"],
    "extra_prompt": "This is the on-call channel. Keep answers short."
  },
  { "channel": "*",  "auto_reply": true },
  { "channel": "dm", "enabled": false }
]
FieldDefaultMeaning
channelrequiredExact id — Slack C…/G…, Feishu oc_…, Telegram chat id (supergroups are negative, -100…). "*" = every group, "dm" = every direct message.
enabledtrueSwitch a rule off without deleting it.
require_mentiontrueIn groups, only messages that @-mention the bot trigger it — including replies inside an existing thread. DMs are unaffected.
auto_replyfalseAnswer every message in the channel; overrides require_mention.
allowed_user_idseveryoneOnly these platform user ids may trigger the agent. ["*"] or omitted = no restriction.
extra_prompt—Extra system-prompt text for this channel only.
allow_bot_mentionsfalseLet other bots trigger this one (bot hand-offs, below).
bot_mention_limit3Max bot-triggered runs per thread within the window. 0 blocks them.
bot_mention_window_minutes30Length of that sliding window.

Common rule sets

// Answer @-mentions in every group and in DMs
[{ "channel": "*" }, { "channel": "dm" }]

// Private assistant: only you, only in DMs
[{ "channel": "dm", "allowed_user_ids": ["U0123456789"] }]

// One busy channel answers everything; everywhere else stays quiet
[{ "channel": "C0123456789", "auto_reply": true }]

What users will see

  • Threads = conversations. A top-level message starts a thread; everything stays in it. When a bot is first @-mentioned in an existing Slack or Feishu thread, the earlier messages are pulled in as context.
  • Live progress. Slack and Feishu show a progress message that updates with the agent's thinking and draft, then post the final answer as a fresh message that @-mentions the asker. Telegram edits one message in place.
  • Queues are visible. If the account is busy, the bot says how many tasks are ahead and updates as the queue moves.
  • Files. Images and files up to 25 MiB are passed to the agent. Files the agent publishes are uploaded back to the thread (Slack 1 GiB, Feishu 30 MiB, Telegram 50 MiB, WeChat 25 MiB).
  • Web and chat stay in sync. Open the same conversation in DayMug; messages you send from the web are mirrored into the thread.
  • A new message to the same bot in the same thread cancels its previous run and answers the latest one.

Bot hand-offs

One agent can pass a thread to another — e.g. a coder bot hands its result to a reviewer bot. Turn on allow_bot_mentions in the receiving bot's rule for that channel. The sending agent ends its reply with a single line:

[HANDOFF @Reviewer] Please review the change in PR #42 against the spec in docs/spec.md

DayMug posts a real @-mention as the sending bot and starts the receiving agent in its own conversation. Make the instruction self-contained — the receiver does not see the sender's narrative. bot_mention_limit stops two bots looping forever.

Troubleshooting

SymptomCheck
Bot answers with the unconfigured reply (default: “🙇 不好意思,我还没有在这个会话里开通…”)No rule matches — add the channel id, "*", or "dm".
Bot ignores messages without @Expected with require_mention. Use auto_reply (Telegram: also disable privacy mode; Feishu: add im:message.group_msg).
Telegram connected but silentA leftover webhook — call deleteWebhook. Test connection shows it.
Feishu shows open_id instead of namesGrant contact:user.base:readonly.
Image-only message in a mention-only group is ignoredA bare image can't carry an @. Use auto_reply, or (Slack) add text with the @ in the same message.
Long tasks get cut offim_run_timeout in config.yaml — 0s means no cap.