All Products
Search
Document Center

Chat App Message Service:Send Viber messages

Last Updated:Jan 20, 2025

API description

You can call SendChatappMessage to send Viber messages.

You can call this operation up to 250 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 call this operation in OpenAPI Explorer. OpenAPI Explorer automatically calculates the signature value and dynamically generates the sample code of the operation for different SDKs.

Authorization information

No authorization information is disclosed in this API.

Request parameters

Parameter

Type

Required

Description

Example

ChannelType

string

Yes

The type of the channel. Set the parameter to viber.

viber

Type

string

Yes

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 at any time.

  • message: the custom message.

template

MessageType

string

No

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

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

text

TemplateCode

string

No

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

744c4b5c79c9432497a075bdfca3****

Language

string

No

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

From

string

Yes

The mobile phone number of the message sender.

Note

You must specify a mobile phone number that is registered for a WhatsApp account and is approved in the Chat App Message Service console.

2***9

To

string

Yes

The mobile phone number of the message receiver.

861390000****

TemplateParams

object

No

The variables of the message template.

string

No

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

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

Content

string

No

The message content.

  • 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 linkthumbnailfileSize, and duration.

  • If you set messageType to document, you must specify linkfileName, and fileType.

  • If you set messageType to text_button, you must specify textcaption, and action.

  • If you set messageType to text_image_button, you must specify textlinkcaption, and action.

  • If you set messageType to text_video, you must specify textlinkthumbnailfileSize, and duration.

  • If you set messageType to text_video_button, you must specify textlinkthumbnailfileSizeduration, and caption. In addition, you must not specify action.

{"text": "hello whatsapp", "link": "", "caption": "", "fileName": "" }

FallBackId

string

No

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

FallBackContent

string

No

The content of the fallback message.

This is a fallback message.

CustSpaceId

string

No

The space ID of the RAM user.

28251486512358****

TrackingData

string

No

The tracking data of the Viber message.

tracking_id:123456

Label

string

Yes

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

  • promotion

  • transaction

promotion

Ttl

integer

No

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

50

Tag

string

No

The tag information of the Viber message.

tag

TaskId

string

No

The task ID

100000001

FallBackDuration

integer

No

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

FallBackRule

string

No

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

Response parameters

Parameter

Type

Description

Example

object

The returned data.

RequestId

string

The ID of the request.

90E63D28-E31D-1EB2-8939-A94866411B2O

Code

string

The status code returned.

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

  • Other values indicate that the request fails. For more information, see Error codes.

OK

Message

string

The error message returned.

User not authorized to operate on the specified resource.

MessageId

string

The ID of the message that was sent.

61851ccb2f1365b16aee****

Examples

Sample success responses

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

400

Product.Unsubscript

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.

400

Unknown.ResourceOwnerId

The resource does not belong to the current user.

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