从图表获取ids_for_pages返回空 [英] Getting ids_for_pages from Graph returns empty

查看:181
本文介绍了从图表获取ids_for_pages返回空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Messenger中跨应用程序和bot连接人们.

https://developers.facebook.com/docs/messenger-platform /connecting-accounts

我已经在业务和页面中关联了我的开发人员Facebook应用程序(带有Facebook登录名和Messenger产品).

我的目标是在我的服务器中能够通过应用程序中的登录用户来识别Messenger用户.因此,当用户访问Messenger时,其体验将与应用程序中的体验相同.

问题在于:当我尝试从图形中获取ids_for_pages时,即使该用户与bot进行了交谈,它也会将数据返回为空.

图形GET(v2.10)

/{user_login_id}/ids_for_pages?access_token={user_login_access_token}&appsecret_proof={appsecret_proof}

{"data": []}

使用页面范围ID时,我可以获取ids_for_apps(如果用户已经登录到我的应用程序,则可以使用它来匹配用户),但是如果用户与bot,然后转到我的应用程序,我看不到与用户匹配的方式. 我还使用token_for_business在Business Mapping API上进行了调查,但它是用户节点所必需的.在应用程序中很好用,但是我无法通过页面范围的ID来获取用户令牌或用户节点.

https://developers.facebook.com/docs/apps/for-business

我做错什么了吗?缺少权限?我的机器人已经上线并且具有pages_messaging.

任何指导都可以帮助您!谢谢您的时间!

编辑

正如amuramoto所说,我使用的是错误的access_token.它必须与我在ids_for_apps中使用的相同.

/{user_login_id}/ids_for_pages?access_token={page_access_token}&appsecret_proof={appsecret_proof}

解决方案

将其放在此处,以防将来有人问到这个问题.

您没有使用正确的访问令牌.文档中的示例显示,对ids_for_pages的调用需要页面范围的访问令牌,而不是用户访问令牌.

I'm having some trouble connecting people across apps and bots in messenger.

https://developers.facebook.com/docs/messenger-platform/connecting-accounts

I've already associated my developers facebook app (with a Facebook log in and Messenger Products) in Business, as well as the page.

My objective is in my server being able to identify the messenger user with the log in user in the app. So when the user would go to the messenger would have the same experience as in the app.

The trouble is: when I try to get ids_for_pages from graph it returns the data empty, even after this user talks to the bot.

Graph GET (v2.10)

/{user_login_id}/ids_for_pages?access_token={user_login_access_token}&appsecret_proof={appsecret_proof}

{"data": []}

When I'm using the Page-Scoped ID I'm able to get ids_for_apps (great I can use that to match the user if the user already log in to my app), but if the user talks to the bot and then goes to my app I see no way for me to match the user. I also investigated on Business Mapping API with the token_for_business but it is necessary the user node. Great in the app but I can't get the user token or user node by the Page-Scoped ID.

https://developers.facebook.com/docs/apps/for-business

Am I doing something wrong? A missing permission? My bot is live and has pages_messaging.

Any guidance helps! Thank you for your time!

EDIT

As amuramoto said, I was using the wrong access_token. It must be the same as I used in the ids_for_apps.

/{user_login_id}/ids_for_pages?access_token={page_access_token}&appsecret_proof={appsecret_proof}

解决方案

Putting this here in case this questions comes up for anyone in the future.

You aren't using the right access token. The example in the docs show that calls to ids_for_pages requires a page-scoped access token, not the user access token.

这篇关于从图表获取ids_for_pages返回空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