開場白會提供一列常見問題,協助用戶與企業展開對話。可經由開場白 API 設定最多 4 條問題。
由 2021 年 10 月 19 日起,開場白功能開始支援本地化設定,允許企業根據用戶語言設定配置自訂問題。此 API 將推出全新格式,我們鼓勵開發人員善用新格式來設定和擷取「開場白」資訊。請在此查看支援的語言清單。
此功能現時不支援桌面電腦。
curl -X POST -H "Content-Type: application/json" -d '{
"platform": "instagram",
"ice_breakers":[
{
"call_to_actions":[
{
"question":"
curl -X POST -H "Content-Type: application/json" -d '{
"platform": "instagram",
"ice_breakers":[
{
"question": "
GET 要求將視乎開場白的設定傳回不同的格式。以下行為將適用:
我們將於未來停用舊格式,故而建議開發人員轉用新格式。
curl -X GET "https://graph.facebook.com/v11.0/me/messenger_profile?fields=ice_breakers&platform=instagram&access_token=<PAGE_ACCESS_TOKEN>
新格式回應
{
"data": [
{
"call_to_actions" : [
{
"question": "
舊格式回應
{
"data": [
{
"ice_breakers": [
{
"question": "
curl -X DELETE -H "Content-Type: application/json" -d '{
"fields": [
"ice_breakers",
]
}' "https://graph.facebook.com/v11.0/me/messenger_profile?platform=instagram&access_token=%lt;PAGE_ACCESS_TOKEN>"
要從開場白處接收回傳 webhook 通知,應用程式需要在應用程式設定的 Instagram 主題下,訂閱 messaging_postbacks
8.0 版或以上版本的 webhook。
Webhook 將會接收一個 json 承載,類似以下例子。
{ "object": "instagram", "entry": [ { "id": "<IGID>", "time": 1502905976963, "messaging": [ { "sender": { "id": "<IGSID>" }, "recipient": { "id": "<IGID>" }, "timestamp": 1502905976377, "postback": { "title": "<SELECTED_ICEBREAKER_QUESTION>", "payload": "<USER_DEFINED_PAYLOAD>", } } ] } ] }