Chat Agent and IM channels
Web Chat and six channels — Feishu, WeCom, WeChat, DingTalk, Telegram, and Slack: how to use them, how to configure them, and how the two tracks differ.
1. What Chat Agent is
Chat Agent is a conversational assistant. It does not take part in the VOD → Issue → Coding → QA → SRE pipeline.
It has two entry points:
| Entry point | Where to use it | Suitable for |
|---|---|---|
| Web Chat | Console → User settings → Chat Agent | Ask questions in the browser and view conversation history |
| IM channel | Feishu, WeCom, WeChat, DingTalk, Telegram, Slack | Converse, receive notifications, and issue instructions in team chat tools |
Chat Agent can:
- Answer questions and explain documentation and code directly
- Run conversational tasks with the selected Skill
- Receive context such as images and videos
- Save conversations and continue them later
Chat-related Skills are mainly chat (IM conversation), chat-cli (CLI version), and im-notify (event notification); their Skill type is Chat.
It does not:
- Create Issues automatically or run the five-node pipeline
- Merge PRs on a person's behalf
- Run repository deployments on behalf of SRE
When you need to deliver a requirement, still use Issues and the pipeline; Chat Agent is for conversation, consultation, and lightweight operations.
2. Two conversation scopes
Separate the two tracks before configuring IM:
| Track | For | Conversation |
|---|---|---|
| user track | Personal Chat Agent | chat_agent_session |
| repo track | Repository DevOps Agent | devops_agent_session |
Do not bind the same application to both the user and repo tracks. When you need both entry points, create two applications or bots.
3. Currently supported channels
| Channel | Connection | Required credentials | Card support | Suitable for |
|---|---|---|---|---|
| Feishu | WebSocket long connection | app_id + app_secret; you can create the app by scanning a QR code |
Interactive cards | Teams in China that already use Feishu |
| WeCom | Intelligent bot long connection | Bot ID + Secret |
Cards | WeCom office environments |
| DingTalk | Stream mode long connection | AppKey + AppSecret |
Interactive cards (template optional); without a template, text cards are used | DingTalk enterprise internal applications |
| Slack | Socket Mode | Bot Token xoxb-… + App Token xapp-… |
True callbacks, in-place updates, threads | Overseas or cross-organization teams |
| Telegram | Bot API long polling | Bot Token (issued by @BotFather) |
InlineKeyboard buttons | Individuals or small teams, external collaboration |
| ilink Bot long polling | Bind by scanning a QR code; the Bot Token and cursor are written automatically | No buttons; cards fall back to "title + number" text | WeChat one-to-one and group chats |
Channel types in the installation table are feishu / wecom / dingtalk / slack / telegram / wechat.
An application can have only one active installation; rebinding replaces the old installation. A user or repository can bind multiple applications or bots, but each application has its own installation, shard, and lease.
4. How to use Web Chat
- Sign in to the console and select the target repository.
- Open User settings → Chat Agent.
- Click New conversation.
- Select a Skill in the input area; select a plugin if needed.
- Enter text, or upload an image or video.
- Send the message and watch the streaming reply.
- Switch between past conversations in the list on the left; delete conversations you no longer need.
The Skill in a conversation determines the method the Agent uses; plugins determine which additional capabilities this conversation enables. Available Skills and plugins are limited to the options currently shown on the page.
If the target engine currently cannot claim tasks (offline, low health score, or circuit-broken), the message does not sit in the queue indefinitely: the page returns a "target engine cannot claim tasks right now" notice with the reason, and such a notice can be retried later. Check engine status and health score on the Agent Runtime page. When a remote engine is offline, the platform first falls back to another online remote engine on the same backend.
5. How to use IM channels
- Select a platform in the console under IM / Chat configuration.
- Follow the steps for that platform, fill in the credentials, and save.
- Confirm that the status is connected.
- Send a message to the bot in a direct chat, or add the bot to a group and @-mention it.
- For a repository DevOps Agent, confirm that the installation uses the repo track; for personal use, select the user track.
6. Configuration steps for each channel
Feishu
- In the console, select Feishu → click Scan to configure.
- Scan the QR code with the mobile Feishu app and confirm creation or authorization of the application.
- The system writes
app_id/app_secretautomatically and connects within 30 seconds. - After the status becomes
connected, verify by messaging the bot directly or @-mentioning it in a group.
Feishu uses a WebSocket long connection and does not need a public callback URL. Credentials written to a file are stripped; enter them in the management UI.
WeCom
- The enterprise administrator signs in to the WeCom admin console → App management → Intelligent bot → create a bot.
- For the message receiving method, select API mode (long connection); no public callback is needed.
- Copy the Bot ID and Secret (the Secret is shown only once).
- Enter them on the right side of the console and save; the connection is established automatically within 30 seconds.
- Add groups or members to the bot's Visible range; otherwise only administrators can see it.
If the Secret is lost, you can only reset it; after a reset, enter the new Secret in the console again.
DingTalk
- Sign in to the DingTalk Open Platform → App development → create an Enterprise internal application.
- In Credentials and basic information, copy the AppKey (Client ID) and AppSecret (Client Secret).
- Under App capabilities → add a Bot → select Stream mode as the message receiving mode (long connection, no public network required).
- Enter the values in the console and save; after publishing an application version and setting the visible range, you can @-mention the bot in a group to start a conversation.
- Interactive cards are optional: without a template, messages are still sent and received (as text cards); for button interaction, configure a card template in the management UI.
Slack
- In the console, click Copy app manifest → open
api.slack.com/apps→ Create New App → From an app manifest → paste the manifest to create the app. - Basic Information → App-Level Tokens → generate
xapp-…, and select theconnections:writescope. - OAuth & Permissions → Install to Workspace → copy
xoxb-…. - Enter the Bot Token and App Token in the two fields and save. Socket Mode is enabled by the manifest and does not need a public network.
- Invite the bot to the channel (
/invite @grapein the channel); otherwise messages from that channel are not received.
Slack has the most complete callback, in-place update, and threading capabilities of the six channels; it suits scenarios that need card buttons and threaded replies.
Telegram
- Find @BotFather in Telegram →
/newbot→ choose a name. - Copy the Token (in the form
123456:ABC-DEF…), enter it in the console, and save. - Message the bot directly; in a group, add it first, then @-mention the bot or send a
/command. - To let the bot see all messages in a group: send
/setprivacyto @BotFather and disable privacy mode.
The local machine or intranet must be able to reach api.telegram.org; networks in China usually need an HTTPS proxy, otherwise the status stays at Configured · Not connected.
- In the console, click Bind WeChat by scanning → use Scan in mobile WeChat.
- Confirm on the phone; if a PIN is shown, enter the number from the phone in the dialog.
- After binding, the connection is established automatically within 30 seconds and the status becomes Connected.
- To stop using it, click Unbind; you can also log out on the WeChat side at any time.
The WeChat ilink channel has no cards or buttons: cards fall back to "title + number" text, and users reply with a number; both one-to-one and group chats are supported.
7. Multiple controllers: shards and leases
When multiple IM instances are online at the same time, two instances must not connect to the same bot, or they will evict each other. Grape uses two layers of mechanisms:
- Instance registration: each IM-enabled instance writes
grape_im_instancewith a 10-second heartbeat; no heartbeat for more than 45 seconds is treated as disconnected. - Consistent hashing shards: the owner is calculated from
app_id, and only the owner instance tries to connect; when instances go online or offline, only adjacent ring segments migrate, without a full re-shuffle. - Lease: the owner connects only after acquiring a lease; the default TTL is 180 seconds, with renewal every 30 seconds and a scan every 10 seconds; after 3 consecutive renewal failures, a 90-second grace period starts, and the connection is closed only when the grace period ends.
- Takeover protection: the old owner is not preempted while its heartbeat is still alive and its lease has just expired; takeover is allowed only after the takeover window passes or the owner is disconnected.
- Graceful handover: during shard migration, the old owner keeps the lease until it expires naturally instead of disconnecting immediately, which reduces churn.
Environment variables you can use to adjust the behavior:
| Variable | Default | Effect |
|---|---|---|
BOT_LEASE_TTL |
180 | Lease lifetime in seconds |
BOT_LEASE_RENEW_INTERVAL |
30 | Renewal interval |
BOT_LEASE_SWEEP_INTERVAL |
10 | Scan interval |
BOT_LEASE_GRACE |
90 | Grace period after a renewal failure |
BOT_LEASE_RENEW_FAIL_THRESHOLD |
3 | Number of consecutive failures before the grace period starts |
IM_INSTANCE_TIMEOUT |
45 | Instance heartbeat timeout |
IM_LEASE_STICKY |
true | Consistent-hash stickiness; 0 falls back to first-come-first-served |
The current IM engine is started by IM-enabled instances (the main entry is mgmt). When scaling out, other instances must also enable IM and register in
grape_im_instance; otherwise sharding does not include them in the owner ring.
8. How to tell it works
| Check | What you should see |
|---|---|
| Channel status | The console shows connected, not Configured · Not connected |
| Direct chat | Send a message to the bot and receive a reply |
| Group chat | Add the bot to a group, @-mention it, and receive a reply |
| Notification channel | Call the test notification API; the target IM receives the message and returns ok: true |
| Multiple instances | Only one instance holds the lease for the same app_id; other instances show as non-owner and do not connect repeatedly |
| Logs | The instance holding the lease logs connected after acquiring lease; there are no duplicate connections or frequent disconnects |
9. Common failures
| Symptom | Likely cause | Action |
|---|---|---|
| Stuck at "Configured · Not connected" | Wrong credentials, unreachable network, or missing proxy | Check the platform-side credentials; for Telegram, check connectivity to api.telegram.org and the HTTPS proxy |
| Two instances repeatedly contend for the same bot | Sharding or leases are disabled, or the instance heartbeat is abnormal | Confirm IM_LEASE_STICKY=1; check heartbeats and lease owners in grape_im_instance |
| No response to an @-mention in a group | The bot is not in the group, the visible range is not configured, or privacy mode is on | On Slack, run /invite first; on WeCom or DingTalk, configure the visible range; on Telegram, disable privacy |
| Cards have no buttons | The channel does not support them or no template is configured | WeChat supports text numbers only; DingTalk needs a template for buttons; for other channels, see the card capabilities |
| Status does not update after scanning | The QR code expired or the phone did not confirm | Scan again; enter the WeChat PIN; confirm creation or authorization in Feishu |
| Old configuration remains after rebinding | The old installation was not replaced, or caching | Save again in the console; confirm that the installation table has only one active row |
| Web Chat cannot find the Skill | The Skill type is not Chat, or the Skill is not bound | On the Skills page, confirm that agent_type is Chat, then select it again in the conversation |
10. Security conventions
- Do not put real
app_secret, Bot Tokens, or group IDs in documentation or screenshots. - Write credentials only through the management UI or encrypted storage; credentials written to configuration files are stripped.
- Unbinding or rebinding invalidates the old configuration; before rebinding in production, confirm that the new credentials work.
- Chat uses the current user's identity, not the repository Bot identity; do not write personal tokens into shared Skills.
Related
Workbench and Issue Center | Agent overview | Skill management | Chat API | Account activation and login