All Products
Search
Document Center

Chat App Message Service:SendChatappMessage

Last Updated:Dec 18, 2025

Sends a message.

Operation description

QPS limits

This API is limited to 250 queries per second (QPS) for each user. If you exceed this limit, API calls are throttled, which can affect your business. Call this API within the specified limit.

Status changes

Message sending status can be monitored via Simple Message Service or HTTP callback. For details, see Configure message receipts.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cams:SendChatappMessage

create

*All Resource

*

None

None

Request parameters

Parameter

Type

Required

Description

Example

ChannelType

string

Yes

The channel type. Valid values:

  • whatsapp

  • messenger

  • instagram

  • viber

whatsapp

Type

string

Yes

The message type. Valid values:

  • template: a message template that is approved in the console. You can send this type of message at any time.

  • message: a message of any format. You can send this type of message within 24 hours after you receive the last message from a user.

Important

If you set Type to template, you must set TemplateCode. If you set Type to message, you must set MessageType.

message

MessageType

string

No

The specific type of the message when Type is set to message. Valid values:

  • text: a plain text message. If you set this parameter to text, the Text parameter in the Content field is required.

  • image: an image message. If you set this parameter to image, the Link parameter in the Content field is required and the Caption parameter is optional.

  • video: a video message. If you set this parameter to video, the Link parameter in the Content field is required and the Caption parameter is optional.

  • audio: an audio message. If you set this parameter to audio, the Link parameter in the Content field is required and the Caption parameter is invalid.

  • document: a document message. If you set this parameter to document, the Link and FileName parameters in the Content field are required and the Caption parameter is invalid.

text

TemplateCode

string

No

The template code. You can view the template code on the Channel Management > Manage > Template Design page.

1119***************

Language

string

No

The language. For a list of language codes, see Language codes.

en

From

string

Yes

The sender's number.

  • If ChannelType is whatsapp, this is the phone number registered with and bound to WhatsApp. You can view the number on the Channel Management > Manage > WABA Management > Phone Number Management page.

  • If ChannelType is messenger, this is the Page ID. You can view the ID on the Channel Management > Manage > Facebook Homepage page.

  • If ChannelType is instagram, this is the Instagram professional account ID. You can view the ID on the Channel Management > Manage > Professional Account page.

  • If ChannelType is viber, this is the Viber service ID. You can view the ID on the Channel Management > Manage > Service Number Management page.

861387777****

To

string

Yes

The recipient's number.

  • If ChannelType is whatsapp, this is the recipient's phone number.

  • If ChannelType is messenger, this is the Page-Scoped User ID (PSID) that is generated when a user interacts with your Facebook Page.

  • If ChannelType is instagram, this is the Instagram User ID that is generated when a user interacts with your Instagram business or creator account.

  • If ChannelType is viber, this is the recipient's phone number.

861388988****

TemplateParams

object

No

The collection of template parameters.

string

No

Template parameter as a Key-Value pair. The Key is the parameter name, and the Value is the parameter's value.

{ "param1": "value1", "param2": "value2" }

Content

string

No

The message content.

Notes on WhatsApp messages:

  • If messageType is text, the text field is required and the Caption field must be left empty.

  • If messageType is image, the Link field is required.

  • If messageType is video, the Link field is required.

  • If messageType is audio, the Link field is required and the Caption field is invalid.

  • If messageType is document, the Link and FileName fields are required and the Caption field is invalid.

  • If messageType is interactive, the type and action fields are required.

  • If messageType is contacts, the name field is required.

  • If messageType is location, the longitude and latitude fields are required.

  • If messageType is sticker, the Link field is required, and the Caption and FileName fields are invalid.

  • If messageType is reaction, the messageId and emoji fields are required.

Notes on Messenger messages:

  • If messageType is text, the text field is required.

  • If messageType is image, video, audio, or document, the link field is required.

Notes on Instagram messages:

  • If messageType is text, the text field is required.

  • If messageType is image, video, or audio, the link field is required.

Notes on Viber messages:

  • If messageType is text, the text field is required.

  • If messageType is image, the link field is required.

  • If messageType is video, the link, thumbnail, fileSize, and duration fields are required.

  • If messageType is document, the link, fileName, and fileType fields are required.

  • If messageType is text_button, the text, caption, and action fields are required.

  • If messageType is text_image_button, the text, link, caption, and action fields are required.

  • If messageType is text_video, the text, link, thumbnail, fileSize, and duration fields are required.

  • If messageType is text_video_button, the text, link, thumbnail, fileSize, duration, and caption fields are required, and the action field cannot have a value.

{ "text": "hello,whatsapp", "link": "https://*******", "caption": "****", "fileName": "****" }

