支援的訊息格式

用於傳送可水平捲動的輪播項目,每個項目都由圖像、簡短說明及按鈕所組成,可搭配快速回覆選單。

For sending a carousel-like message. Each carousel item has an image, short description, and buttons. QuickReplies are optional.

{
  "type": "gallery",
  "cards": [
    {
      "title": "title1",
      "subtitle": "subtitle1",
      "imageUrl": "https://i.imgur.com/hAGm4iF.jpg"
    },
    {
      "title": "title2",
      "subtitle": "subtitle2",
      "imageUrl": "https://i.imgur.com/hAGm4iF.jpg",
      "buttons": [
        {
          "title": "btn1",
          "type": "postback",
          "value": "module-ry49xXQU2"
        },
        {
          "title": "btn2",
          "type": "web_url",
          "value": "http://google.com"
        }
      ]
    }
  ],
  "quickReplies": [
    {
      "payload": "module-HkI2FKv84e",
      "title": "know more about Bonnie",
      "type": "text"
    }
  ]
}

1.2 圖像訊息 Image

由單張圖像組成,支援的格式為 jpg、png 和 gif,可搭配快速回覆選單。(不支援按鈕)

Single image message. (buttons are not supported)

Image format: jpg, png, gif

QuickReplies are optional.

{
  "type": "image",
  "imageUrl": "https://i.imgur.com/hAGm4iF.jpg",
  "quickReplies": [
    {
      "payload": "module-Sk2zR5LGg",
      "title": "quick reply btn 1",
      "type": "text"
    }
  ]
}

1.3 文字訊息 Text

由純文字組成,文字長度最多 320 字元,可搭配按鈕或快速回覆選單。

Text message. The max length is 320.

Buttons and QuickReplies are optional

{
  "type": "text",
  "text": "文字描述",
  "buttons": [
    {
      "title": "按鈕1",
      "type": "postback",
      "value": "module-ry49xXQU2"
    },
    {
      "title": "按鈕2",
      "type": "web_url",
      "value": "http://google.com"
    }
  ],
  "quickReplies": [
    {
      "title": "快速回覆1",
      "type": "text",
      "payload": "module-SkHJnEqZl"
    },
    {
      "title": "快速回覆2",
      "type": "text",
      "payload": "module-KkHJaEqZl"
    }
  ]
}

1.4 影片訊息 Video

由影片組成,支援的格式為 mp4,可搭配快速回覆選單。

Video message.

Video format: mp4.

QuickReplies are optional.

{
  "type": "video",
  "videoUrl": "https://d1dh985a59yv80.cloudfront.net/video/WK_30s.mp4",
  "quickReplies": [
    {
      "payload": "module-Sk2zR5LGg",
      "title": "快速回覆1",
      "type": "text"
    }
  ]
}

1.5 語音訊息 Audio

由音訊組成,支援的格式為 mp3,可搭配快速回覆選單。

Audio message.

Audio format: mp3.

QuickReplies are optional.

{
  "type": "audio",
  "audioUrl": "https://d1dh985a59yv80.cloudfront.net/audio/sodagreen.mp3",
  "quickReplies": [
    {
      "payload": "module-Sk2zR5LGg",
      "title": "快速回覆1",
      "type": "text"
    }
  ]
}

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>

{
  "type": "media",
  "mediaType": "<image|video>",
  "url": "<FACEBOOK_URL>",
  "buttons": [
    {
      "title": "唯一的按鈕",
      "type": "postback",
      "value": "module-ry49xXQU2"
    }
  ]
}

Last updated