Skip to main content

Weixin / WeChat Setup

Overview

The Weixin channel connects Anyy to Weixin through the iLink-style polling adapter. It supports direct messages, inbound media, outbound media, typing signals, and QR login helper commands.

Weixin group support is not advertised by the adapter.

Prerequisites

  • Network access from the Anyy host to the Weixin iLink endpoint.
  • A Weixin session token, either supplied directly or created through QR login.
  • A profile secret location for the token.

Setup

Create credentials

The normal path is QR login:

anyy setup channels weixin login

The command prints a QR code, waits for confirmation, stores the bot token as a profile secret, writes channels.weixin, and attempts to reload the running gateway.

If you already have a token:

anyy setup channels weixin \
--secret token='weixin-token' \
--write-config

Configure Anyy

The setup helper writes these defaults:

FieldDefault
account_idweixin, or the bot id from QR login
base_urlhttps://ilinkai.weixin.qq.com
media_cdn_base_urlhttps://novac2c.cdn.weixin.qq.com/c2c
dm_policyopen
poll_interval_ms5000
long_poll_timeout_ms35000
send_chunk_chars2000
media_max_bytes5242880

Start Gateway

anyy gateway start
anyy channels reload

Run doctor checks

anyy channels doctor weixin

Access Policy

Direct messages

Weixin supports open, allowlist, and disabled direct-message policies. Use allow_from with Weixin user ids when you do not want open access.

Groups

Weixin group support is not advertised by the current adapter.

Admins

Weixin message admission is separate from command authorization.

Sessions

Each accepted Weixin chat maps to an Anyy session. The adapter stores sync state and context tokens so polling can continue across turns.

Media Support

Inbound media

Weixin advertises inbound media support. Inbound media is subject to media_max_bytes.

Outbound media

Weixin advertises outbound media support for image, video, audio, voice, and file attachments.

Commands

Use normal messaging commands in Weixin chats.

Cron Delivery

anyy cron create \
--name "Weixin digest" \
--schedule "0 9 * * *" \
--prompt "Send my morning digest" \
--delivery-target current_user_default \
--delivery-channel weixin

Troubleshooting

  • QR login expires: rerun anyy setup channels weixin login.
  • Session expired: rerun login and reload channels.
  • Media download fails: check media_cdn_base_url and file size.
  • Gateway reload fails after login: start the gateway, then run anyy channels reload.