Facebook Messenger Bot - 列表模板的无效 URL 按钮字段
Facebook Messenger Bot - Invalid URL button fields for List Template
我一直在努力向用户发送包含一些数据的列表。我正在关注 facebook's doc 来设置我的请求负载。但是,我收到以下错误:
{'error': {
'message': '(#100) Invalid URL button fields provided. Please check documentation for details.',
'type': 'OAuthException',
'code': 100,
'error_subcode': 2018125, 'fbtrace_id': 'GZFFcM+j5e/'}}
这是我的 JSON 有效载荷:
{'recipient': {'id': 'MY_MESSENGER_ID'},
'message':
{'attachment':
{'type': 'template',
'payload':
{'template_type': 'list',
'top_element_style': 'compact',
'elements':
[{'title': 'Hello 1', 'subtitle': 'Subtitle 1',
'buttons':
[{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}],
'default_action':
{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}},
{'title': 'Hello 2', 'subtitle': 'Subtitle 2',
'image_url': 'https://cdn-images-1.medium.com/1*Vkf6A8Mb0wBoL3Fw1u0paA.jpeg',
'buttons':
[{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}],
'default_action':
{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}}]}}}}
我检查过,重新检查过多次。另外,我已经从文档中发送了 facebook 的示例 json,但我得到了相同的回复。请看一看,让我知道我卡在哪里!
这是我的结局url:
“https://graph.facebook.com/v2.6/me/messages?access_token=”
提前致谢!
您的请求有两个问题:
- 对于
default_action
,只有在messenger_extensions:true
时才可以设置fallback_url
default_action
不能有 title
道具。
试试这个:
{
"recipient":{
"id": "{{PSID}}"
},
"message":{
"attachment":{
"type": "template",
"payload":{
"template_type": "list",
"top_element_style": "compact",
"elements":[{
"title": "Hello 1",
"subtitle": "Subtitle 1",
"buttons":[{
"title": "View",
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}],
"default_action":{
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}
},
{
"title": "Hello 2",
"subtitle": "Subtitle 2",
"image_url": "<a href="https://cdn-images-1.medium.com/1" rel="nofollow noreferrer">https://cdn-images-1.medium.com/1</a>*Vkf6A8Mb0wBoL3Fw1u0paA.jpeg",
"buttons":[{
"title": "View",
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}],
"default_action":{
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}
}
]
}
}
}
}
我一直在努力向用户发送包含一些数据的列表。我正在关注 facebook's doc 来设置我的请求负载。但是,我收到以下错误:
{'error': {
'message': '(#100) Invalid URL button fields provided. Please check documentation for details.',
'type': 'OAuthException',
'code': 100,
'error_subcode': 2018125, 'fbtrace_id': 'GZFFcM+j5e/'}}
这是我的 JSON 有效载荷:
{'recipient': {'id': 'MY_MESSENGER_ID'},
'message':
{'attachment':
{'type': 'template',
'payload':
{'template_type': 'list',
'top_element_style': 'compact',
'elements':
[{'title': 'Hello 1', 'subtitle': 'Subtitle 1',
'buttons':
[{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}],
'default_action':
{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}},
{'title': 'Hello 2', 'subtitle': 'Subtitle 2',
'image_url': 'https://cdn-images-1.medium.com/1*Vkf6A8Mb0wBoL3Fw1u0paA.jpeg',
'buttons':
[{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}],
'default_action':
{'title': 'View', 'type': 'web_url',
'url': 'https://www.medium.com/',
'messenger_extensions': 'false',
'webview_height_ratio': 'full',
'fallback_url': 'https://www.medium.com/'}}]}}}}
我检查过,重新检查过多次。另外,我已经从文档中发送了 facebook 的示例 json,但我得到了相同的回复。请看一看,让我知道我卡在哪里!
这是我的结局url: “https://graph.facebook.com/v2.6/me/messages?access_token=”
提前致谢!
您的请求有两个问题:
- 对于
default_action
,只有在messenger_extensions:true
时才可以设置 default_action
不能有title
道具。
fallback_url
试试这个:
{
"recipient":{
"id": "{{PSID}}"
},
"message":{
"attachment":{
"type": "template",
"payload":{
"template_type": "list",
"top_element_style": "compact",
"elements":[{
"title": "Hello 1",
"subtitle": "Subtitle 1",
"buttons":[{
"title": "View",
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}],
"default_action":{
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}
},
{
"title": "Hello 2",
"subtitle": "Subtitle 2",
"image_url": "<a href="https://cdn-images-1.medium.com/1" rel="nofollow noreferrer">https://cdn-images-1.medium.com/1</a>*Vkf6A8Mb0wBoL3Fw1u0paA.jpeg",
"buttons":[{
"title": "View",
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}],
"default_action":{
"type": "web_url",
"url": "<a href="https://www.medium.com/" rel="nofollow noreferrer">https://www.medium.com/</a>",
"messenger_extensions": "false",
"webview_height_ratio": "full"
}
}
]
}
}
}
}