我正在我的应用程序中处理机器人,客户要求我在对话中自动检测机器人的消息。
当应用程序创建帖子时,我可以看到是谁写的帖子:me/posts?fields=admin_creator
但是当有人在对话中写了一条消息时,我如何才能在对话 API 中看到谁写了这条消息 me/conversations?fields=messages
编辑:
我需要知道谁通过我的页面回复消息。是我、机器人、应用程序或其他有权通过我的页面回答的人。
最佳答案
解决方案#1
通过阅读文档,我发现以下信息可以帮助您:
It's not possible to request a message by its individual message ID. Instead you should get the message as part of the thread it's a part of.
请注意
message
对象有 from
和 to
对象,所以取自 Graph API Message docs .
解决方案#2
如果这对您没有帮助,我确定这两个帖子来自 chatbotsmagazine将要:
在关于Swell的帖子中应用程序,海报提出了一个问题:
How could you identify the user? We have existing users in our database who signed up with Facebook. There are two different user-ids though, according to Facebook’s Docs:
(..) Ids are page-scoped. These ids differ from those returned from Facebook Login apps which are app-scoped. You must use ids retrieved from a Messenger integration for this page in order to function properly.
然后,他们在这篇文章中提供了这个问题的答案:
FB Messenger Bot 🤖 — How to Identify a User via Page- & App-Scoped User-ID’s
我希望这有帮助。
关于facebook-graph-api - 找出谁在 Facebook 对话中写了一条消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49863788/