Template Creation
Request API domain
- https://api.incsapp.com
Request API route
- /external/templates/rcs
Request method
- POST
Request headers
- Content-Type: application/json
- certification-code: f484bd42-4a0c-39d....
Request parameters
| Parameter | Type | Mandatory | Description | Remarks |
|---|---|---|---|---|
| name | string | Yes | Template name. Max length 25 and should contain only alphanumeric chars, underscore. | e.g: test_template |
| type | string | Yes | Template type. Must be one of text, richcard, or carousel. See: Template Type. | e.g: text |
| category | string | Yes | Categorization of message content. See: Template Category | e.g: TRANSACTION |
| content | object | Yes | Template content. See: Template Content |
Template Type
Supported types of templates are:
- Text Message - The Text Message template supports simple text messages with suggested replies or actions. Text messages can contain up to 11 suggestions.
- Rich Card standalone - The Rich Card Stand-alone template allows for the inclusion of a rich card: image, gif or video along with suggested replies and actions. A maximum of 4 suggestions can be included with the rich card in this template.
- Rich Card carousel - The Rich Card Carousel template supports carousels with a minimum of two rich cards, with each featuring suggested replies and actions. the Rich Card Carousel template allows you to present up to 10 cards in the carousel with each card having up to 4 suggestions.
Template Category
Mandatory for multi-use agents. Allowed values:
- PROMOTION – default for promotional agents.
- TRANSACTION – default for transactional agents.
- AUTHENTICATION – default for OTP agents.
Template Content
1. Text Message Template (text)
-
content payload
Parameter Type Mandatory Description Remarks textMessage string Yes Template message with custom variables. Custom variables are mentioned in square brackets [variable_name]. Max length 2500. e.g: Dear [name], it is time to grab a big deal. suggestions array No Object with suggestions related data. See: Suggestion Types -
Sample Request
{
"name": "test_template",
"type": "text",
"content": {
"textMessage": "Dear [name], your order [order_id] has been shipped.",
"suggestions": [
{
"suggestionType": "reply",
"text": "Track Order",
"postbackData": "track_order_[order_id]"
},
{
"suggestionType": "url_action",
"text": "View Details",
"postbackData": "view_details",
"url": "https://brand.com/orders/[order_id]"
}
]
}
}
2. Rich Card Standalone (richcard)
- content payload
Parameter Type Mandatory Description Remarks orientation string Yes Card orientation (VERTICAL/HORIZONTAL) e.g VERTICAL alignment string No In case of HORIZONTAL orientation alignment should be (LEFT,RIGHT) e.g: LEFT height string No Applicable only for VERTICAL orientation.Card Height (SHORT,MEDIUM) e.g MEDIUM standaloneCard object Yes Rich card Object with below details - standaloneCard details
Parameter Type Mandatory Description Remarks cardTitle string Yes Card title. Max length 200 including variables if any. cardDescription string No Card description. Max length 2000 including variables if any. mediaUrl string Yes Valid publicly accessible URL. Max length 2048. Custom variables are allowed post domain/public IP only. Refer guidelines for accepted size/aspect ratio Eg. https://brand.com/final.mp4 Eg. https://brand.com/[media] thumbnailUrl string No Valid publicly accessible URL.Custom variables are not allowed. Max length 2048. Eg. https://brand.com/final.jpeg suggestions array No Object with suggestions related data See: Suggestion Types - Sample Request
{
"name": "promo_richcard_url",
"type": "richcard",
"content": {
"orientation": "VERTICAL",
"height": "SHORT",
"standaloneCard": {
"cardTitle": "Keep calm & BAT on!",
"cardDescription": "Dear [name], time to participate in lucky draw and win prizes",
"mediaUrl": "https://brand.com/Ad.mp4",
"thumbnailUrl": "https://brand.com/Ad_snap.png",
"suggestions": [
{
"suggestionType": "reply",
"text": "Avail offer [offer_name]",
"postbackData": "offer_reply"
}
]
}
}
}
3. Rich Card Carousel (carousel)
-
content payload
Parameter Type Mandatory Description Remarks width string Yes Card width (SMALL/MEDIUM) e.g: SHORT height string Yes Card height (SHORT/MEDIUM) e.g: MEDIUM carouselCard array Yes Carousel List Object with below details -
carouselCard details
Parameter Type Mandatory Description Remarks cardTitle string Yes Card title. Max length 200 including variables if any. cardDescription string No Card description. Max length 2000 including variables if any mediaUrl string Yes Valid publicly accessible URL. Max length 2048. Custom variables are allowed post domain/public IP only. Refer guidelines for accepted size/aspect ratio Eg. https://brand.com/final.mp4 Eg. https://brand.com/[media] thumbnailUrl string No Valid publicly accessible URL.Custom variables are not allowed. Max length 2048. Eg. https://brand.com/final.jpeg suggestions array No Object with suggestions related data See: Suggestion Types -
Sample Request
{
"name": "test_carousel",
"type": "carousel",
"content": {
"height": "SHORT",
"width": "MEDIUM",
"carouselCard": [
{
"cardTitle": "New watches",
"cardDescription": "Dear [name] brand new watches for less price",
"mediaUrl": "https://brand.com/media/watches.mp4",
"thumbnailUrl": "https://brand.com/media/watches.jpeg",
"suggestions": [
{
"suggestionType": "url_action",
"url": "https://brand.com/",
"text": "Buy Now at [offer_name]",
"postbackData": "shop_url"
}
]
},
{
"cardTitle": "New perfumes",
"cardDescription": "Dear [name], Choose from brand new perfumes.",
"mediaUrl": "https://brand.com/media/[image]",
"suggestions": [
{
"suggestionType": "dialer_action",
"phoneNumber": "+919702012345",
"text": "Call now to avail[offer_name]",
"postbackData": "call_click"
}
]
}
]
}
}
Suggestion Types
This section is to describe details about different types of suggestions and their formats
- The below two fields are common in all suggestions.:
Parameter Type Mandatory Description Remarks text string Yes Suggestion text. Max length is 25 including variables if any. postbackData string Yes Suggestion postback data Max length is 120 including variables if any.
1. 回复建议
用于简单的快速回复按钮。
{
"suggestionType": "reply",
"text": "Yes",
"postbackData": "user_confirmed_yes"
}
2. URL 动作 - 浏览器
在浏览器中打开 URL。
| 参数 | 必填 | 描述 |
|---|---|---|
| suggestionType | 是 | 设置为 "url_action" |
| url | 是 | 要打开的有效公共 URL |
{
"suggestionType": "url_action",
"text": "Visit Website",
"postbackData": "visit_website",
"url": "https://brand.com"
}
3. 拨号动作
拨打电话号码。
| 参数 | 必填 | 描述 |
|---|---|---|
| suggestionType | 是 | 设置为 "dialer_action" |
| phoneNumber | 是 | 国际格式的有效电话号码 |
{
"suggestionType": "dialer_action",
"text": "Call Us",
"postbackData": "call_support",
"phoneNumber": "+6281234567890"
}
4. 查看位置
在地图中显示特定位置。
| 参数 | 必填 | 描述 |
|---|---|---|
| suggestionType | 是 | 设置为 "view_location" |
| latitude | 是 | 纬度 |
| longitude | 是 | 经度 |
| label | 否 | 位置标签 |
{
"suggestionType": "view_location",
"text": "View Store",
"postbackData": "view_store_location",
"latitude": -6.2088,
"longitude": 106.8456,
"label": "Brand Store Jakarta"
}
5. 查询位置
搜索附近的位置。
| 参数 | 必填 | 描述 |
|---|---|---|
| suggestionType | 是 | 设置为 "query_location" |
| query | 是 | 搜索查询字符串 |
{
"suggestionType": "query_location",
"text": "Find Nearby",
"postbackData": "find_nearby_stores",
"query": "Brand Store near me"
}
6. 分享位置
请求用户分享其当前位置。
{
"suggestionType": "share_location",
"text": "Share Location",
"postbackData": "user_shared_location"
}
7. 日历事件
在用户日历中创建事件。
| 参数 | 必填 | 描述 |
|---|---|---|
| suggestionType | 是 | 设置为 "calendar_event" |
| title | 是 | 事件标题 |
| description | 否 | 事件描述 |
| startTime | 是 | 开始时间(YYYY-MM-DD HH:mm:ss 格式) |
| endTime | 是 | 结束时间(YYYY-MM-DD HH:mm:ss 格式) |
{
"suggestionType": "calendar_event",
"text": "Add to Calendar",
"postbackData": "add_event",
"title": "Product Launch Event",
"description": "Join us for the exciting product launch",
"startTime": "2024-04-23 10:33:11",
"endTime": "2024-04-23 18:33:11"
}
8. URL 动作 - WebView
在应用内 WebView 中打开 URL。
| 参数 | 必填 | 描述 |
|---|---|---|
| suggestionType | 是 | 设置为 "url_action" |
| application | 是 | 设置为 "WEBVIEW" |
| webviewViewMode | 否 | 视图模式:FULL、HALF、TALL |
| url | 是 | 要在 WebView 中打开的 URL |
| description | 否 | WebView 的可访问性描述 |
{
"suggestionType": "url_action",
"text": "Open Form",
"postbackData": "open_webview_form",
"application": "WEBVIEW",
"url": "https://brand.com/form",
"webviewViewMode": "FULL",
"description": "Registration form"
}
媒体指南
富媒体卡片和富媒体卡片轮播中的媒体应遵循以下指南。
图片:
| 消息类型 | 卡片方向 | 卡片高度 | 卡片宽度 | 图片宽高比 | 图片最佳分辨率(px) | 图片最大文件大小 | 支持的图片格式 |
|---|---|---|---|---|---|---|---|
| 富媒体卡片 | VERTICAL | SHORT | - | 3:1 | 1440×480 | 2MB | JPEG, JPG, PNG, GIF |
| VERTICAL | MEDIUM | - | 2:1 | 1440×720 | |||
| HORIZONTAL | - | - | 3:4 | 768×1024 | |||
| 轮播 | NA | SHORT | SMALL | 8:5 | 1160×720 | 1MB | |
| SHORT | MEDIUM | 5:2 | 1840×720 | ||||
| MEDIUM | SMALL | 1:1 | 770×720 | ||||
| MEDIUM | MEDIUM | 16:9 | 1280×720 |
视频和缩略图:
| 消息类型 | 卡片方向 | 卡片高度 | 卡片宽度 | 视频最大文件大小 | 支持的视频格式 | 缩略图宽高比 | 缩略图最佳分辨率(px) | 缩略图文件大小 | 支持的缩略图格式 |
|---|---|---|---|---|---|---|---|---|---|
| 富媒体卡片 | VERTICAL | SHORT | - | 10MB | MP4, M4V, MPEG, WEBM, H263, M4P | 3:1 | 770×257 | 最小: 40KB, 最大: 100KB | JPEG, JPG, PNG |
| VERTICAL | MEDIUM | - | 7:3 | 770×335 | |||||
| HORIZONTAL | - | - | 25:33 | 250×330 | |||||
| 轮播 | NA | SHORT | SMALL | 5MB | 8:5 | 718×448 | |||
| SHORT | MEDIUM | 5:2 | 1140×448 | ||||||
| MEDIUM | SMALL | 1:1 | 480×448 | ||||||
| MEDIUM | MEDIUM | 16:9 | 796×448 |
在富媒体卡片消息中使用图片/视频时,请参考 Google 最佳实践(富媒体卡片部分)
响应
成功响应示例
{
"status": "success",
"code": 200,
"message": "",
"data": {
"template_id": "2217676094281515152",
"name": "api_5_text",
"type": "text",
"status": "PENDING",
"content": {
"textMessage": "Dear [name], time to use rcs api",
"suggestions": [
{
"suggestionType": "reply",
"text": "Join us",
"postbackData": "click_reply"
}
]
},
"created_time": 1767609428,
"updated_time": 1767609428,
"status_updated_time": 0
},
"error": {}
}
模板状态说明:
获取模板状态请需要回调设置
| 状态 | 描述 |
|---|---|
| PENDING | 模板正在等待审核 |
| APPROVED | 模板已批准,可以使用 |
| REJECTED | 模板已被拒绝 |
| DISABLED | 模板已被禁用 |
| ENABLED | 模板已从禁用或暂停状态重新激活 |
| SUSPENDED | 模板已被暂停 |
失败响应示例
{
"status": "error",
"code": 400,
"message": "type require",
"data": {},
"error": {}
}