Pii
Pii

Reputation: 43

Access Graph APIs with MessengerPageScopedID

Lately, I have been testing the messenger platform. So far everything works great but I wanted to get a little more infos about the user than just the basic profile infos. When a user talks to you via Messenger you get a specific userId which, from what I understood, is not only page-scoped but also messenger-scoped. In the messenger documentation, there is an example with a call to the user profile API like this:

curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic,locale,timezone,gender&amp;access_token=<PAGE_ACCESS_TOKEN>"

However, even though my app has the user_events permission, I cannot access the corresponding graph api node.

curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>/events?fields=id,name&amp;access_token=<PAGE_ACCESS_TOKEN>"

returns an error like this one:

{
    message: '(#100) Tried accessing nonexisting field (events) on node type (MessengerPageScopedID)',
    type: 'OAuthException',
    code: 100,
    fbtrace_id: 'E+ramLeapT5'
}

I don't use the graph-api often, could it be due to the fact that my page is still in development and doesn't have the permission in the "approved items" category? Is there a way to link the messenger-scoped id to a simpler page-scoped or app-scoped id that I could use to make this kind of calls? Maybe with a custom entry point?

Upvotes: 4

Views: 1783

Answers (1)

lars.schwarz
lars.schwarz

Reputation: 1274

You cannot access anything else but public_profile fields using this special token. Access to the user events endpoint requires user_events permission and since users do not need to login to your app to message you page, there's no way to retrieve permissions to access anything besides the user's public_profile fields.

Upvotes: 6

Related Questions