All Products
Search
Document Center

ChatApp Message Service:SendChatappMessage

Last Updated:Mar 20, 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ChannelTypestringYes

The type of the message channel. Valid values:

  • whatsapp
  • viber
  • line. The feature that ChatAPP sends messages by using Line is under development.
whatsapp
TypestringYes

The type of the message. Valid values:

  • template: a template message. A template message is sent based on a template that is created in the ChatAPP console and is approved. You can send template messages at any time based on your business requirements.
  • message: a custom message. You can send a custom message to a user only within 24 hours after you receive the last message from the user.
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 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 ChatAPP console.
1360000****
TostringYes

The phone number that receives the message.

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 content of the message.

Usage notes when you set the ChannelType parameter to whatsapp:

  • When you set the MessageType parameter to text, the text parameter is required and the caption parameter cannot be specified.
  • When you set the MessageType parameter to image, the link parameter is required.
  • When you set the MessageType parameter to video, the link parameter is required.
  • When you set the MessageType parameter to audio, the link parameter is required and the caption parameter is invalid.
  • When you set the MessageType parameter to document, the link and fileName parameters are required and the caption parameter is invalid.
  • When you set the MessageType parameter to interactive, the type and action parameters are required.
  • When you set the MessageType parameter to contacts, the name parameter is required.
  • When you set the MessageType parameter to location, the longitude and latitude parameters are required.
  • When you set the MessageType parameter to sticker, the link parameter is required, and the caption and fileName parameters are invalid.
  • When you set the MessageType parameter to reaction, the messageId and emoji parameters are required.

Usage notes when you set the ChannelType parameter to viber:

  • When you set the MessageType parameter to text, the text parameter is required.
  • When you set the MessageType parameter to image, the link parameter is required.
  • When you set the MessageType parameter to video, the link, thumbnail, fileSize, and duration parameters are required.
  • When you set the MessageType parameter to document, the link, fileName, and fileType parameters are required.
  • When you set the MessageType parameter to text_button, the text, caption, and action parameters are required.
  • When you set the MessageType parameter to text_image_button, the text, link, caption, and action parameters are required.
  • When you set the MessageType parameter to text_video, the text, link, thumbnail, fileSize, and duration parameters are required.
  • When you set the MessageType parameter to text_video_button, the text, link, thumbnail, fileSize, duration, and caption parameters are required. The action parameter is invalid.
{\"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 ID of the WhatsApp account that you register.

65921621816****
FallBackIdstringNo

The ID of the fallback strategy. You can create a fallback strategy and view the information in the console.

S_000001
FallBackContentstringNo

The content of the fallback message.

This is a fallback message.
IsvCodestringNo

The independent software vendor (ISV) verification code, which is used to verify whether the user is authorized by the ISV account.

skdi3kksloslikdkkdk
CustSpaceIdstringNo

The space ID of the user.

28251486512358****
ContextMessageIdstringNo

The ID of the message to reply to.

61851ccb2f1365b16aee****
TrackingDatastringNo

The tracking ID of the Viber message.

tracking_id:123456
LabelstringNo

The type of the Viber message. This parameter is required if you set the ChannelType parameter to viber. Valid values: promotion and 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 ID of the task.

100000001
FallBackDurationintegerNo

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

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
Sectionsobject []No

The products. Up to 30 products can be added. The products can be divided into up to 10 categories.

TitlestringNo

The name of the category.

Test
ProductItemsobject []No

The products.

ProductRetailerIdstringNo

The retailer ID of the product.

9I39E9E

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-03-14The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
2023-11-21The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: FlowAction
2023-09-21The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: FallBackRule
2023-08-01The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ProductAction
2023-04-13The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: FallBackDuration
2023-03-02The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: TaskId
2022-09-20The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: IsvCode
2022-07-15The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: FallBackId
    Added Input Parameters: FallBackContent