Search code examples
phpfacebook-messenger

Is sender id unique in facebook messenger bot?


I am developing facebook messenger bot.I get sender id using following code.Is sender id unique or not?

 $input = json_decode(file_get_contents('php://input'), true, 512);

 $sender = $input['entry'][0]['messaging'][0]['sender']['id'];

Solution

  • Yes, Sender Id is unique for each user for each FB page.

    From Messenger Platform Webhook Reference( https://developers.facebook.com/docs/messenger-platform/webhook-reference):

    When representing a user, these IDs are page-scoped IDs (PSID). This means that the IDs of users are unique for a given page.