Skip to content

WeChat Official Account Configuration

yaml
wechat.my_mp:
  app_id: wx1234567890abcdef
  app_secret: your_app_secret
  receive_mode: webhook
  token: your_webhook_token
  encoding_aes_key: your_43_character_key
  webhook_path: /wechat/my_mp/webhook
  passive_reply_timeout_ms: 4500
  deduplicate_webhooks: true
  webhook_deduplication_limit: 10000
  api_base_url: https://api.weixin.qq.com
FieldRequiredDefaultDescription
app_idYes-Official Account AppID and encrypted-message recipient identity
app_secretYes-Sensitive credential used to obtain the global access token
receive_modeNowebhookwebhook registers the shared Host route; manual only accepts ingest()
tokenWebhook mode-SHA-1 webhook signature token
encoding_aes_keySafe/compatible mode-43-character message encryption key
webhook_pathNo/wechat/{account_id}/webhookCallback path on the shared HTTP Host
passive_reply_timeout_msNo4500Passive-reply wait, at most 4500 ms; 0 acknowledges immediately
deduplicate_webhooksNotrueFilters WeChat retry deliveries
webhook_deduplication_limitNo10000In-process recent event-ID capacity
api_base_urlNohttps://api.weixin.qq.comHTTPS-compatible official API proxy or test endpoint

All field names use snake_case. Historical camelCase aliases and account-type feature switches are intentionally unsupported; actual endpoint availability is determined by the Official Account's type, verification, and granted permissions.

The initial access-token request and subsequent protocol outlets share OneBots' global timeout during account startup. A startup timeout, explicit stop, or configuration reload aborts the pending request. Even if a custom request implementation ignores cancellation, a late token is neither cached nor allowed to bring the old account online. The startup signal remains attached after the account becomes ready, so a protocol startup failure rolls back the account and clears its credential state.