dsh-channel-gateway: Integrating Telegram and WeChat into a Unified DSH Message Contract

Preface

Integrating Telegram or WeChat with DeepSeek Harness (DSH) typically involves writing separate webhook, authentication, and message parsing implementations for each platform, with business plugins subscribing to different events independently. As channels grow, deduplication, reply routing, and the boundaries of “who can speak” tend to become scattered across adapters. dsh-channel-gateway consolidates the transport layer into one: adapters normalize traffic from each platform into a single inbound contract, the gateway performs authorization at the transport boundary and raises channel/inbound uniformly, and consumers reply using the route carried in the inbound message via ctx.channels.send. The sections below explain what it is, how to install it, how to use it, and things to watch out for when enabling it, based on the provided materials.

What Is This

dsh-channel-gateway is a DSH plugin package published by community maintainer wowyuarm, with the npm name @wowyuarm/dsh-channel-gateway (the version referenced in the current materials is 0.1.3). It is categorized under admin-security in the SkillHub directory. The standalone GitHub repository has been archived; subsequent development takes place in the monorepo wowyuarm/dsh-plugins under packages/channel-gateway, and the published npm package path remains unchanged.

The plugin only handles the “transport half-layer” of chat integration: a fixed message contract and the seam between providers and consumers. Message semantics, whether a message has already been handled, and the next-hop routing are decided by the upper layers.

Message Contract and Gateway API

The public API is intentionally small and stable, with five categories of surfaces (field details can be found in the repository’s docs/architecture.md):

Surface Form
Inbound InboundMessage: channel, providerMessageId, actor, place, visibility, text, optional attachments, timestamp, optional replyTo/raw
Outbound OutboundMessage: channel, route, text, optional attachments/replyTo/format
Transport Channel: name, capabilities, start(inbox), stop(), send(message), optional resolveAttachment
Gateway ctx.channels.register(channel), ctx.channels.send(message), ctx.channels.resolveAttachment, event channel/inbound
Authorization ChannelAuth { authorize(request) }, default allowlist

Three parts of the contract are needed by consumers but are often incomplete in providers’ native payloads: actor / place / visibility (who, where, and to whom it is visible), providerMessageId (for deduplication and acceptance persistence), and place.route (an opaque destination minted by the channel; when replying, pass it as-is to OutboundMessage.route, so upper layers do not need to assemble provider addresses).

Core Features

Gateway and Authorization

Installing the bundle inserts a gateway service row. After inbound messages pass gateway authorization, they are delivered to subscribers as a single event type channel/inbound; outbound traffic uniformly goes through ctx.channels.send.

Who can speak is determined by the gateway row configuration, not by each adapter’s token configuration:

- id: channel-gateway
  config:
    allow:
      - telegram:123456789   # a single actor on a channel
      - weixin:*             # all actors on a channel
      # - '*'                # everyone

If allow is empty, no one is admitted.

Channel Adapters (Optional Rows)

Each platform is enabled as an independent DSH row and requires its own credentials:

Adapter Transport Entry package Notes
Telegram Bot API long polling getUpdates @wowyuarm/dsh-channel-gateway/telegram Text and media; attachments may be local data or provider ref/url; resolveAttachment can download inbound attachment bytes; format: 'markdown' renders Telegram HTML; if config.token is omitted, the environment variable DSH_TELEGRAM_TOKEN is read
WeChat iLink long polling ilink/bot/getupdates @wowyuarm/dsh-channel-gateway/weixin Text and media; replies must reference the inbound context_token (WeChat expires it after about two minutes; the adapter refreshes it before expiry); format: 'markdown' renders sanitized WeChat Markdown; media up/down is implemented per the reference iLink protocol, and the materials note it has not been fully verified with a real account; QR login is not implemented; an existing token is required

Both adapters support HTTPS_PROXY / NO_PROXY (Node’s built-in fetch does not read proxies by default unless NODE_USE_ENV_PROXY is set).

Installation and Activation

Official installation command (from the README):

dsh plugin add @wowyuarm/dsh-channel-gateway --profile <profile>

Insert adapter rows into the profile as needed, for example:

- insert:
    - id: channel-telegram
      name: '@wowyuarm/dsh-channel-gateway/telegram'
      config: { token: '<bot token>' }
    - id: channel-weixin
      name: '@wowyuarm/dsh-channel-gateway/weixin'
      config: { token: '<iLink bot token>' }

The runtime environment requires Node >=22. Its coupling with DSH is limited to the peer dependencies @deepseek-ai/cordis (^4.0.1) and @deepseek-ai/schemastery (^3.18.1); the materials indicate it has passed typecheck, tests, and builds on DSH 0.1.5-rc.3 (latest) and 0.1.7-rc.x (next).

Typical Usage: Subscribing to Inbound and Replying

A consumer plugin declares inject: ['channels'], listens for channel/inbound, deduplicates on (channel, providerMessageId), persists acceptance, and replies using the inbound place.route:

import type { Context } from '@deepseek-ai/cordis'
import type {} from '@wowyuarm/dsh-channel-gateway'

export const name = 'my-ingress'
export const inject = ['channels']

export function apply(ctx: Context) {
  ctx.on('channel/inbound', (message) => {
    // Deduplicate on (message.channel, message.providerMessageId), accept it
    // durably, route it.
    void handle(message)
  })
}

async function handle(message: InboundMessage) {
  // ... later, answer it:
  await ctx.channels.send({ channel: message.channel, route: message.place.route, text: 'ok' })
}

Use Cases and Notes

It suits multi-channel bots or ingress plugins that need to integrate Telegram Bots and WeChat iLink uniformly within DSH and want authorization and inbound events funneled in one place. If you are building for a single platform and do not need a shared contract, you can use that platform’s SDK directly; if you need the gateway allowlist and the route abstraction, this package is a better fit.

Before enabling it, please read the source code and the MIT license yourself; the plugin runs with the same privileges as the DSH process, and the token and allow configuration effectively write who can trigger your agent into your profile. The materials explicitly note that the WeChat adapter’s media paths and live-account validation still have limitations; the standalone repository is now read-only, and issues and PRs should be directed to the monorepo.

The DSH ecosystem is “everything is a plugin”; community directories such as SkillHub are not officially affiliated with DeepSeek / High-Flyer. This article is based solely on the public README and package metadata.

Links

  • Directory page: https://www.skillhub.cn/plugins/wowyuarm/dsh-channel-gateway
  • GitHub (archived): https://github.com/wowyuarm/dsh-channel-gateway
  • Ongoing development: https://github.com/wowyuarm/dsh-plugins (packages/channel-gateway)
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye