Connect

Connect WeChat Official Account

Changed on

Connect a verified WeChat Official Account (Service Account) with its AppID and AppSecret (Weixin Official Accounts Platform > Settings and Development > Basic Configuration).

Before calling this, add every IP from GET /v1/connect/wechat/ip-whitelist to the account's API IP whitelist on the same page. WeChat refuses calls from any other IP, and this endpoint then returns 400 with code wechat_ip_not_whitelisted.

The response carries a Server URL, a Token and an EncodingAESKey. Paste them into Server Configuration on the same page, choose Safe mode for message encryption, and enable the configuration. Until then WeChat delivers nothing to Zernio.

Enabling Server Configuration turns off the auto-replies and menus set in the WeChat dashboard.

Reconnecting the same AppID on the same profile keeps the existing Token and EncodingAESKey, so nothing has to be pasted again. To get your userId for the state parameter, call GET /v1/users which includes a currentUserId field.

post/v1/connect/wechat/credentials

Request

Request body

appIdstring required

The Official Account's AppID (starts with wx).

appSecretstring required

The Official Account's AppSecret (32 characters).

statestring required

Required state formatted as {userId}-{profileId}. Get userId from GET /v1/users and profileId from GET /v1/profiles.

displayNamestring

Name to show for the account. Defaults to "WeChat Official Account".

redirect_urlstring uri

Optional URL to redirect to after a successful connection.

Example request

{
  "state": "6507a1b2c3d4e5f6a7b8c9d0-6507a1b2c3d4e5f6a7b8c9d1"
}

Response

WeChat connected

messagestring
ipWhiteliststring[]

IPs that must stay on the account's API IP whitelist.

nextStepsstring[]
redirectUrlstring

Changes