How to receive a facebook username? Graph API

Asked

Viewed 336 times

2

Hi, guys. How to get a facebook user id, and its name using Graph api?

I can only get the message id using sender = event.sender.id;

function fbGetProfile(id) {
   request({
      method: 'GET',
      uri: 'https://graph.facebook.com/v2.6/${id}',
      qs: {
        fields: 'first_name',
        access_token:PAGE_ACCESS_TOKEN
      },
      json: true
    }, function(error, response, body) {
    if (error) {
      console.log('Error sending message: ', error);
    } else if (response.body.error) {
      console.log('Error: ', response.body.error);
    }
  });

1 answer

0

The Graph API no longer allows search for username. I also just checked the documentation and there’s nothing there about.

I saw that the Facebook HTML contains two meta tags with User_id:

<!-- Na URL https://www.facebook.com/zuck -->
<meta property="al:android:url" content="fb://profile/4" />
<meta property="al:ios:url" content="fb://profile/4" />

facebook graph api explorer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.