在 python 上创建 "get started button" Facebook Messenger
create "get started button" Facebook messenger on python
我是 Messenger 平台的新手,我在互联网上搜索了很多如何在 python 中的 Messenger 上制作 "get started" 按钮,但没有答案。
下面是我的代码:
def send_get_started(bot,recipient_id):
button = {
"get_started":{
"payload" : "first_coming"
}
}
bot.send_raw(button)
这里的 send_raw 函数是我从 python 上的 pymessenger2 中的 bot.py 得到的
which is here(也是下面的代码)
def send_raw(self, payload):
request_endpoint = '{0}/me/messages'.format(self.graph_url)
response = requests.post(
request_endpoint,
params=self.auth_args,
data=json.dumps(payload, cls=AttrsEncoder),
headers={'Content-Type': 'application/json'})
result = response.json()
return result
当然没有用,我想我哪里误解了,有人可以告诉我我的问题吗?
太感谢你了
端点错误。您的请求在应该使用“/thread_settings”
时却使用了“/messages”路径
设置'Get Started'按钮或问候语时需要使用端点
终点应该是:
https://graph.facebook.com/v2.6/me/messenger_profile
您可以在参考资料中看到:Get Started Reference
我是 Messenger 平台的新手,我在互联网上搜索了很多如何在 python 中的 Messenger 上制作 "get started" 按钮,但没有答案。 下面是我的代码:
def send_get_started(bot,recipient_id):
button = {
"get_started":{
"payload" : "first_coming"
}
}
bot.send_raw(button)
这里的 send_raw 函数是我从 python 上的 pymessenger2 中的 bot.py 得到的 which is here(也是下面的代码)
def send_raw(self, payload):
request_endpoint = '{0}/me/messages'.format(self.graph_url)
response = requests.post(
request_endpoint,
params=self.auth_args,
data=json.dumps(payload, cls=AttrsEncoder),
headers={'Content-Type': 'application/json'})
result = response.json()
return result
当然没有用,我想我哪里误解了,有人可以告诉我我的问题吗? 太感谢你了
端点错误。您的请求在应该使用“/thread_settings”
时却使用了“/messages”路径设置'Get Started'按钮或问候语时需要使用端点
终点应该是: https://graph.facebook.com/v2.6/me/messenger_profile
您可以在参考资料中看到:Get Started Reference