WeChat Message Queue
Purpose
This skill is the cloud-side intake layer for WeChat ClawBot messages.
It must only save the original inbound message into a durable queue. It must not analyze, classify, summarize, rewrite, schedule, or update any knowledge-base file.
The user's local laptop and Codex process will later pull pending messages, classify them, rewrite them, and write them into the local Obsidian vault.
Required Behavior
When a WeChat/ClawBot message arrives:
- Preserve the original content exactly.
- Build a JSON payload with the best available fields.
- Run
scripts/save_message.pywith that JSON payload on stdin. - Reply briefly with the saved message ID and status.
Never infer whether the message is a todo, done work, plan, reminder, or project update. That happens later on the local Codex side.
Queue Fields
Save one JSON object per message with these fields:
id: unique message id. Prefer the source message id. If unavailable, the script generates a stable hash.source: usuallywechat-clawbot.sender: sender identifier or display name.message_type:text,voice,image,file, orunknown.raw_content: original text or transcript if already provided.voice_url: voice file URL or local path if available.image_url: image URL or local path if available.created_at: source timestamp if available; otherwise current time.status: initiallypending.processed_at: initially null.retry_count: initially 0.error: initially null.
Input Payload
Pass the script a JSON object like this:
{
"message_id": "{{message_id}}",
"source": "wechat-clawbot",
"sender": "{{sender}}",
"message_type": "{{message_type}}",
"raw_content": "{{content}}",
"voice_url": "{{voice_url}}",
"image_url": "{{image_url}}",
"created_at": "{{created_at}}"
}
If the platform uses different variable names, map the closest available values. At minimum, provide raw_content or a text-like field such as text, content, or message.
Script
Run:
python scripts/save_message.py
Send the JSON payload on stdin. The script returns JSON:
{
"ok": true,
"id": "message-id",
"status": "pending",
"duplicate": false,
"queue_file": "/data/openclaw/wechat_queue/messages.ndjson"
}
If duplicate is true, do not save the message again. Reply that it was already recorded.
Storage
The script writes to:
WECHAT_QUEUE_FILE, if that environment variable is set.- Otherwise
/data/openclaw/wechat_queue/messages.ndjson. - If that path is not writable, it falls back to
./data/wechat_queue/messages.ndjson.
Use WECHAT_QUEUE_FILE on the server if you want a different persistent disk location.
Reply Style
On successful save:
已记录,等待本地 Codex 处理。
消息ID:<id>
For duplicate messages:
这条消息已记录,无需重复处理。
消息ID:<id>
For errors, report a short failure reason and do not claim that the message was saved.