Plugin

Chat Plugin

How the Chat plugin connects agents to messaging channels

Chat Plugin

The Chat plugin connects your Agent to messaging channels like Telegram, Feishu, and QQ. It handles incoming messages, routes them to the Agent session, and sends replies back to the channel.

What it does

  • Listens to incoming messages from configured channels
  • Creates or reuses sessions per conversation
  • Routes user messages to the Agent
  • Sends Agent replies back to the channel

Configuration

Channels are configured under plugins.chat.channels in downcity.json:

{
  "plugins": {
    "chat": {
      "channels": {
        "telegram": {
          "enabled": true,
          "channelAccountId": "telegram-main"
        },
        "feishu": {
          "enabled": true,
          "channelAccountId": "feishu-work"
        }
      }
    }
  }
}

Channel accounts

The actual bot credentials live in ~/.downcity/downcity.db (managed by City). The project only references them by channelAccountId.

Supported channels

  • Telegram
  • Feishu (Lark)
  • QQ

Feishu dependency

@downcity/plugins does not install the Feishu/Lark SDK by default. If you enable the Feishu channel in an embedded SDK host, install it in that host app:

npm install @larksuiteoapi/node-sdk@^1.66.0

Existing SDK imports can stay the same:

import { ChatPlugin, FeishuChannel } from "@downcity/plugins";

Apps that do not enable Feishu do not need the Feishu SDK.

Continue with: