Last active
January 26, 2021 04:12
-
-
Save Unayung/a250d0f4aa4661e0ac0d44e94b112c14 to your computer and use it in GitHub Desktop.
快速回覆 related
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一則 broadcast 最多一則文字一則圖片一組快回 | |
一項 task 最多一則文字一則圖片一組快回 | |
快速回覆 items 最多都是 13 個 | |
文字部份 800 中文字 ( 1600 characters ) | |
{ | |
"type": "text", | |
"text": "Select your favorite food category or send me your location!", | |
"quickReply": { | |
"items": [ | |
{ | |
"type": "action", | |
"imageUrl": "https://example.com/sushi.png", | |
"action": { | |
"type": "message", | |
"label": "Sushi", | |
"text": "Sushi" | |
} | |
}, | |
{ | |
"type": "action", | |
"imageUrl": "https://example.com/tempura.png", | |
"action": { | |
"type": "message", | |
"label": "Tempura", | |
"text": "Tempura" | |
} | |
}, | |
{ | |
"type": "action", | |
"action": { | |
"type": "location", | |
"label": "Send location" | |
} | |
} | |
] | |
} | |
} | |
# 文字訊息 | |
Facebook::Messenger::Bot.deliver( | |
{ | |
recipient: { id: member.fb_uid }, | |
message: { | |
text: 'hi ya' | |
}, | |
messaging_type: Facebook::Messenger::Bot::MessagingType::UPDATE | |
}, | |
page_id: member.fb_messenger.page_id | |
) | |
# 圖片訊息 | |
Facebook::Messenger::Bot.deliver( | |
{ | |
recipient: { id: member.fb_uid }, | |
message: { | |
attachment: { | |
type: 'image', | |
payload: { | |
url: 'https://i0.zi.org.tw/ddm/2021/01/1611086347-c3faaa8595bcda8e44e6789112f074e3.jpg' | |
} | |
} | |
}, | |
messaging_type: Facebook::Messenger::Bot::MessagingType::UPDATE | |
}, | |
page_id: member.fb_messenger.page_id | |
) | |
# 文字訊息加快速回覆 | |
Facebook::Messenger::Bot.deliver( | |
{ | |
recipient: { id: member.fb_uid }, | |
message: { | |
text: text_content, | |
quick_replies: [ | |
{content_type: 'text',title: 'Sushi',payload: 'HARMLESS' }, | |
{content_type: 'text',title: 'Tempura',payload: 'HARMLESS' }, | |
{content_type: 'text',title: 'You are!',payload: 'HARMLESS' }, | |
] | |
}, | |
messaging_type: Facebook::Messenger::Bot::MessagingType::UPDATE | |
}, | |
page_id: member.fb_messenger.page_id | |
) | |
# 圖片訊息加快速回覆 | |
Facebook::Messenger::Bot.deliver( | |
{ | |
recipient: { id: member.fb_uid }, | |
message: { | |
attachment: { | |
type: 'image', | |
payload: { | |
url: 'https://i0.zi.org.tw/ddm/2021/01/1611086347-c3faaa8595bcda8e44e6789112f074e3.jpg' | |
} | |
}, | |
quick_replies: [ | |
{content_type: 'text',title: 'Sushi',payload: 'HARMLESS' }, | |
{content_type: 'text',title: 'Tempura',payload: 'HARMLESS' }, | |
{content_type: 'text',title: 'You are!',payload: 'HARMLESS' }, | |
] | |
}, | |
messaging_type: Facebook::Messenger::Bot::MessagingType::UPDATE | |
}, | |
page_id: member.fb_messenger.page_id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment