In DSH Web GUI use cases, developers often need to handle messages from multiple platforms such as WeCom, Telegram, and Discord simultaneously. Configuring them manually one by one is cumbersome and error-prone. The dsh-message-gateway plugin provides a unified connector management solution, integrates messaging platforms into the sidebar, and supports streaming replies and active pushes.
Core Features¶
The plugin provides a “Message Platforms” entry below the “New Session” button in the DSH Web sidebar, allowing full-screen management of multi-platform connectors.
- Multi-platform connectors: Supports Telegram, Discord, QQ, Email, DingTalk, Feishu, Bark, ServerChan, Webhooks, WeCom, and WeCom intelligent bots.
- Persistent WeCom intelligent bot bridging: After credentials are saved, it automatically establishes an official SDK long-lived connection, supporting streaming replies and context compression.
- General active push channel: Through the
POST /gateway/pushendpoint, supports Base64 images and Markdown format, usable by scheduled tasks or automation scripts. - Credential management: Credentials are stored in plaintext at
~/.dsh/gateway.(permissions 600). - Sensitive information masking: Message content written to logs or the console automatically masks suspected keys (such as
sk-, GitHub tokens, etc.). - Connection testing: Provides connection testing for each platform.
- Webhook receiving endpoint: Supports
POST /gateway/webhook/into receive messages from external systems. - WeChat personal account gateway: Supports integration with the Wechaty gateway.
- Multilingual support: Supports Chinese, English, and Español.
Installation and Activation¶
Use the official installation command to add the plugin to the DSH Web environment:
dsh plugin --profile web add dsh-message-gateway
After restarting dsh web, a “Message Platforms” entry will appear below the “New Session” button in the sidebar.
Typical Usage¶
- Open DSH Web (
dsh web) and click the “Message Platforms” button in the sidebar. - On the management page, select the target platform on the left and enter the corresponding authentication credentials (such as Token, AppID, Secret, etc.) on the right, then click “Save” to connect.
- For WeCom intelligent bots, after saving the
botIdandsecret, the plugin immediately establishes a persistent connection, allowing you to chat with the bot in WeCom without additional configuration. - Send a message using the general active push channel:
curl -X POST http://localhost:3000/gateway/push \
-H "Content-Type: application/json" \
-d '{
"platform": "telegram",
"target": "123456789",
"content": "这是通过网关主动推送的消息"
}'
Configuration Options¶
The plugin provides the following configuration options, which can be adjusted via dsh plugin config or the profile configuration file:
botLocale: Language of the bot’s reply text, defaultzh.maxChatAgents: Maximum number of chat sessions retained per bot, default40.autoStartWecom: Whether to automatically connect using saved WeCom intelligent bot credentials at startup, defaulttrue.groupReply: Whether to reply to group chat messages, defaulttrue.
Notes¶
- The plugin runs with the permissions of the current DSH process. Credentials are stored in plaintext at
~/.dsh/gateway.. Please pay attention to file permissions and system security. - Before use, review the source code and license (MIT) to ensure compliance with your usage requirements.
Summary¶
dsh-message-gateway reduces the complexity of managing multi-platform messages through a unified entry point and streaming reply capabilities, making it suitable for developers who need to build cross-platform message routing and automated notification scenarios.