全部产品
Search
文档中心

Chat App 消息服务:使用Chat App发送Viber消息

更新时间:Jan 16, 2025

接口说明

本接口的单用户 QPS 限制为 250 次/秒。超过限制,API 调用会被限流,这可能会影响您的业务,请合理调用。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称

类型

必填

描述

示例值

ChannelType

string

类型。

  • viber

viber

Type

string

消息类型。取值:

  • template:在控制台已被审核通过的消息模板,可以在任意时间发送。

  • message:任意格式的消息。

template

MessageType

string

当 Type 为 message 时,指定消息的详细类型。

  • text,文本消息。

  • image,图片消息。

  • video, 视频消息。

  • document, 文件消息。

  • text_button, 文本+按钮消息。

  • text_image_button, 文本+图片+按钮消息。

  • text_video, 文本+视频消息。

  • text_video_button, 文本+视频+按钮消息。

  • text_image, 文本+图片消息。

text

TemplateCode

string

模板 Code。Type 为 template 时此字段必填。

744c4b5c79c9432497a075bdfca3****

Language

string

模板语言。

Type 为template时此字段必填,详细语言代码列表,请参见语言代码

en

From

string

消息发送方号码。

说明

支持通过阿里云注册的Viber商家号码

2***9

To

string

消息接收方号码。

861390000****

TemplateParams

object

消息模板变量。

string

消息模板变量对应的实际值,参数格式为 JSON 格式。如果模板中存在变量,该参数为必填项。

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

Content

string

消息内容。

  • messageTypetext 时,text 字段必填

  • messageTypeimage 时,link 字段必填

  • messageTypevideo 时,link, thumbnail, fileSize, duration 字段必填

  • messageTypedocument 时,link, fileName, fileType 字段为必填

  • messageTypetext_button时,text, caption, action 字段为必填

  • messageTypetext_image_button时,text, link, caption, action 字段为必填

  • messageTypetext_video时,text, link, thumbnail, fileSize, duration 字段为必填

  • messageTypetext_video_button时,text, link, thumbnail, fileSize, duration, caption 字段为必填,action 字段不能为值

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

FallBackId

string

失败回落策略 ID。可以在控制台创建相关策略并查看。

S_000001

FallBackContent

string

失败回落消息内容。

This is a fallback message.

CustSpaceId

string

子账户空间 ID。

28251486512358****

TrackingData

string

Viber 消息跟踪数据值。

tracking_id:123456

Label

string

Viber 消息类型,当 ChannelType=viber时为必填,取值:promotion 或 transaction。

promotion

Ttl

integer

Viber 消息发送超时时间,单位:秒,取值范围 30~1209600。

50

Tag

string

Viber消息发送时tag信息。

tag

TaskId

string

任务 ID

100000001

FallBackDuration

integer

消息在指定时间内没有返回已到达回执时回落,时间单位为秒,最小值为 60,最大值 43200。

不填代表不根据此时间判断回落,仅发送失败有失败的状态报告时才会回落。

120

FallBackRule

string

回落规则。

说明

取值范围

  • undelivered 消息不能发送到端时回落(在发送状态时模板、参数需要校验通过,模板被封、号码被封等不做校验)。参数值为空时默认使用此规则

  • sentFailed 消息在校验模板、模板变量等参数时,校验不通过也会回落。只会强校验 channelType、type、messageType、 to、 from(是否存在)几个参数。

undelivered

返回参数

名称

类型

描述

示例值

object

返回数据。

RequestId

string

请求 ID。

90E63D28-E31D-1EB2-8939-A94866411B2O

Code

string

请求状态码。

  • 返回 OK 代表请求成功。

  • 其他错误码,请参见API错误码

OK

Message

string

错误提示信息。

User not authorized to operate on the specified resource.

MessageId

string

消息 ID。

61851ccb2f1365b16aee****

示例

正常返回示例

JSON格式

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

错误码

HTTP status code

错误码

错误信息

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.

访问错误中心查看更多错误码。