Send WhatsApp messages, query templates, and manage sessions directly from an AI agent, without switching consoles or manually constructing API requests.
Prerequisites
-
Obtain an AccessKey ID and AccessKey Secret for an Alibaba Cloud sub-account. The main account creates a user in the Resource Access Management (RAM) console and grant the necessary Chat App Message Service (CAMS) permissions.
-
Activate the Chat App Message Service console and complete the following steps:
-
Bind a WhatsApp Business Account (WABA).
-
Register and get approval for the sender's phone number (From).
-
Create and get approval for message templates. This is required for sending template messages.
-
Core capabilities and advantages
Covers common business scenarios such as international order notifications, marketing campaign outreach, and customer service follow-up.
|
Capability |
Description |
|
Send template messages |
Send WhatsApp template messages outside the 24-hour session window. Supports variable substitution for use cases like marketing notifications, order status updates, verification codes, and logistics reminders. |
|
Send custom messages |
Send free-form messages within the 24-hour session window. Supports seven message types: text, image, video, audio, document, interactive, and location. |
|
Query template list |
Filter templates by approval status, template type, or language, allowing the agent to automatically select or display options to the user. |
|
Query template details |
Retrieve the variable structure of a specific template so the agent can guide the user in populating parameters one by one, preventing mismatches in parameter count and format. |
Key advantages:
-
Conversational message sending: Query templates, populate variables, and send messages using natural language in agent tools like Claude Code, Qwen Coder, and OpenClaw — without switching to the console.
-
Reduced parameter construction cost: Traditional API calls require a strictly formatted Content JSON, and any format error can cause failure. The agent automatically constructs valid JSON and assists with variable matching.
-
Automated error diagnosis: Built-in diagnostics and solution suggestions for common error codes. For example, if a
SessionWindowExpirederror occurs, the skill automatically switches to the template message workflow. If RAM permissions are insufficient, it guides you through the permission application process. -
Pre-send confirmation: All customizable parameters (From, To, template, variables, Content JSON) require explicit user confirmation before sending, ensuring that messages are delivered accurately.
Supported features:
-
Query template lists and details conversationally to find available templates and their variable structures.
-
Send template messages and custom messages automatically, allowing you to reach users outside the 24-hour session window.
-
Detect session window expiry and switch to the template message flow automatically.
-
Use multi-language templates (such as en, zh_CN, and zh_HK).
-
Handle multi-tenant scenarios for independent software vendors (ISVs) through the
--cust-space-idparameter.
Installation methods
Install from Alibaba Cloud Skill Marketplace (recommended)
Go to Alibaba Cloud Skill Marketplace, search for "ChatApp Message Sending", and install it.
Install from ClawHub
Visit the ClawHub platform and search for "alibabacloud-chatapp-message-send" to view the skill's documentation and install it.
Other installation methods
Claude Code installation
Refer to the official Claude Code documentation.
Unzip the downloaded skill package and move it to the Claude Code skills directory:
-
For global scope (all projects): Move the skill to the
~/.claude/skills/directory. -
For project-level scope (current project only): Move the skill to the
project_root/.claude/skills/directory.
After moving the directory, restart Claude Code for the changes to take effect.
OpenClaw installation
Unzip the downloaded skill package and copy the path to the skill's directory. In OpenClaw, enter the path and say, "Help me install the skill in this directory." Wait for a confirmation message before using the skill.
Environment setup
Aliyun CLI >= 3.3.3
Run aliyun version to check your current version. If Aliyun CLI is not installed or the version is too old:
# For macOS or Linux, install or upgrade to the latest version:
curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash
# Verify the version (must be >= 3.3.3)
aliyun version
Before making any CLI calls, enable automatic plug-in installation and ai-mode.
aliyun configure set --auto-plugin-install true
aliyun plugin update
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-chatapp-message-send"
Always disable ai-mode when your session ends, whether the task completes successfully or encounters an error. Run aliyun configure ai-mode disable before exiting.
Install the CAMS plug-in
aliyun plugin install --names aliyun-cli-cams
Verify credentials
Follow these practices to protect your credentials.
-
Do not display or print AccessKey ID or AccessKey Secret values in the terminal or chat.
-
Do not enter an AccessKey ID or AccessKey Secret directly in the conversation or on the command line.
-
Do not use
aliyun configure setwith plaintext credentials. -
Use
aliyun configure listto verify that a valid credential profile exists.
aliyun configure list
Check the output for a valid profile (AccessKey (AK), Security Token Service (STS), or OAuth). If no valid profile exists, do not proceed. Obtain a credential from the RAM console and configure it outside the session by using aliyun configure or environment variables before proceeding.
RAM permissions
The following RAM actions are required:
|
API |
Action |
Description |
|
SendChatappMessage |
cams:SendChatappMessage |
Send a message |
|
ListChatappTemplate |
cams:ListChatappTemplate |
Query template list |
|
GetChatappTemplateDetail |
cams:GetChatappTemplateDetail |
Query template details |
|
ListChatappMessage |
cams:ListChatappMessage |
Query message list |
Minimum permission policy JSON:
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cams:SendChatappMessage",
"cams:ListChatappTemplate",
"cams:GetChatappTemplateDetail",
"cams:ListChatappMessage"
],
"Resource": "*"
}
]
}
Use cases
International order notifications
Shipment notifications, logistics updates, and payment confirmations are common in cross-border commerce.
Previously, operations staff had to find the right template, fill in variables, and prepare phone numbers before sending messages through a console or script. With this skill, you state your needs to the agent, and it handles template matching, variable population, message sending, and result reporting.
Marketing campaign outreach
In international marketing, WhatsApp is often used for new product announcements, promotional reminders, and re-engaging members.
WhatsApp template messages must be pre-approved, and the skill does not shorten Meta's template review period. However, once a template is approved, the agent can help you use it more efficiently. It can also validate phone number formats and template matches, handle customer lists, match variables, send messages one by one in sequence, and review results.
Customer service follow-up
The 24-hour session window is a critical rule in customer service. After a customer initiates a conversation, a business can send free-form messages within this window. Outside the window, template messages are required.
The skill helps the agent determine whether to use a free-form or template message and recommends the appropriate method. This reduces the cognitive load on customer service staff and helps prevent sending failures.
FAQ
Which AI agent tools does this skill support?
Currently supports tools that follow the Agent Skills standard, such as Claude Code, Cursor, OpenClaw, Qoderwork, and Wukong. Support for more platforms is in development.
What is the difference between the skill's capabilities and the console's?
The skill supports sending template messages, sending custom messages, querying template lists, and querying template details. Creating templates and other message console features are not yet supported and still require manual operation through the console.
Can I send messages without registering an account?
No. You must register for an Alibaba Cloud account, activate the Chat App Message Service, bind your WABA, and complete the registration and approval for your sender phone number and message templates.
Can individual users use this service?
Individual users can use the service only if they provide valid business qualifications. Using the service with personal qualifications is not supported.
Do template variables need to be filled in a specific format?
Yes. Template variables must be populated in numerical order (for example, 1=value1 2=value2 3=value3). The agent will guide you through confirming each one to prevent mismatches in count or format.
Which templates can be used for sending messages?
You can use any template that has an "Approved" status and a language that matches the target user. You can query for approved templates using the list-chatapp-template --audit-status pass command.
How many messages can I send at once?
Yes. If you have multiple phone numbers, you can send to multiple users. Provide the agent with the list of target phone numbers.
Can custom messages only be sent within 24 hours?
Yes. WhatsApp custom messages can only be sent within 24 hours of the user's last message. After this period, you will receive a SessionWindowExpired error, and the agent will automatically switch to the template message workflow.
Common error codes
|
Error code |
Description |
Solution |
|
InvalidParameter.FromOnlyNumeric |
The phone number contains a "+" sign. |
The API requires the phone number to be in a numeric-only format. Remove the leading |
|
TemplateNotFound |
The template does not exist. |
Check the |
|
TemplateParamInvalid |
The template variable is invalid. |
Check if the variable count and format match the template. |
|
SessionWindowExpired |
The 24-hour session window has expired. |
Switch to the template message workflow. |
|
PhoneNumberNotRegistered |
The sender's phone number is not registered. |
Complete the phone number registration and approval process in the console. |
|
Forbidden.RAM |
Insufficient RAM permissions. |
Use the |
|
InvalidAccessKeyId.NotFound |
The AccessKey ID is invalid. |
Check the AccessKey ID. |
|
SignatureDoesNotMatch |
The AccessKey Secret is incorrect. |
Check the AccessKey Secret. |
When a command fails due to insufficient RAM permissions, the skill identifies the missing permissions and guides you through the application process. After you confirm the changes, the original command resumes automatically.