Facebook Messenger platform: how to get user information?

I tried the recently released Facebook Messenger platform, and so far so good. Everything worked well, and I was able to create an echo bot.

But I wonder how I can identify this user who started chatting on my page. For example, when a user started chatting, I get a PID user (user ID on the page).

Making the following request to the Facebook Graph API:

GET https://graph.facebook.com/v2.6/{PAGE_SPECIFIC_USER_ID} 

I found that I can simply request the following fields: first_name, last_name and profile_pic.

So my question is: how can I find out if this user is the current client of my business page? Is there any other way to request additional information (e.g. email and real facebook user id)?

+7
facebook facebook-graph-api facebook-messenger
source share
4 answers

There is currently no way to do this. The best way would be to invite the user to enter their information in the chat or give them a link to the login page for mobile devices or another way to link their chat account.

+3
source share

Facebook updated the Messenger platform API (2016-07-01) and introduced a new feature called Account Link for Account . This can be used to identify the user who created the account on your site through Facebook Login , and you can link the two accounts. Logging into Facebook has its own set of permissions, which you can use to get more information using the Facebook graphical API. You can find the full list here .

+5
source share

Messenger Platform 2.0 introduces an "Identity Mapping API" that solves the problem. https://developers.facebook.com/docs/messenger-platform/connecting-accounts

+2
source share

you can get user information as below using fbmq library https://github.com/conbus/fbmq

 # this method will occur when a message received from user @page.handle_message def message_handler(event): user_profile = page.get_user_profile(event.sender_id) print(user_profile) #first_name, last_name, profile_pic, gender ... 
0
source share

All Articles