Access to this table requires the user to grant the read_mailbox extended permission to the application and has a number of query restrictions. See the Notes section below for more details.
Highlighted rows are indexable / searchable and one is usually required in the WHERE portion of the query.
|message_id||string||Unique identifier of the message.|
|thread_id||string||Unique identifier of the thread.|
|subject||string||Subject of the message.|
|body||string||Body of the message.|
|unread||bool||Flag indicating whether the message is unread.|
|timestamp||string||Last update time of the thread (Unix-type timestamp with millisecond resolution).|
|sender||object|| Sender of the message. This field is an object with properties |
|recipients||array|| List of message recipients. Each element of the list is an object with properties |
|object_sender||object|| Sender of the message in the case that it is a Facebook page, group or event. This field is an object with properties |
|html_body||string||HTML representation of the message body.|
|attachments||array||List of attachment identifiers. Attachments correspond to any attached file.|
|attachment_map||array|| Map from attachment identifiers to objects containing information about the attachment (file size, type, etc.). Each object has the following properties: |
|shares||array||List of share identifiers. Shared items include links, videos, and photos as were supported in the old messaging system.|
|share_map||array|| Map from share identifiers to objects containing information about the shared objects. Each object has the following properties: |
Get messages in a thread
SELECT ... FROM unified_message WHERE thread_id=...
Get a message by its identifier
SELECT ... FROM unified_message WHERE message_id=...
Get messages in a thread sent since the beginning of 2010
SELECT ... FROM unified_message WHERE thread_id=... AND timestamp >= 1262332800000
Not all syntactically valid queries are supported. The constraints are:
- the WHERE clause must specify a value for thread_id or message_id
- the WHERE clause must be a conjunction (boolean AND) of constraints on the fields marked as indexable (e.g. you cannot specify constraints based on the subject, etc.)
- the results can only be ordered by timestamp (ascending or descending)
- you should always specify a limit. If unspecified the default is to return at most 20 results