使用 MessengerPageScopedID 访问图形 API
Access Graph APIs with MessengerPageScopedID
最近,我一直在测试信使平台。
到目前为止,一切都很好,但我想获得更多关于用户的信息,而不仅仅是基本的个人资料信息。
当用户通过 Messenger 与您交谈时,您会得到一个特定的 userId,据我所知,它不仅是页面范围的,而且也是 Messenger 范围的。
在 messenger documentation 中,有一个调用用户配置文件 API 的示例,如下所示:
curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=<PAGE_ACCESS_TOKEN>"
但是,即使我的应用程序具有 user_events 权限,我也无法访问相应的图 api 节点。
curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>/events?fields=id,name&access_token=<PAGE_ACCESS_TOKEN>"
returns 像这样的错误:
{
message: '(#100) Tried accessing nonexisting field (events) on node type (MessengerPageScopedID)',
type: 'OAuthException',
code: 100,
fbtrace_id: 'E+ramLeapT5'
}
我不经常使用图-api,会不会是因为我的页面还在开发中,没有"approved items"类别的权限?
有没有办法将 Messenger 范围的 ID link 转换为更简单的页面范围或应用程序范围的 ID,我可以使用它来进行此类调用?也许有自定义入口点?
除了使用此特殊标记的 public_profile 字段外,您无法访问任何其他内容。访问用户事件端点需要 user_events 权限,并且由于用户不需要登录到您的应用程序来向您的页面发送消息,因此无法检索权限以访问除用户 public_profile 字段之外的任何内容。
最近,我一直在测试信使平台。 到目前为止,一切都很好,但我想获得更多关于用户的信息,而不仅仅是基本的个人资料信息。 当用户通过 Messenger 与您交谈时,您会得到一个特定的 userId,据我所知,它不仅是页面范围的,而且也是 Messenger 范围的。 在 messenger documentation 中,有一个调用用户配置文件 API 的示例,如下所示:
curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=<PAGE_ACCESS_TOKEN>"
但是,即使我的应用程序具有 user_events 权限,我也无法访问相应的图 api 节点。
curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>/events?fields=id,name&access_token=<PAGE_ACCESS_TOKEN>"
returns 像这样的错误:
{
message: '(#100) Tried accessing nonexisting field (events) on node type (MessengerPageScopedID)',
type: 'OAuthException',
code: 100,
fbtrace_id: 'E+ramLeapT5'
}
我不经常使用图-api,会不会是因为我的页面还在开发中,没有"approved items"类别的权限? 有没有办法将 Messenger 范围的 ID link 转换为更简单的页面范围或应用程序范围的 ID,我可以使用它来进行此类调用?也许有自定义入口点?
除了使用此特殊标记的 public_profile 字段外,您无法访问任何其他内容。访问用户事件端点需要 user_events 权限,并且由于用户不需要登录到您的应用程序来向您的页面发送消息,因此无法检索权限以访问除用户 public_profile 字段之外的任何内容。