AG

CLI tool for automating WeChat Official Account message delivery and follower management via API.

Install

mkdir -p .claude/skills/agent-wechatbot && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19537" && unzip -o skill.zip -d .claude/skills/agent-wechatbot && rm skill.zip

Installs to .claude/skills/agent-wechatbot

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Interact with WeChat Official Account using API credentials - send messages, manage templates, list followers
109 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Send customer service and template messages
  • Manage WeChat Official Account API credentials
  • Retrieve follower lists
  • Maintain persistent agent memory
  • Switch between multiple WeChat accounts

How it works

The CLI tool interacts with the WeChat Official Account API using stored credentials to send messages and manage account data, while using a local memory file to track IDs and preferences.

Inputs & outputs

You give it
Recipient OpenID and message content
You get back
API response status

When to use agent-wechatbot

  • Send automated notifications to WeChat followers
  • Manage approved message templates
  • Retrieve a list of account followers
  • Integrate WeChat messaging into CI/CD workflows

About this skill

Agent WeChatBot

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.

Key Concepts

Before diving in, a few things about WeChat Official Account API:

  • Send-only — The Official Account API delivers inbound messages via webhooks only. This CLI cannot list or read received messages.
  • Customer service messages — You can send free-form text, image, and news (article) messages to users who have interacted with your account within the last 48 hours.
  • Template messages — Pre-approved message templates can be sent at any time. Templates must be created and approved in the WeChat Official Account admin panel.
  • App ID — Your Official Account's unique application identifier. Found in the WeChat Official Account admin panel under Development > Basic Configuration.
  • App Secret — Your application's secret key, paired with the App ID. Found in the same location.
  • OpenID — Each follower has a unique OpenID scoped to your Official Account. Use user list to retrieve follower OpenIDs.
  • IP Whitelist — Your server IP must be added to the Official Account's IP whitelist, or API calls will fail with error 40164.
  • Rate limits — WeChat enforces API call frequency limits. Customer service messages are limited per account per day.

Quick Start

# 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

Authentication

API Credential Setup

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

Multi-Account Management

# 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>

Memory

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.

Reading Memory

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.

  • If the file doesn't exist yet, that's fine. Proceed without it and create it when you first have useful information to store.
  • If the file can't be read (permissions, missing directory), proceed without memory. Don't error out.

Writing Memory

After discovering useful information, update ~/.config/agent-messenger/MEMORY.md using the Write tool. Write triggers include:

  • After discovering account IDs and App IDs (from auth list, auth status, etc.)
  • After discovering template names and their parameters (from template list, etc.)
  • After discovering follower OpenIDs (from user list, user get, etc.)
  • After the user gives you an alias or preference ("call this the notifications account", "my main template is X")

When writing, include the complete file content. The Write tool overwrites the entire file.

What to Store

  • Account IDs (App IDs) with names
  • Template IDs with their required parameters
  • Frequently used follower OpenIDs with context
  • User-given aliases ("notifications account", "marketing account")
  • Any user preference expressed during interaction

What NOT to Store

Never store App Secrets or any credentials. Never store full message content (just context). Never store personal user data.

Handling Stale 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.

Format / Example

# 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 list calls. When you already know a template ID from a previous session, use it directly.

Commands

Auth Commands

# 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

Whoami Command

# Show current authenticated bot
agent-wechatbot whoami
agent-wechatbot whoami --pretty
agent-wechatbot whoami --account <account-id>

Message Commands

# 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://..."

Template Commands

# 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>

User Commands

# 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

Output Format

JSON (Default)

All commands output JSON by default for AI consumption:

{
  "success": true,
  "app_id": "wx1234567890",
  "account_name": "wx1234567890"
}

Pretty (Human-Readable)

Use --pretty flag for formatted output:

agent-wechatbot template list --pretty

Global Options

OptionDescription
--prettyHuman-readable output instead of JSON
--account <id>Use a specific account for this command

Common Patterns

See references/common-patterns.md for additional workflows.

Send a customer service message within 48h window

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"

Send a template notification (anytime)

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"

List and inspect followers

# 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

CI/CD deployment notification

agent-wechatbot template send oABCD1234 deployment_alert \
  --data '{"version":{"value":"v2.1.0"},"environment":{"value":"production"},"status":{"value":"success"}}'

Templates

See templates/ directory for runnable examples:

  • post-message.sh - Send a customer service message with error handling and retries
  • account-summary.sh - Generate account, template, and follower summary
  • send-template.sh - Send a template message with parameters

Error Handling

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).

Configuration

Credentials stored in ~/.config/agent-messenger/wechatbot-credentials.json (0600 permissions).

Config format:

{
  "current": { "account_id": "wx1234567890" },
  "accounts": {
    "wx1234

---

*Content truncated.*

When not to use it

  • Reading inbound messages from followers
  • Voice or video communication

Prerequisites

WeChat Official Account App IDWeChat Official Account App Secret

Limitations

  • Customer service messages limited to 48-hour interaction window
  • Cannot read inbound messages

How it compares

It provides a CLI interface for WeChat API operations that handles token refreshing and credential management, which would otherwise require manual API integration.

Compared to similar skills

agent-wechatbot side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
agent-wechatbot (this skill)013dReviewIntermediate
mcporter72moNo flagsIntermediate
calcom-api23moNo flagsIntermediate
developing-genkit-tooling25moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

mcporter

openclaw

Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.

726

calcom-api

calcom

Interact with the Cal.com API v2 to manage scheduling, bookings, event types, availability, and calendars. Use this skill when building integrations that need to create or manage bookings, check availability, configure event types, or sync calendars with Cal.com's scheduling infrastructure.

216

developing-genkit-tooling

firebase

Best practices for authoring Genkit tooling, including CLI commands and MCP server tools. Covers naming conventions, architectural patterns, and consistency guidelines.

27

vercel-sdk-patterns

jeremylongshore

Execute apply production-ready Vercel SDK patterns for TypeScript and Python. Use when implementing Vercel integrations, refactoring SDK usage, or establishing team coding standards for Vercel. Trigger with phrases like "vercel SDK patterns", "vercel best practices", "vercel code patterns", "idiomatic vercel".

13

deepgram-webhooks-events

jeremylongshore

Implement Deepgram callback and webhook handling for async transcription. Use when implementing callback URLs, processing async transcription results, or handling Deepgram event notifications. Trigger with phrases like "deepgram callback", "deepgram webhook", "async transcription deepgram", "deepgram events", "deepgram notifications".

01

replit-webhooks-events

jeremylongshore

Implement Replit webhook signature validation and event handling. Use when setting up webhook endpoints, implementing signature verification, or handling Replit event notifications securely. Trigger with phrases like "replit webhook", "replit events", "replit webhook signature", "handle replit events", "replit notifications".

01

Search skills

Search the agent skills registry