All Products
Search
Document Center

Chat App Message Service:SendChatappMessage

Last Updated:Nov 18, 2024

Sends messages by using ChatAPP.

Operation description

You can call this operation up to 200 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cams:SendChatappMessagecreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ChannelTypestringYes

The channel type. Valid values:

  • whatsapp
  • viber
  • line (under development)
whatsapp
TypestringYes

The message type. Valid values:

  • template: the template message. A template message is sent based on a template that is created and approved in the Chat App Message Service console. You can send template messages based on your business requirements.
  • message: the custom message. You can send a custom WhatsApp message to a user only within 24 hours after you receive the last message from the user. This limit does not apply to custom Viber messages.
template
MessageTypestringNo

The specific type of the message. This parameter is required only if you set the Type parameter to message.

Valid values of MessageType when you set the ChannelType parameter to whatsapp:

  • text: a text message.
  • image: an image message.
  • video: a video message.
  • audio: an audio message.
  • document: a document message.
  • interactive: an interactive message.
  • contacts: a contact message.
  • location: a location message.
  • sticker: a sticker message.
  • reaction: a reaction message.

Valid values of MessageType when you set the ChannelType parameter to viber:

  • text: a text message.
  • image: an image message.
  • video: a video message.
  • document: a document message.
  • text_button: a message that contains the text and button media objects.
  • text_image_button: a message that contains multiple media objects, including the text, image, and button.
  • text_video: a message that contains the text and video media objects.
  • text_video_button: a message that contains multiple media objects, including text, video, and button.
  • text_image: a message that contains the text and image media objects.
Note For more information, see Parameters of a message template.
text
TemplateCodestringNo

The code of the message template. This parameter is required only if you set the Type parameter to template.

744c4b5c79c9432497a075bdfca3****
LanguagestringNo

The language that is used in the message template. This parameter is required only if you set the Type parameter to template. For more information about language codes, see Language codes.

en
FromstringYes

The mobile phone number of the message sender.

Note You can specify a mobile phone number that is registered for a WhatsApp account and is approved in the Chat App Message Service console.
1360000****
TostringYes

The mobile phone number of the message receiver.

1390000****
TemplateParamsobjectNo

The variables of the message template.

stringNo

The values of the variables that are included in the message template. The values must be in the JSON format. If a variable exists in the template, this parameter is required.

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

The message content.

Notes on WhatsApp messages:

  • If you set messageType to text, you must specify text and must not specify Caption.
  • If you set messageType to image, you must specify Link.
  • If you set messageType to video, you must specify Link.
  • If you set messageType to audio, Link is required and Caption is invalid.
  • If you set messageType to document, Link and FileName are required and Caption is invalid.
  • If you set messageType to interactive, you must specify type and action.
  • If you set messageType to contacts, you must specify name.
  • If you set messageType to location, you must specify longitude and latitude.
  • If you set messageType to sticker, you must specify Link, and Caption and FileName are invalid.
  • If you set messageType to reaction, you must specify messageId and emoji.

