Skip to content

WeChat channel: missing iLink-App-Id and iLink-App-ClientVersion headers causes session timeout #2908

@dorokuma

Description

@dorokuma

When using the WeChat (weixin) channel, the buildHeaders2() function in cli.js is missing two required HTTP headers that the iLink Bot API expects:

  • iLink-App-Id: bot
  • iLink-App-ClientVersion (a version-encoded integer, e.g. 65536 for version 1.0.0)

Without these headers, the getupdates endpoint returns errcode: -14 ("session timeout") immediately, even with a valid bot token and Authorization header.

Reproduction:

  1. Configure weixin channel via qwen channel configure-weixin
  2. Add channel to settings.json with type weixin
  3. Run qwen channel start <name>
  4. Channel connects but immediately exits due to session timeout

Root cause: buildHeaders2() (around line 436765 in v0.14.0) only sets Content-Type and X-WECHAT-UIN, but omits iLink-App-Id and iLink-App-ClientVersion. The reference implementation in OpenClaw includes both headers.

Fix: Add the following to buildHeaders2():

function buildHeaders2(token2) {
  const headers = {
    "Content-Type": "application/json",
    "X-WECHAT-UIN": randomUin(),
    "iLink-App-Id": "bot",                    // Missing
    "iLink-App-ClientVersion": "65536"        // Missing
  };
  if (token2) {
    headers["AuthorizationType"] = "ilink_bot_token";
    headers["Authorization"] = `Bearer ${token2}`;
  }
  return headers;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions