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
   }
 }
}

自適應卡

允許您傳送自適應卡。僅在數位Closed 任何與Digital Experience相關的通道、聯絡或技能。聊天通道Closed 聯絡人與客服專員或機器人互動的方式。通道可以是語音、電郵、聊天、社交媒體等等。中支援自適應卡。

{
"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"
  }]   
 }
}