Summary
The Weixin (WeChat) adapter in EdgeCrab fails to process incoming messages from the iLink Bot API because it looks for a "messages" field in the JSON response, but the actual field name returned by the iLink API is "msgs".
Environment
EdgeCrab Version: 0.9.0 (installed via npm)
Runtime: WSL2 (Ubuntu)
Platform: Weixin (iLink Bot API)
Token Format: account_id@im.bot:token_hash
Steps to Reproduce
Configure Weixin adapter with valid iLink Bot credentials:
bash
export WEIXIN_TOKEN="...@im.bot:..."
export WEIXIN_ACCOUNT_ID="...@im.bot"
export GATEWAY_ALLOWED_USERS="...@im.wechat"
Start EdgeCrab gateway:
bash
edgecrab gateway start --foreground
Send a message to the WeChat bot from a mobile device.
Observe that the message is received by the iLink API (confirmed via direct curl), but EdgeCrab does not process it.
Expected Behavior
EdgeCrab should parse the msgs array from the iLink API response and process each message through the process_updates() method.
Actual Behavior
EdgeCrab silently drops all messages because body.get("messages") returns None, causing the process_updates() method to return early.
Root Cause Analysis
In crates/edgecrab-gateway/src/weixin.rs, line ~350:
rust
async fn process_updates(&self, body: &serde_json::Value, tx: &mpsc::Sender<<IncomingMessage>) {
let Some(messages) = body.get("messages").and_then(|v| v.as_array()) else {
return; // ← Returns early because field is "msgs", not "messages"
};
// ... message processing logic never executes
}
However, the iLink API /ilink/bot/getupdates endpoint returns:
JSON
{
"msgs": [
{
"seq": 5,
"message_id": 7468581174516919944,
"from_user_id": "...@im.wechat",
"to_user_id": "...@im.bot",
"item_list": [
{
"type": 1,
"text_item": {"text": "hi"}
}
],
"context_token": "..."
}
],
"sync_buf": "CAUQmpKwt+kzGN+RsLfpMw==",
"get_updates_buf": "..."
}
Evidence
Direct API call confirming the field name is "msgs":
bash
curl -s -X POST "https://ilinkai.weixin.qq.com/ilink/bot/getupdates" \
-H "Content-Type: application/json" \
-H "AuthorizationType: ilink_bot_token" \
-H "Authorization: Bearer ...@im.bot:..." \
-H "X-WECHAT-UIN: MzA2ODYxNTg1Ng==" \
-H "iLink-App-Id: bot" \
-H "iLink-App-ClientVersion: 65536" \
-d '{"get_updates_buf": "", "base_info": {"channel_version": "2.0.0"}}'
Response:
JSON
{
"msgs": [...],
"sync_buf": "...",
"get_updates_buf": "..."
}
Proposed Fix
Change line ~350 in crates/edgecrab-gateway/src/weixin.rs:
rust
// Before
let Some(messages) = body.get("messages").and_then(|v| v.as_array()) else {
return;
};
// After
let Some(messages) = body.get("msgs").and_then(|v| v.as_array()) else {
return;
};
Impact
Severity: High — Weixin adapter is completely non-functional for message processing
Workaround: None available without modifying source code
Affected Users: All users using Weixin (iLink Bot) integration
Additional Context
The adapter successfully connects to iLink API (poll loop starts)
The adapter correctly handles session expiration (errcode -14)
The adapter correctly sends messages via sendmessage endpoint
Only inbound message processing is broken due to this field name mismatch
Related Code References
crates/edgecrab-gateway/src/weixin.rs:350 — process_updates() method
crates/edgecrab-gateway/src/weixin.rs:976 — Starting Weixin adapter log
crates/edgecrab-gateway/src/weixin.rs:311 — poll loop started log
Summary
The Weixin (WeChat) adapter in EdgeCrab fails to process incoming messages from the iLink Bot API because it looks for a "messages" field in the JSON response, but the actual field name returned by the iLink API is "msgs".
Environment
EdgeCrab Version: 0.9.0 (installed via npm)
Runtime: WSL2 (Ubuntu)
Platform: Weixin (iLink Bot API)
Token Format: account_id@im.bot:token_hash
Steps to Reproduce
Configure Weixin adapter with valid iLink Bot credentials:
Start EdgeCrab gateway:
Send a message to the WeChat bot from a mobile device.
Observe that the message is received by the iLink API (confirmed via direct curl), but EdgeCrab does not process it.
Expected Behavior
EdgeCrab should parse the msgs array from the iLink API response and process each message through the process_updates() method.
Actual Behavior
EdgeCrab silently drops all messages because body.get("messages") returns None, causing the process_updates() method to return early.
Root Cause Analysis
In crates/edgecrab-gateway/src/weixin.rs, line ~350:
However, the iLink API /ilink/bot/getupdates endpoint returns:
Evidence
Direct API call confirming the field name is "msgs":
Response:
Proposed Fix
Change line ~350 in crates/edgecrab-gateway/src/weixin.rs:
Impact
Severity: High — Weixin adapter is completely non-functional for message processing
Workaround: None available without modifying source code
Affected Users: All users using Weixin (iLink Bot) integration
Additional Context
The adapter successfully connects to iLink API (poll loop starts)
The adapter correctly handles session expiration (errcode -14)
The adapter correctly sends messages via sendmessage endpoint
Only inbound message processing is broken due to this field name mismatch
Related Code References
crates/edgecrab-gateway/src/weixin.rs:350 — process_updates() method
crates/edgecrab-gateway/src/weixin.rs:976 — Starting Weixin adapter log
crates/edgecrab-gateway/src/weixin.rs:311 — poll loop started log