支援的訊息格式

1.1 輪播訊息 Gallery

用於傳送可水平捲動的輪播項目,每個項目都由圖像、簡短說明及按鈕所組成,可搭配快速回覆選單。
For sending a carousel-like message. Each carousel item has an image, short description, and buttons. QuickReplies are optional.
1
{
2
"type": "gallery",
3
"cards": [
4
{
5
"title": "title1",
6
"subtitle": "subtitle1",
7
"imageUrl": "https://i.imgur.com/hAGm4iF.jpg"
8
},
9
{
10
"title": "title2",
11
"subtitle": "subtitle2",
12
"imageUrl": "https://i.imgur.com/hAGm4iF.jpg",
13
"buttons": [
14
{
15
"title": "btn1",
16
"type": "postback",
17
"value": "module-ry49xXQU2"
18
},
19
{
20
"title": "btn2",
21
"type": "web_url",
22
"value": "http://google.com"
23
}
24
]
25
}
26
],
27
"quickReplies": [
28
{
29
"payload": "module-HkI2FKv84e",
30
"title": "know more about Bonnie",
31
"type": "text"
32
}
33
]
34
}
Copied!

1.2 圖像訊息 Image

由單張圖像組成,支援的格式為 jpg、png 和 gif,可搭配快速回覆選單。(不支援按鈕)
Single image message. (buttons are not supported)
Image format: jpg, png, gif
QuickReplies are optional.
1
{
2
"type": "image",
3
"imageUrl": "https://i.imgur.com/hAGm4iF.jpg",
4
"quickReplies": [
5
{
6
"payload": "module-Sk2zR5LGg",
7
"title": "quick reply btn 1",
8
"type": "text"
9
}
10
]
11
}
Copied!

1.3 文字訊息 Text

由純文字組成,文字長度最多 320 字元,可搭配按鈕或快速回覆選單。
Text message. The max length is 320.
Buttons and QuickReplies are optional
1
{
2
"type": "text",
3
"text": "文字描述",
4
"buttons": [
5
{
6
"title": "按鈕1",
7
"type": "postback",
8
"value": "module-ry49xXQU2"
9
},
10
{
11
"title": "按鈕2",
12
"type": "web_url",
13
"value": "http://google.com"
14
}
15
],
16
"quickReplies": [
17
{
18
"title": "快速回覆1",
19
"type": "text",
20
"payload": "module-SkHJnEqZl"
21
},
22
{
23
"title": "快速回覆2",
24
"type": "text",
25
"payload": "module-KkHJaEqZl"
26
}
27
]
28
}
Copied!

1.4 影片訊息 Video

由影片組成,支援的格式為 mp4,可搭配快速回覆選單。
Video message.
Video format: mp4.
QuickReplies are optional.
1
{
2
"type": "video",
3
"videoUrl": "https://d1dh985a59yv80.cloudfront.net/video/WK_30s.mp4",
4
"quickReplies": [
5
{
6
"payload": "module-Sk2zR5LGg",
7
"title": "快速回覆1",
8
"type": "text"
9
}
10
]
11
}
Copied!

1.5 語音訊息 Audio

由音訊組成,支援的格式為 mp3,可搭配快速回覆選單。
Audio message.
Audio format: mp3.
QuickReplies are optional.
1
{
2
"type": "audio",
3
"audioUrl": "https://d1dh985a59yv80.cloudfront.net/audio/sodagreen.mp3",
4
"quickReplies": [
5
{
6
"payload": "module-Sk2zR5LGg",
7
"title": "快速回覆1",
8
"type": "text"
9
}
10
]
11
}
Copied!

1.6 媒體訊息 Media

目前僅支援 Facebook Messenger。 可支援圖片/影片訊息,可以選用一個按鈕與快速回覆。
The Facebook channel only message type.

Facebook URL

媒體種類
媒體來源
URL 格式
Video
Facebook 粉絲頁
https://business.facebook.com/<PAGE_NAME>/videos/<NUMERIC_ID>
Video
Facebook 帳號
https://www.facebook.com/<USERNAME>/videos/<NUMERIC_ID>/
Image
Facebook 粉絲頁
https://business.facebook.com/<PAGE_NAME>/photos/<NUMERIC_ID>
Image
Facebook 帳號
https://www.facebook.com/photo.php?fbid=<NUMERIC_ID>
1
{
2
"type": "media",
3
"mediaType": "<image|video>",
4
"url": "<FACEBOOK_URL>",
5
"buttons": [
6
{
7
"title": "唯一的按鈕",
8
"type": "postback",
9
"value": "module-ry49xXQU2"
10
}
11
]
12
}
Copied!
Last modified 5mo ago