Loading...
Loading...
Interact with WeChat Official Account using API credentials - send messages, manage templates, list followers
npx skill4agent add devxoul/agent-messenger agent-wechatbotuser list40164# 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# 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>~/.config/agent-messenger/MEMORY.mdReadWrite~/.config/agent-messenger/MEMORY.mdRead~/.config/agent-messenger/MEMORY.mdWriteauth listauth statustemplate listuser listuser getWriteMEMORY.md# 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 windowMemory lets you skip repeatedcalls. When you already know a template ID from a previous session, use it directly.template list
# 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{
"success": true,
"app_id": "wx1234567890",
"account_name": "wx1234567890"
}--prettyagent-wechatbot template list --pretty| Option | Description |
|---|---|
| Human-readable output instead of JSON |
| Use a specific account for this command |
references/common-patterns.md# 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"# 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 --prettyagent-wechatbot template send oABCD1234 deployment_alert \
--data '{"version":{"value":"v2.1.0"},"environment":{"value":"production"},"status":{"value":"success"}}'templates/post-message.shaccount-summary.shsend-template.sh{
"error": "No credentials. Run \"auth set <app-id> <app-secret>\" first."
}No credentialsAccount not foundInvalid credentialsWeChat API error (errcode: 40001)IP not in whitelist (errcode: 40164)Rate limit exceeded (errcode: 45009)~/.config/agent-messenger/wechatbot-credentials.json{
"current": { "account_id": "wx1234567890" },
"accounts": {
"wx1234567890": {
"app_id": "wx1234567890",
"app_secret": "...",
"account_name": "wx1234567890"
}
}
}40164agent-wechatbot: command not foundagent-wechatbotagent-messengeragent-wechatbotagent-wechatbot message send oABCD1234 "Hello"npx -ynpx -y agent-messenger wechatbot message send oABCD1234 "Hello"Note: If the user prefers a different package runner (e.g.,,bunx,pnpx), use that instead.pnpm dlx
npx agent-wechatbotbunx agent-wechatbotpnpm dlx agent-wechatbotagent-wechatbotagent-wechatbot auth set <app-id> <app-secret>40164agent-wechatbot auth set <app-id> <app-secret>45009