← Back to blog
中文

WeChat ClawBot iLink Protocol Breakdown

WeChat Agent Claude Code OpenClaw

Background

WeChat’s latest iOS version (8.0.70+) introduced the ClawBot plugin. Under the hood, it uses a protocol called iLink, hosted at ilinkai.weixin.qq.com. This is an official Tencent product, backed by the “WeChat ClawBot Terms of Service” — not a gray area.

The intended use case is connecting OpenClaw agents to WeChat. But the iLink protocol itself is a generic HTTP/JSON Bot API with no coupling to the OpenClaw framework — any program that can send HTTP requests can interface with it.

Protocol Overview

iLink Protocol Overview
iLink Protocol: communication architecture between WeChat ClawBot and Bot backends

The entire protocol consists of just 4 HTTP endpoints.

1. Registration — QR Code Binding

GET /ilink/bot/get_bot_qrcode?bot_type=3

Response:

{
  "qrcode": "xxx",
  "qrcode_img_content": "https://liteapp.weixin.qq.com/q/..."
}

After the user scans, poll for status:

GET /ilink/bot/get_qrcode_status?qrcode=xxx
Header: iLink-App-ClientVersion: 1

Status transitions: waitscanedconfirmed

Upon confirmation, you receive the key credentials:

{
  "status": "confirmed",
  "bot_token": "44b9b8ec@im.bot:060000b7...",
  "ilink_bot_id": "44b9b8ec@im.bot",
  "ilink_user_id": "o9cq809L...@im.wechat",
  "baseurl": "https://ilinkai.weixin.qq.com"
}

bot_token is the auth credential for all subsequent API calls. Scan once, valid long-term.

2. Receiving Messages — HTTP Long Polling

POST /ilink/bot/getupdates
Authorization: Bearer <bot_token>
Headers:
  AuthorizationType: ilink_bot_token
  X-WECHAT-UIN: <random base64>

Body:
{
  "get_updates_buf": "",
  "base_info": { "channel_version": "0.1.0" }
}

Response:

{
  "ret": 0,
  "msgs": [
    {
      "from_user_id": "o9cq809L...@im.wechat",
      "message_type": 1,
      "item_list": [
        {
          "type": 1,
          "text_item": { "text": "Hello" }
        }
      ],
      "context_token": "CK3E..."
    }
  ],
  "get_updates_buf": "Ck1..."
}

Key mechanisms:

3. Sending Messages — Replying to Users

POST /ilink/bot/sendmessage
Authorization: Bearer <bot_token>

Body:
{
  "msg": {
    "to_user_id": "o9cq809L...@im.wechat",
    "client_id": "unique-id-123",
    "message_type": 2,
    "message_state": 2,
    "item_list": [
      { "type": 1, "text_item": { "text": "Hello! I'm Claude." } }
    ],
    "context_token": "CK3E..."
  }
}

4. Message Type Constants

FieldValueMeaning
message_type1User message
message_type2Bot message
message_state2Complete
item.type1Text (text_item.text)
item.type3Voice (voice_item.text is the transcription)

Minimal Implementation for Any Backend

All you need is a simple loop:

1. Scan QR to get bot_token (one-time)
2. loop:
     msgs = POST getupdates(get_updates_buf)
     for msg in msgs:
       text = msg.item_list[0].text_item.text
       reply = your_backend_process(text)
       POST sendmessage(to=msg.from_user_id, text=reply, context_token=msg.context_token)
     get_updates_buf = msgs.get_updates_buf

Relationship with OpenClaw

OpenClaw is an open-source AI agent framework initiated by Austrian developer Peter Steinberger (first released November 2025, 247k GitHub stars as of March 2026). Its core capability is giving LLMs local OS access. OpenClaw itself is not a Tencent product.

What Tencent did: opened a WeChat Bot channel for OpenClaw. Specifically:

The relationship chain:

OpenClaw Relationship Chain
Full chain for connecting to WeChat via the OpenClaw framework

But iLink API is standard HTTP/JSON — no dependency on the OpenClaw framework or Tencent’s npm package:

Direct Integration
Skip OpenClaw, call iLink API directly

Limitations

Protocol References