feat(gateway): add native Weixin/WeChat support via iLink Bot API#7166
Conversation
Add first-class Weixin platform adapter for personal WeChat accounts: - Long-poll inbound delivery via iLink getupdates - AES-128-ECB encrypted CDN media upload/download - QR-code login flow for gateway setup wizard - context_token persistence for reply continuity - DM/group access policies with allowlists - Native text, image, video, file, voice handling - Markdown formatting with header rewriting and table-to-list conversion - Block-aware message chunking (preserves fenced code blocks) - Typing indicators via getconfig/sendtyping - SSRF protection on remote media downloads - Message deduplication with TTL Integration across all gateway touchpoints: - Platform enum, config, env overrides, connected platforms check - Adapter creation in gateway runner - Authorization maps (allowed users, allow all) - Cron delivery routing - send_message tool with native media support - Toolset definition (hermes-weixin) - Channel directory (session-based) - Platform hint in prompt builder - CLI status display - hermes tools default toolset mapping Co-authored-by: Zihan Huang <bravohenry@users.noreply.github.com>
- Remove sys.path.insert hack (leftover from standalone dev) - Add token lock (acquire_scoped_lock/release_scoped_lock) in connect()/disconnect() to prevent duplicate pollers across profiles - Fix get_connected_platforms: WEIXIN check must precede generic token/api_key check (requires both token AND account_id) - Add WEIXIN_HOME_CHANNEL_NAME to _EXTRA_ENV_KEYS - Add gateway setup wizard with QR login flow - Add platform status check for partially configured state - Add weixin.md docs page with full adapter documentation - Update environment-variables.md reference with all 11 env vars - Update sidebars.ts to include weixin docs page - Wire all gateway integration points onto current main Salvaged from PR #6747 by Zihan Huang.
|
…oints Systematic audit found Weixin missing from: Code: - gateway/run.py: early WEIXIN_ALLOW_ALL_USERS env check - gateway/platforms/webhook.py: cross-platform delivery routing - hermes_cli/dump.py: platform detection for config export - hermes_cli/setup.py: hermes setup wizard platform list + _setup_weixin - hermes_cli/skills_config.py: platform labels for skills config UI Docs (11 pages): - developer-guide/architecture.md: platform adapter listing - developer-guide/cron-internals.md: delivery target table - developer-guide/gateway-internals.md: file tree - guides/cron-troubleshooting.md: supported platforms list - integrations/index.md: platform links - reference/toolsets-reference.md: toolset table - user-guide/configuration.md: platform keys for tool_progress - user-guide/features/cron.md: delivery target table - user-guide/messaging/index.md: intro text, feature table, mermaid diagram, toolset table, setup links - user-guide/messaging/webhooks.md: deliver field + routing table - user-guide/sessions.md: platform identifiers table
|
|
Nice to see WeChat land! I had an earlier adapter PR open at #2502 (March 22, iLink 2.1.7 protocol) that went through a few review rounds — happy to see the feature ship either way. I can help test this on a Raspberry Pi 4B (aarch64, Raspberry Pi OS) with a real WeChat account if that's useful. Already have a gateway running on it with Telegram + frp tunneling, so spinning up a Weixin adapter alongside would be straightforward. Anything specific you'd want validated beyond the basic send/receive flow? |
|
I would like to report a significant change in the output format on WeChat following the recent upgrade. The formatting has shifted from a cohesive, structured table to fragmented, individual message bubbles, which significantly impacts readability. |
I'm going to fix it :) |
|
it does not support wechat group yet?it's confusing in settings |

Summary
Adds a first-class Weixin (personal WeChat) platform adapter via Tencent's iLink Bot API. Salvaged from PR #6747 by @bravohenry (Zihan Huang) — contributor commits preserved with original authorship.
What's included
New adapter (
gateway/platforms/weixin.py— 1669 lines)getupdatescontext_tokenpersistence for reply continuitygetconfig/sendtypingFull gateway integration (15 files)
Platform.WEIXINenum +_apply_env_overrides()send_messagetool with native mediahermes-weixintoolset +hermes-gatewayincludeshermes toolsmapping, gateway setup wizardSalvage fixes (not in original PR)
sys.path.inserthack — leftover from standalone developmentacquire_scoped_lock/release_scoped_lock) — prevents duplicate pollers across profilesget_connected_platforms— WEIXIN requires both token AND account_id; the check must precede the generic token/api_key checkWEIXIN_HOME_CHANNEL_NAMEto_EXTRA_ENV_KEYSAPI limitations (confirmed via research)
The iLink Bot API supports only 5 item types: text, image, voice, file, video. No buttons, inline keyboards, card messages, or quick replies. Interactive features (approve/deny, /model selection) work via standard text-based slash commands.
Tests
Credits
Original PR #6747 by @bravohenry (Zihan Huang) — 3 commits cherry-picked with authorship preserved.