Payload

array

No

The list of payloads for the buttons.

payloadtext1,payloadtext2,payloadtext3

string

No

The payload for a button.

payloadtext

CustWabaIddeprecated

string

No

The WABA ID of the ISV customer. This parameter is deprecated. Use CustSpaceId, which is the instance ID for direct customers. You can view the ID on the Channel Management page.

cams-8c8*********

FallBackId

string

No

The fallback policy ID. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com). View the policy ID on the Fallback Policy page.

S0****

FallBackContent

string

No

The custom fallback content. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com).

Fallback SMS

IsvCodedeprecated

string

No

ISV verification code, used to verify if the user is authorized by an ISV. This parameter is deprecated.

123123******

CustSpaceId

string

No

The Space ID of the ISV sub-customer, or the instance ID for a direct customer. View it on the Channel Management page.

cams-8c8*********

ContextMessageId

string

No

The ID of the message to reply to. This refers to the ID of a message that has been sent or received.

61851ccb2f1365b16aee****

TrackingData

string

No

The custom tracking data for Viber messages. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com).

Tracking Data

Label

string

No

The Viber message type. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com).Valid values:

  • promotion: marketing messages.

  • transaction: notification messages.

promotion

Ttl

integer

No

The timeout period for sending a Viber message. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com). Unit: seconds. Valid values: 30 to 1209600.

50

Tag

string

No

A custom tag for a Viber message.

tag

TaskId

string

No

The custom task ID.

10000****

FallBackDuration

integer

No

The time to trigger a fallback. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com). If a delivery receipt is not returned within the specified time, a fallback is triggered. If you leave this parameter empty, the fallback is not determined by time. A fallback is triggered only when the message fails to be sent or a failed status report is received. Unit: seconds. Minimum value: 60. Maximum value: 43200.

120

ProductAction

object

No

The product information. This parameter is only for WhatsApp channels. It refers to the product information that you uploaded to Meta.

ThumbnailProductRetailerId

string

No

The product catalog ID. You can obtain it by calling the ListProductCatalog API.

skkks99****

Sections

array<object>

No

The list of product categories. You can have up to 10 categories and 30 products.

array<object>

No

A product category.

Title

string

No

The category name. You can view the name on the Channel Management > Manage > Catalog Management > Product Management page or obtain it by calling the ListProduct API.

abcd

ProductItems

array<object>

No

The list of product information.

object

No

The product information.

ProductRetailerId

string

No

The product ID. You can view the ID on the Channel Management > Manage > Catalog Management > Product Management page or obtain it by calling the ListProduct API.

ksi3****

FallBackRule

string

No

The fallback rule. This parameter is for the international site (alibabacloud.com). You can ignore it for the China site (aliyun.com).

Valid values:

  • undelivered: A fallback is triggered if the message cannot be delivered to the recipient. The template and parameters must be valid for the message to be sent. Scenarios such as a banned template or a blocked phone number are not checked. This is the default rule if the parameter is left empty.

  • sentFailed: A fallback is triggered if the message fails parameter validation for the template or template variables. Only the channelType, type, messageType, to, and from (existence) parameters are strictly validated.

undelivered

FlowAction

object

No

The Flow message object.

FlowToken

string

No

The custom flow token information.

kde****

FlowActionData

object

No

The collection of default flow parameters.

string

No

Default flow parameter as a Key-Value pair. The Key is the parameter name, and the Value is the parameter's value.

{ "name": "name" }

TemplateName

string

No

The template name. You can view the template name on the Channel Management > Manage > Template Design page.

test_name

Response elements

Element

Type

Description

Example

object

The returned data.

RequestId

string

The request ID.

90E63D28-E31D-1EB2-8939-A94866******

Code

string

The request status code.

  • A value of OK indicates that the request was successful.

  • For other error codes, see Error codes.

OK

Message

string

The error message.

User not authorized to operate on the specified resource.

MessageId

string

The message ID.

61851ccb2f1365b16aee****

Examples

Success response

JSON format

{
  "RequestId": "90E63D28-E31D-1EB2-8939-A94866******",
  "Code": "OK",
  "Message": "User not authorized to operate on the specified resource.",
  "MessageId": "61851ccb2f1365b16aee****"
}

Error codes

HTTP status code

Error code

Error message

Description

400

Product.Unsubscript

You have not subscribed to the specified product.

You have not subscribed to the specified product.

400

Ram.PermissionDeny

You are not authorized to perform the operation.

400

System.LimitControl

The system is under flow control.

The system is under flow control.

400

Unknown.ResourceOwnerId

The resource does not belong to the current user.

The resource does not belong to the current user.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.