Wake Grok Bot from WeChat to Check Email, Read Webpages, and Reply
Input: WeChat private text → Processing: local bridge notifies + Grok Bot reads inbox and calls tools → Output: WeChat reply
- Who
- Technical users with Linux basics who need to trigger AI tasks remotely via WeChat
- You get
- Send natural-language commands in WeChat; Grok Bot wakes up, checks email, reads webpages, runs scripts, and sends results back
- You need
- Grok Bot
Constraints
Prerequisites: Grok Bot assistant account (includes Linux environment), a WeChat account that can scan QR codes, and ability to work with Python standard library. Read the Tencent openclaw-weixin protocol docs and treat source code as authoritative for undocumented details. The bridge program must be self-written in Python and deployed at ~/workspace/wechat-bridge/. No ready-made downloadable code is provided.
What they did
Author EvanWritesX built a WeChat-Grok Bot bridge system: wrote a custom Python bridge program interfacing with Tencent's openclaw-weixin protocol, configured a webhook + periodic fallback routine inside Grok Bot, enabling WeChat private messages to wake Grok Bot so the AI reads local messages, calls tools to check email/read webpages/run scripts, and sends results back to WeChat.
How it went
Author reported: message round-trip under 1 second, simple questions replied in about 10–15 seconds (time mostly spent waking the AI). Already in daily use for three scenarios: summarizing 4 email inboxes, pushing a store revenue report at 9:30 daily, and forwarding DMIT restock alerts to WeChat. (author_report, unverified)
Worth knowing
Known limitations: each WeChat task is an independent wake-up; the AI has long-term memory but cannot see the full main-chat history. Proactive push depends on the most recent conversation's context_token, which may expire after long inactivity — sending any message restores it. After server restart, the 10-minute health check brings the service back up. If credentials fully expire, the WeChat channel is already broken; use in-app notifications to re-scan. Consequential actions like sending email, payments, or deletions still require explicit user approval. Pitfalls: request headers must include iLink-App-Id and iLink-App-ClientVersion with version calculated from current source code, not copied from old tutorials; return code -14 means token expired — the official client pauses 1 hour, so do not immediately re-scan. Separate network errors (limited retry) from business errors (log code, no retry). Image/voice/file messages should be replied with "not supported, please describe in text" to prevent the AI from hallucinating understanding. No bridge source code is provided; you must implement it yourself.
Steps
Safety tip
Safety tip: before the bot sends or submits to an external system, confirm the recipient/target and the content.
Preparation
Confirm three prerequisites: 1) Grok Bot assistant is available (includes Linux, can write files, run Python, and keep background processes); 2) you have a WeChat account that can scan a QR code for binding; 3) read the Tencent openclaw-weixin protocol documentation at https://github.com/Tencent/openclaw-weixin/blob/main/docs/protocol_zh_CN.md — treat the source code as authoritative for anything not covered in the docs.
Deploy the Bridge Program
Write a Python bridge program in Grok Bot's Linux environment, using mostly the standard library, under ~/workspace/wechat-bridge/. Implement 5 commands: 1. login: call get_bot_qrcode to fetch a QR code and generate a PNG. 2. wait-login: poll get_qrcode_status and handle states including wait/scaned/confirmed/expired/verification-required/redirect; after confirmation, atomically write credentials to state/session.json with permissions 600. 3. serve: use getupdates long-polling to receive messages, persist cursor get_updates_buf to resume after restart; process only private messages from the bound user, ignore groups and others; deduplicate by message_id and write to inbox/. 4. send: reply via sendmessage, must include the context_token received with the original message; auto-split messages over 4000 characters, use client_id and send logs to prevent duplicates. 5. status/health: check login state, process, last poll time, and task backlog; mask credentials to first/last 4 digits to avoid leaks in logs or screenshots.
Configure the Wake-Up Routine
Create a scheduled task (routine) in Grok Bot: set trigger type to webhook, and add a 10-minute periodic trigger as fallback and health check (if webhook fails, messages are processed within ~10 minutes). Key configurations: - Secure storage: save webhook URL and secret as environment variables on the machine, enter them via Grok Bot's encrypted input fields; secrets must not pass through chat. - Minimal notification: when the bridge receives a new message, POST only a notification containing the message ID to the webhook, without credentials or message content; the AI reads the message from local inbox/ after being woken. - Workflow description: in the routine instructions specify the execution order — check health → fetch pending tasks → mark "executing" → execute with tools → send back to WeChat via send → mark "sent". Task states are 5: received, executing, pending-send, sent, failed. If execution succeeds but sending fails, state stays "pending-send"; next wake-up retries send only, not re-execution.
Scan QR Code and Go Live
1. Have your phone ready, generate the QR code (expires in ~5 minutes), scan and confirm. 2. Start the background service with setsid + nohup so it restarts automatically on crash. 3. Critical: open the robot's chat window in WeChat and send a message — you must send it inside the chat window; saying "done" elsewhere does not provide the first context_token. This message is used to obtain the initial context_token. 4. Send a test command (e.g., "summarize today's emails") and verify it triggers email checking and returns a summary.
Prompt you can copy
Reference prompt · Editorial suggestion。Confirm the destination, input variables and output format before use.
This block is the prompt. Ads are never placed here.
No prompt needed — just follow the steps.
Source
(中文)微信桥接唤醒 Grok Bot:Webhook 只传消息 ID,AI 读本地 inbox 查邮箱/网页后再回微信 · EvanWritesX · X · 2026-10-18T03:33:07.000Z
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.