I have a bot using the Facebook Messenger API/webhook. When Facebook sends a message the sender only has the id set, not the name.
So I try to get the name using the graph API using,
https://graph.facebook.com/v2.6/<sender-id>?fields=first_name,last_name&access_token=<page-token>
The sender id it gives you does not seem to be the real id, so using your app token does not work, but using the page token does not seem to work all the time either.
From my logs I see it work some time, and not others. I get the error,
(#100) No matching user found
My only guess is that if it is an older conversation, the id it gives you have expired somewhere, so you cannot get the name?
Anyone else have this issue, or find a work around?
Okay, figured it out, and is user error.
The issue was I had another app linked to the page when testing it, and I have no removed the webhook. So the webhook was called twice and one of them had a bad token for some reason of other.
Anyway remove the webhook from the other app fixed the issue.