Graph API Version

Message

As part of the V3.3 changes the read_page_mailboxes permission was deprecated. Use pages_messaging permission to access this endpoint. The read_page_mailboxes permission will stop working after December 31 2019

An individual message in Facebook Messenger. This is a Pages-only endpoint. To get individual message ID you should retrieve the conversation thread of which the message is a part. To do this, you must:

  1. Search /page/conversations for the conversation_id
  2. Search the conversation_id for the messages
    • conversation_id/message_id?fields=messages
  3. Search the message_id for the message
    • message_id?fields=message

Or, use Webhooks for Pages to retrieve the messages.

Currently, stickers are not included in this endpoint's GET request responses unless you include the /shares edge and the link sub-field in your request. For example:

fields=message,attachments,created_time,to,from,shares{link}

Reading

Graph API Explorer
GET /v5.0/{message-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{message-id}',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{message-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{message-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{message-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Requirements

TypeDescription

App Review

Your app must be be approved for the following login permissions and features.

Login permissions

read_page_mailboxes permission

Features

Not applicable

Tokens

A Page access token

Permissions

pages_messaging permission

Fields

Name Description Type

created_time

A timestamp of when this message was created

datetime

from

The sender of this message. In some cases the name of the user will resolve to "Facebook User" in order to protect user privacy.

Profile

id

The unique ID for this message.

string

message

The text of the message.

string

subject

The subject of the message.

string

tags

A set of tags indicating the message folder and source of the message.

object[]

to

A list of recipients of the message.

Profile[]

Edges

Name Description

/attachments

Files attached to a message.

/shares

Shared items, including links, photos, videos, and stickers.