User Profile API

The User Profile API lets your bot get more information about the user and personalize their experience.

Calling this API requires passing the PSID (page-scoped user ID). You might find the PSID in the message or postback webhooks, or via getUserId() in Messenger Extensions inside your bot's webview.

This API is only available after the user initiated the conversation by sending a message or by interacting with a Web Plugin.

If the conversation was started via Messenger Destinations Ad, Customer Matching, or a web plugin, you may not immediately be allowed to see the user's profile. In these scenarions, only once the user has actually replied will your bot have profile access via this API.

Request

In order to use the User Profile API, make a GET call to https://graph.facebook.com/v2.6/<USER_ID>?access_token=PAGE_ACCESS_TOKEN.

Example

curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=PAGE_ACCESS_TOKEN"    

Fields

Field Name Description

first_name

First name

last_name

Last name

profile_pic

Profile picture

locale

Locale of the user on Facebook

timezone

Timezone, number relative to GMT

gender

Gender

is_payment_enabled

Is the user eligible to receive messenger platform payment messages

Response

A successful User Profile API request returns a json string with the requested details about the user.

Example

{
  "first_name": "Peter",
  "last_name": "Chang",
  "profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/v/t1.0-1/p200x200/13055603_10105219398495383_8237637584159975445_n.jpg?oh=1d241d4b6d4dac50eaf9bb73288ea192&oe=57AF5C03&__gda__=1470213755_ab17c8c8e3a0a447fed3f272fa2179ce",
  "locale": "en_US",
  "timezone": -7,
  "gender": "male"
}    

The information at this API is only available after a person has sent a message to your bot or clicked the "Send to Messenger" plugin. If you call the API before these actions, then you will receive an empty result. You will also receive an empty result if a person has revoked platform permissions on Facebook.

{}