Skip to content

feat: WeChat platform adapter via WeixinClawBot (closes #2422) - #2425

Closed
Mibayy wants to merge 1 commit into
NousResearch:mainfrom
Mibayy:feat/wechat-platform
Closed

feat: WeChat platform adapter via WeixinClawBot (closes #2422)#2425
Mibayy wants to merge 1 commit into
NousResearch:mainfrom
Mibayy:feat/wechat-platform

Conversation

@Mibayy

@Mibayy Mibayy commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds full WeChat support using the WeixinClawBot OpenClaw API — the official bot integration channel announced by WeChat in March 2026.

Closes #2422

What's included

Following the checklist in ADDING_A_PLATFORM.md, all 15 integration points are covered:

# File Change
1 gateway/platforms/wechat.py New adapter — long-polling, dedup, send/image/chat_info, OpenID redaction
2 gateway/config.py Platform.WECHAT enum + WECHAT_BOT_TOKEN env override + home channel
3 gateway/run.py Adapter factory (_create_adapter)
4 gateway/run.py Authorization maps (WECHAT_ALLOWED_USERS, WECHAT_ALLOW_ALL_USERS)
5 gateway/run.py Toolset routing (both default_toolset_map instances)
6 gateway/channel_directory.py Session-based chat discovery
7 agent/prompt_builder.py PLATFORM_HINTS["wechat"] — plain text, 2048 char limit
8 toolsets.py hermes-wechat toolset + added to hermes-gateway composite
9 cron/scheduler.py deliver="wechat" support
10 tools/send_message_tool.py _send_wechat() + platform routing
11 hermes_cli/status.py WeChat in hermes status display
12 hermes_cli/gateway.py WeChat in setup wizard
13 tests/gateway/test_wechat.py 18 tests — enum, config, adapter init, dedup, dispatch, send, auth maps, toolset

Configuration

# Minimal setup
WECHAT_BOT_TOKEN=your-weixinclawbot-token

# Optional
WECHAT_HOME_CHANNEL=openid_of_default_contact
WECHAT_HOME_CHANNEL_NAME=MyContact
WECHAT_ALLOWED_USERS=openid1,openid2   # restrict access
WECHAT_ALLOW_ALL_USERS=true            # open to all

Or via config.yaml:

platforms:
  wechat:
    enabled: true
    token: your-token
    home_channel:
      chat_id: openid_abc123
      name: MyContact

How it works

WeixinClawBot acts as a bridge — you connect your WeChat account via QR code scan on their dashboard, and they expose a REST API + long-polling endpoint that the adapter uses to receive and send messages.

The adapter polls GET /v1/messages every 500ms, dispatches text messages through the standard handle_message flow, and sends replies via POST /v1/messages/send. Non-text messages (images, voice, etc.) are silently skipped for now.

Tests

18 passed in 4.15s

Implements full WeChat integration using the WeixinClawBot OpenClaw API,
which provides official bot support for WeChat (announced March 2026).

Changes:
- gateway/platforms/wechat.py — WeChatAdapter with long-polling, dedup,
  send/send_image/get_chat_info, _redact_openid for safe logging
- gateway/config.py — Platform.WECHAT enum + WECHAT_BOT_TOKEN env override
- gateway/run.py — adapter factory, authorization maps, toolset routing
- gateway/channel_directory.py — session-based chat discovery
- agent/prompt_builder.py — PLATFORM_HINTS["wechat"] (plain text, 2048 char limit)
- toolsets.py — hermes-wechat toolset + hermes-gateway composite
- cron/scheduler.py — deliver="wechat" support
- tools/send_message_tool.py — _send_wechat() + platform routing
- hermes_cli/status.py — WeChat in status display
- hermes_cli/gateway.py — WeChat in setup wizard
- tests/gateway/test_wechat.py — 18 tests covering enum, config, adapter,
  dedup, message dispatch, send, auth maps, toolset

Closes NousResearch#2422
@teknium1

Copy link
Copy Markdown
Contributor

Closing — the gateway scaffolding (config, toolsets, cron routing, dedup, tests) is well done and follows our platform patterns, but the backend depends on OpenClaw's WeixinClawBot service which isn't viable as a dependency for a competitor's product.

When we build WeChat support, we'll target the Official Account API or Enterprise WeChat (WeCom) API directly. The scaffolding from this PR will be a useful reference for that. Thanks for the thorough implementation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: WeChat messaging platform support

2 participants