TORM JSON模式
此頁面提供以下TORM富媒體元素的 JSON 模式:
- 清單選擇器
- 快速回覆
- 時間選取器
- 富連結
- 自適應卡片
這些是可在指令碼中使用的 TORM 元素。 您可以在SNIPPET動作中構建這些元素以傳送給聯絡人。 在使用元素之前,請先驗證您正在用來用於支援該元素的數位通道。
您可以使用Outbound API直接傳送這些元素。 此頁面上的 TORM 範例顯示傳出 API 的messageContent參數時要遵循的模式。
富連結
富連結是帶有圖像預覽和標題的URL,可以按下這些預覽和標題來打開URL。 TORM 富連結有一些基於通道的限制。
{
"type": "RICH_LINK",
"fallbackText": "Text sent if rich message is not available on external platform",
"payload": {
"media": {
"fileName": "place-kitten.jpg",
"url": "https://placekitten.com/200/300",
"mimeType": "image/jpeg"
},
"title": {
"content": "Check our new gadget!"
},
"url": "https://www.google.com"
}
}
清單選擇器
清單選取器是聯絡人可以從中選擇的選項清單。 這些選項通常以疊加的方式顯示,具有更豐富的格式化功能,例如圖示、標題和副標題。 清單選取器通常允許比快速回覆更多的選項。 聯絡人可以選擇多個選項,並且這些選項在對話中持續存在。 TORM 清單選取器有一些基於通道的限制。
{
"type": "LIST_PICKER",
"fallbackText": "Text sent if rich message is not available on external platform",
"payload": {
"title": {
"content": "Choose a color!"
},
"text": {
"content": "What is your favourite color?"
},
"actions": [
{
"type": "REPLY_BUTTON",
"icon": {
"fileName": "place-kitten.jpg",
"url": "https://placekitten.com/200/300",
"mimeType": "image/jpeg"
},
"text": "red",
"description": "Like a tomato",
"postback": "/red"
},
{
"type": "REPLY_BUTTON",
"icon": {
"fileName": "place-kitten.jpg",
"url": "https://placekitten.com/200/300",
"mimeType": "image/jpeg"
},
"text": "Green",
"description": "Like an apple",
"postback": "/green"
}
]
}
快速回覆
快速回覆是帶有按鈕的文字訊息。 聯絡人可以點擊其中一個按鈕。 點擊後,其內容將作為傳出傳送。 通常,當傳送回覆時,無法單擊其他按鈕。 TORM 快速回覆有一些基於通道的限制。
{
"type": "QUICK_REPLIES",
"fallbackText": "Text sent if rich message is not available on external platform",
"payload": {
"text": {
"content": "Hello, we will deliver the package between 12:00 and 16:00. Please specify which day."
},
"actions": [
{
"type": "REPLY_BUTTON",
"text": "Today",
"postback": "{\"id\":\"1\"}"
},
{
"type": "REPLY_BUTTON",
"text": "Tomorrow",
"postback": "{\"id\":\"2\"}"
}
]
}
}
時間選取器
時間選取器允許您為聯絡人提供時間選擇,例如安排約會。 TORM 時間選擇器有一些基於通道的限制。
{
"type": "TIME_PICKER",
"fallbackText": "Text sent if rich message is not available on external platform",
"payload": {
"title": {
"content": "Check our new gadget!"
},
"timeSlots": [
{
"id": "unique-id",
"duration": 3600,
"startTime": "2017-05-26T08:27:55+00:00"
}
],
"location": {
"title": {
"content": "Check our new gadget!"
},
"latitude": 44.44,
"longitude": 55.55,
"radius": 33.3
}
}
}
Adaptive Card
Adaptive Cards是由Microsoft開發的一種獨立於平台的發送富媒體的方法。 Adaptive Cards僅在數位 任何與Digital Experience相關的通道、聯絡或技能。聊天頻道
促進客戶在聯絡中心互動的各種語音和數位通訊媒介。上受支援。
{
"type": "ADAPTIVE_CARD",
"fallbackText": "Url sent: https://placekitten.com",
"payload": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [{
"type": "Image",
"url": "https://placekitten.com/200/300",
"spacing": "none",
"size": "stretch"
}],
"actions": [{
"type": "Action.OpenUrl",
"title": "Show me the cats!",
"url": "https://placekitten.com"
}]
}
}