From agent-messenger
Interact with WeChat Official Account API via CLI: send text/image/news messages, manage templates, list followers using App ID/Secret auth. For notifications, customer engagement, CI/CD.
npx claudepluginhub agent-messenger/agent-messenger --plugin agent-channeltalkbotThis skill is limited to using the following tools:
A TypeScript CLI tool that enables AI agents and humans to send messages through WeChat Official Account API. Designed for customer engagement, template notifications, and CI/CD integrations using App ID + App Secret authentication.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
A TypeScript CLI tool that enables AI agents and humans to send messages through WeChat Official Account API. Designed for customer engagement, template notifications, and CI/CD integrations using App ID + App Secret authentication.
Before diving in, a few things about WeChat Official Account API:
user list to retrieve follower OpenIDs.40164.# Set your API credentials
agent-wechatbot auth set your-app-id your-app-secret
# Verify authentication
agent-wechatbot auth status
# Send a text message (recipient must have interacted within 48h)
agent-wechatbot message send oXXXXXXXXXXXXXXX "Hello from the CLI!"
# List available templates
agent-wechatbot template list --pretty
# List followers
agent-wechatbot user list --pretty
agent-wechatbot uses App ID + App Secret pairs from the WeChat Official Account admin panel:
# Set credentials (validates against WeChat API before saving)
agent-wechatbot auth set your-app-id your-app-secret
# Check auth status
agent-wechatbot auth status
# Clear stored credentials
agent-wechatbot auth clear
# List stored accounts
agent-wechatbot auth list
# Switch active account
agent-wechatbot auth use <account-id>
# Remove a stored account
agent-wechatbot auth remove <account-id>
The agent maintains a ~/.config/agent-messenger/MEMORY.md file as persistent memory across sessions. This is agent-managed, the CLI does not read or write this file. Use the Read and Write tools to manage your memory file.
At the start of every task, read ~/.config/agent-messenger/MEMORY.md using the Read tool to load any previously discovered account IDs, template names, follower OpenIDs, and preferences.
After discovering useful information, update ~/.config/agent-messenger/MEMORY.md using the Write tool. Write triggers include:
auth list, auth status, etc.)template list, etc.)user list, user get, etc.)When writing, include the complete file content. The Write tool overwrites the entire file.
Never store App Secrets or any credentials. Never store full message content (just context). Never store personal user data.
If a memorized template returns an error (template not found, account invalid), remove it from MEMORY.md. Don't blindly trust memorized data. Verify when something seems off. Prefer re-listing over using a memorized value that might be stale.
# Agent Messenger Memory
## WeChat Accounts
- `wx1234567890` - Acme Notifications
## Templates (Acme Notifications)
- `TM00001` - Order confirmation, params: [order_id, customer_name]
- `TM00002` - Shipping update, params: [tracking_number]
## Frequent Recipients
- `oABCD1234` - Test user (internal QA)
- `oEFGH5678` - VIP customer
## Aliases
- "notifications" -> `wx1234567890` (Acme Notifications)
## Notes
- IP whitelist configured for 203.0.113.10
- Customer service messages limited to 48h interaction window
Memory lets you skip repeated
template listcalls. When you already know a template ID from a previous session, use it directly.
# Set account credentials (validates against API)
agent-wechatbot auth set <app-id> <app-secret>
# Check auth status
agent-wechatbot auth status
agent-wechatbot auth status --account <account-id>
# List stored accounts
agent-wechatbot auth list
# Switch active account
agent-wechatbot auth use <account-id>
# Remove a stored account
agent-wechatbot auth remove <account-id>
# Clear all credentials
agent-wechatbot auth clear
# Show current authenticated bot
agent-wechatbot whoami
agent-wechatbot whoami --pretty
agent-wechatbot whoami --account <account-id>
# Send a text message (customer service, within 48h window)
agent-wechatbot message send <open-id> <text>
agent-wechatbot message send oABCD1234 "Your order has shipped!"
# Send an image message (customer service, within 48h window)
agent-wechatbot message send-image <open-id> <media-id>
agent-wechatbot message send-image oABCD1234 MEDIA_ID_HERE
# Send a news/article message (customer service, within 48h window)
agent-wechatbot message send-news <open-id> --title "Title" --description "Desc" --url "https://..." --picurl "https://..."
# List message templates
agent-wechatbot template list
# Send a template message
agent-wechatbot template send <open-id> <template-id>
agent-wechatbot template send oABCD1234 TM00001 --data '{"order_id":{"value":"ORD-9876"},"customer_name":{"value":"Alice"}}' --url "https://example.com/order/9876"
# Delete a template
agent-wechatbot template delete <template-id>
# List followers (paginated)
agent-wechatbot user list
agent-wechatbot user list --next-openid oLAST_OPENID
# Get user info by OpenID
agent-wechatbot user get <open-id>
agent-wechatbot user get oABCD1234 --lang en
All commands output JSON by default for AI consumption:
{
"success": true,
"app_id": "wx1234567890",
"account_name": "wx1234567890"
}
Use --pretty flag for formatted output:
agent-wechatbot template list --pretty
| Option | Description |
|---|---|
--pretty | Human-readable output instead of JSON |
--account <id> | Use a specific account for this command |
Customer service messages can be sent to users who have interacted with your account within the last 48 hours:
# Send a text reply
agent-wechatbot message send oABCD1234 "Thanks for reaching out! We'll look into this right away."
# Send a news article
agent-wechatbot message send-news oABCD1234 \
--title "Your Order Update" \
--description "Your order #12345 has been shipped" \
--url "https://example.com/orders/12345" \
--picurl "https://example.com/images/shipping.jpg"
Template messages can be sent at any time, regardless of the 48h window:
# List templates to find the right one
agent-wechatbot template list --pretty
# Send a template message with data
agent-wechatbot template send oABCD1234 TM00001 \
--data '{"order_id":{"value":"ORD-9876"},"status":{"value":"Shipped"}}' \
--url "https://example.com/orders/9876"
# Get first page of followers
agent-wechatbot user list --pretty
# Get next page
agent-wechatbot user list --next-openid oLAST_OPENID --pretty
# Get details for a specific follower
agent-wechatbot user get oABCD1234 --pretty
agent-wechatbot template send oABCD1234 deployment_alert \
--data '{"version":{"value":"v2.1.0"},"environment":{"value":"production"},"status":{"value":"success"}}'
All commands return consistent error format:
{
"error": "No credentials. Run \"auth set <app-id> <app-secret>\" first."
}
Common errors: No credentials, Account not found, Invalid credentials, WeChat API error (errcode: 40001), IP not in whitelist (errcode: 40164), Rate limit exceeded (errcode: 45009).
Credentials stored in ~/.config/agent-messenger/wechatbot-credentials.json (0600 permissions).
Config format:
{
"current": { "account_id": "wx1234567890" },
"accounts": {
"wx1234567890": {
"app_id": "wx1234567890",
"app_secret": "...",
"account_name": "wx1234567890"
}
}
}
40164.agent-wechatbot: command not foundagent-wechatbot is NOT the npm package name. The npm package is agent-messenger.
If the package is installed globally, use agent-wechatbot directly:
agent-wechatbot message send oABCD1234 "Hello"
If the package is NOT installed, run it directly with npx -y:
npx -y agent-messenger wechatbot message send oABCD1234 "Hello"
Note: If the user prefers a different package runner (e.g.,
bunx,pnpx,pnpm dlx), use that instead.
NEVER run npx agent-wechatbot, bunx agent-wechatbot, or pnpm dlx agent-wechatbot. It will fail or install a wrong package since agent-wechatbot is not the npm package name.
agent-wechatbot auth set <app-id> <app-secret>If you get error 40164, your server's IP is not in the Official Account's whitelist. Add it in the admin panel under Development > Basic Configuration > IP Whitelist.
These indicate an expired or invalid access token. The CLI handles automatic token refresh, but if you see persistent errors:
agent-wechatbot auth set <app-id> <app-secret> with the current credentialsWeChat enforces API call frequency limits. If you hit error 45009, wait before retrying. For bulk operations, add delays between requests.