Identifying Facebook Messenger user with UserID from a Facebook Login

I am trying out the new Facebook Messenger Platform and have hit a bit of a problem.

When a user first chats with my Bot, I want to use the to lookup the user in my DB and verify whether they're a customer or not and offer a more tailored UX.

User's sign up to my service using Facebook Login, but unfortunately it appears my App's Facebook ID & my Bot's Facebook ID are different due to IDs being limited to App-scopes.

Is there any way associate the 2 IDs to allow me to find a user in my DB?

UPDATE (4/20/2016): We got around this by asking users on first contact via messenger to click a link to login to their account so we could associate their messenger_id with their account in our DB.

Would be awesome if facebook instead included PAGE_SCOPED IDs in the ids_for_business endpoint.

UPDATE: (6/1/2016): Facebook's latest update includes a new "Account Linking" functionality that appears to solve this issue. See


Facebook's latest update includes a new "Account Linking" functionality that appears to solve this issue. See

Unfortunately, there's no way of doing that currently. Asking them to login for new threads is the best way of linking accounts.

Yes. You can get details like first name, last name, profile pic url, locale, timezone, gender from an api. Only you have to pass is their recipient id/sender id and acccess_token of your messenger bot.,last_name,profile_pic,locale,timezone,gender&access_token=TOKEN

I solved it different way but it works perfectly by graph API,i read mailbox of my page so that when any one can interact by messenger bot than i read pages inbox and iterate through,

Step 1:

Do a HTTP get request by graph API , you want a PAGE_UNIQUE_ID from Graph API ,

GET REQUEST<PAGE_UNIQUE_ID>?fields=conversations.limit(10){participants,updated_time,id}&access_token=<PAGE_ACCESS_TOKEN>


Go ===> ==> Press "Get Token" ===> Select your desired page ===>Finally Submit , You show a id on output that is PAGE_UNIQUE_ID in here.

Check on browser for resoponse.

Step 2:

After doing above http request ,you get a JSON object that will show latest 10 conversation of pages where desired facebook id included.

Step 3:

Do iteration through by user full name or you can use lodash or underscore at your choice,

getUserID(response,'Zahid Rahman')

function getUserID(response, fullname) {
  if (response && response.conversations && { //Check response is correct
    var conversations =;                       //Get all conversations
    for (var j = 0; j < conversations.length; j++) {
      var conversationsParticipants = conversations[j]; 
      for (var k = 0; k < conversationsParticipants.length; k++) {         //Get all particiapnts of a single conversation.

        var conversationsParticipantsEach = conversationsParticipants[k];
        if ( === fullname) {             //Check fullname match or not
          console.log("Desired Facebook User ID : " + conversationsParticipants[k].id);
          return conversationsParticipants[k].id;     

Hope it will help you.

This is probably what you want:

It allows you to get all of the app-scoped user ids on a per-business basis.

Need Your Help

How to remove unused objects from a git repository?

git file object binary

I accidentally added, committed and pushed a huge binary file with my very latest commit to a Git repository.

How can I use layout_weight in RecyclerView or ListView item view to have items of equal height fill up the available space on screen?

android android-layout listview

I currently have a need to use a RecyclerView (or ListView) but the number of items is fixed at 4. I want those 4 items to equally use the available space on the screen. The RecyclerView is the onl...