All Products
Search
Document Center

Chat App Message Service:Create a Viber message template

Last Updated:Feb 26, 2025

Description

You can call this operation up to 50 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this 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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Authorization

The following table shows the authorization information corresponding to the API operation. 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.

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

  • The required resource types are highlighted.

  • 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 keys that are defined by the Alibaba 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.

Operation

Access level

Resource type

Condition key

Associated operation

cams:CreateChatappTemplate

Write

  • All Resources*

None

None

Request parameters

Parameter

Type

Required

Description

Example

Category

String

Yes

The category of the Viber template. Valid values:

  • text: Plain text

  • image: Plain image

  • text_image_button: Text + Image + Button

  • text_button: Text + Button

  • document: Document

  • video: Video

  • text_video: Text + Video

  • text_video_button: Text + Video + Button

  • text_image: Text + Image

text

Components

Object

Yes

The components of the message template.

Type

String

Yes

The component type. Valid values:

  • BODY

  • HEADER

  • BUTTONS

Note

In Viber type templates, images, videos, and documents are placed in the HEADER (the client displays the image below the text).

BODY

Text

String

No

The text of the message that you want to send.

hello

Format

String

No

The type of the media resource. Valid values:

  • TEXT

  • IMAGE

  • DOCUMENT

  • VIDEO

TEXT

Url

String

No

The URL of the media resource.

Note

We recommend that you use images of 800 × 800 pixels in Viber message templates.

https://image.developer.aliyundoc.com

FileName

String

No

The name of the document.

Package video

Buttons

Object

No

The buttons. You can specify this parameter only if you set the Type sub-parameter of the Components parameter to BUTTONS.

Type

String

Yes

The button type. Valid value:

  • URL: URL button

Note

You can add only one URL button.

URL

Text

String

No

The display name of the button.

Click

Url

String

No

The URL to be accessed when the URL button is tapped.

https://example.com

UrlType

String

No

The URL type. Valid values:

  • static

  • dynamic

static

ThumbUrl

String

No

The thumbnail URL of the video in the Viber message template.

https://cdn.multiplymall.mobiapp.cloud/yunmall/B-L202207130001/20220730/d77ea60983.png?x-process=image/resize,w_100

Duration

Integer

No

The length of the video in the Viber message template. Valid values: 0 to 600. Unit: seconds.

120

FileType

String

No

The type of the document attached in the Viber message template.

docx

Name

String

Yes

The name of the message template.

hello_world

Language

String

Yes

The language that is used in the message template. For more information, see Language codes.

en

Example

Object

No

The template example.

String

No

The sample variables. This parameter is passed in by converting its original JSON structure into a string.

{"textVariable":"text"}

TemplateType

String

Yes

The type of the message template. valid value:

  • VIBER

VIBER

CustSpaceId

String

No

The space ID of the user within the independent software vendor (ISV) account.

293483938849493

Response parameters

Parameter

Type

Description

Example

-

Object

The returned result.

-

RequestId

String

The request ID.

90E63D28-E31D-1EB2-8939-A94866411B2D

Code

String

The response code.

  • The value OK indicates that the request was successful.

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

OK

Message

String

The error message.

User not authorized to operate on the specified resource.

Data

Object

The returned result.

-

TemplateCode

String

The template code.

SMS_232907****

TemplateName

String

The name of the message template.

hello_world

AccessDeniedDetail

String

The details about the access denial.

-

Examples

Sample success response

JSON format

{
  "RequestId": "90E63D28-E31D-1EB2-8939-A94866******",
  "Code": "OK",
  "Message": "User not authorized to operate on the specified resource.",
  "Data": {
    "TemplateCode": "MSG_232907****",
    "TemplateName": "hello_world"
  },
  "AccessDeniedDetail": "None"
}

Error codes

HTTP status code

Error code

Description

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, see Service error codes.