问题描述
从与Facebook Messenger平台上的漫游器进行对话时,使用外部API进行身份验证的最佳方法是什么?
What is the best way to authenticate with an external API from a conversation with a bot on the facebook messenger platform?
举一个广泛的例子,我希望我的机器人的用户可以在自己的外部网站配置文件中创建项目.有没有一种方法可以从用户那里获取登录信息,或者将我的机器人连接到外部网站,而无需用户将其用户名和密码明确发送给机器人的消息?
For a broad example, I would like a user of my bot to create items on their own profiles of an external website. Is there a way to get login information from the user, or connect my bot to the external website, without the user explicitly sending a message to the bot with their username and password?
这不是我想要的,但可以帮上忙.这是来自文档的更多信息:
This isn't quite what I'm looking for but it helps. Here's more info from the docs:
请求
curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic&access_token=<PAGE_ACCESS_TOKEN>"
响应
{ "first_name": "Peter", "last_name": "Chang", "profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile...70ec9c19b18" }
{ "first_name": "Peter", "last_name": "Chang", "profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile...70ec9c19b18" }
推荐答案
这取决于它们的进入方式.
It depends how they come in.
- 如果他们来自您的网站,则可以使用他们帐户中的发送到Messengee"按钮.使用传递参数将您的帐户链接到用户线程.以下是文档的摘录:
- If they come from your website, you can use the Send to Messengee button from within their account. Use the pass through param to link your account to the user thread.Here's an excerpt from the documentation:
- 如果它们直接进入您的机器人,则您必须在对话中向他们显示某种登录名(您的登录名).这将在指向移动Web URL的链接中发生.
这篇关于来自Facebook Messenger机器人对话的API身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!