【发布时间】:2018-05-12 18:48:56
【问题描述】:
我一直在努力向用户发送包含一些数据的列表。我正在关注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,但我得到了相同的回复。请看一下,让我知道我卡在哪里!
这是我的最终网址: "https://graph.facebook.com/v2.6/me/messages?access_token="
提前致谢!
【问题讨论】:
-
按钮 url 字段中仅允许使用
whitelisted_domains。让我知道这是否解决了? -
我将 messenger_extension 禁用为 false。仅当它为 true 时才需要列入白名单的域。
标签: django facebook facebook-graph-api chatbot facebook-messenger-bot