Notes on Viber messages:

  • If you set messageType to text, you must specify text.
  • If you set messageType to image, you must specify link.
  • If you set messageType to video, you must specify link, thumbnail, fileSize, and duration.
  • If you set messageType to document, you must specify link, fileName, and fileType.
  • If you set messageType to text_button, you must specify text, caption, and action.
  • If you set messageType to text_image_button, you must specify text, link, caption, and action.
  • If you set messageType to text_video, you must specify text, link, thumbnail, fileSize, and duration.
  • If you set messageType to text_video_button, you must specify text, link, thumbnail, fileSize, duration, and caption. In addition, you must not specify action.
{\"text\": \"hello whatsapp\", \"link\": \"\", \"caption\": \"\", \"fileName\": \"\" }
PayloadarrayNo

The payload of the button.

stringNo

The payload of the button in the message template.

payloadtext1,payloadtext2,payloadtext3
CustWabaIddeprecatedstringNo

The WhatsApp Business Account (WABA) ID of the RAM user within the independent software vendor (ISV) account.

Note CustWabaId is an obsolete parameter. Use CustSpaceId instead.
65921621816****
FallBackIdstringNo

The ID of the fallback policy. You can create a fallback policy and view the information in the Chat App Message Service console.

S_000001
FallBackContentstringNo

The content of the fallback message.

This is a fallback message.
IsvCodestringNo

The ISV verification code. This parameter is used to verify whether the RAM user is authorized by the ISV account.

skdi3kksloslikdkkdk
CustSpaceIdstringNo

The space ID of the user.

28251486512358****
ContextMessageIdstringNo

The ID of the reply message.

61851ccb2f1365b16aee****
TrackingDatastringNo

The tracking data of the Viber message.

tracking_id:123456
LabelstringNo

The type of the Viber message. This parameter is required if ChannelType is set to viber. Valid values:

  • promotion
  • transaction
promotion
TtlintegerNo

The timeout period for sending the Viber message. Valid values: 30 to 1209600. Unit: seconds.

50
TagstringNo

The tag information of the Viber message.

tag
TaskIdstringNo

The task ID.

100000001
FallBackDurationintegerNo

Specifies the period of time after which the fallback message is sent if the message receipt that indicates the message is delivered to clients is not received. If this parameter is left empty, the fallback message is sent only when the message fails to be sent or the message receipt that indicates the message is not delivered to clients is received. Unit: seconds. Valid values: 60 to 43200.

120
ProductActionobjectNo

The information about the products included in the WhatsApp catalog message or multi-product message (MPM).

ThumbnailProductRetailerIdstringNo

The retailer ID of the product.

S238SK
Sectionsarray<object>No

The products. Up to 30 products and 10 categories can be added.

objectNo

The category of the product.

TitlestringNo

The name of the category.

Test
ProductItemsarray<object>No

The products.

objectNo

The product information.

ProductRetailerIdstringNo

The retailer ID of the product.

9I39E9E
FallBackRulestringNo

The fallback rule. Valid values:

  • undelivered: A fallback is triggered if the message is not delivered to clients. When the message is being sent, the template parameters are verified. If the parameters fail to pass the verification, the message fails to be sent. Whether the template and phone number are prohibited is not verified. By default, this value is used when FallBackRule is left empty.
  • sentFailed: A fallback is triggered even if the template parameters including variables fail to pass the verification. If the channelType, type, messageType, to, and from parameters fail to pass the verification, a fallback is not triggered.
undelivered
FlowActionobjectNo

The Flow action.

FlowTokenstringNo

The Flow token.

1122***
FlowActionDataobjectNo

The default parameter of the Flow.

stringNo

The default parameter of the Flow.

{"name":"test"}
TemplateNamestringNo

The name of the message template.

test_name

Response parameters

ParameterTypeDescriptionExample
object

The data returned.

RequestIdstring

The ID of the request.

90E63D28-E31D-1EB2-8939-A94866411B2O
Codestring

The HTTP status code returned.

  • A value of OK indicates that the call is successful.
  • Other values indicate that the call fails. For more information, see Error codes.
OK
Messagestring

The error message returned.

User not authorized to operate on the specified resource.
MessageIdstring

The ID of the message that was sent.

61851ccb2f1365b16aee****

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError message
400Product.UnsubscriptYou have not subscribed to the specified product.
400Ram.PermissionDenyYou are not authorized to perform the operation.
400System.LimitControlThe system is under flow control.
400Unknown.ResourceOwnerIdThe resource does not belong to the current user.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-04-10The Error code has changed. The request parameters of the API has changedView Change Details
2024-03-14The Error code has changedView Change Details
2023-11-21The Error code has changed. The request parameters of the API has changedView Change Details
2023-09-21The Error code has changed. The request parameters of the API has changedView Change Details
2023-08-01The Error code has changed. The request parameters of the API has changedView Change Details
2023-04-13The Error code has changed. The request parameters of the API has changedView Change Details
2023-03-02The Error code has changed. The request parameters of the API has changedView Change Details
2022-09-20The Error code has changed. The request parameters of the API has changedView Change Details
2022-07-15The Error code has changed. The request parameters of the API has changedView Change Details