[英]Facebook Messenger API: Send Structured Message
遵循這個例子 。
messageData = {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [{
"title": "First card",
"subtitle": "Element #1 of an hscroll",
"image_url": "http://messengerdemo.parseapp.com/img/rift.png",
"buttons": [{
"type": "web_url",
"url": "https://www.messenger.com/",
"title": "Web url"
}, {
"type": "postback",
"title": "Postback",
"payload": "Payload for first element in a generic bubble",
}],
},{
"title": "Second card",
"subtitle": "Element #2 of an hscroll",
"image_url": "http://messengerdemo.parseapp.com/img/gearvr.png",
"buttons": [{
"type": "postback",
"title": "Postback",
"payload": "Payload for second element in a generic bubble",
}],
}]
}
}
我收到錯誤:
\\“error \\”:{\\“message \\”:\\“(#100)不完整的元素數據:標題和至少一個其他字段(圖片網址,字幕或按鈕)是非空值\\”,\\“類型\\ “:\\” OAuthException \\”,\\ “代碼\\”:100,\\ “fbtrace_id \\”:\\ “ElbXaF25 + 0G \\”}
我錯過了什么嗎? 在我看來,所有相關領域都存在。
想出來,用紅寶石寫這個,我需要在發送之前在哈希上調用to_json
。
是的,在發送之前需要轉換為json格式要么是結構化消息,要么是短信。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.