Thread (FQL)
From Facebook Developer Wiki
Contents |
Description
The thread FQL table. Query this table to return information about message threads in a user's Inbox. The user needs to grant the calling application the read_mailbox extended permission.
To structure your query, use the table name (thread in this case) in the FROM clause. The items in the Name column correspond to columns in the table that can be referenced in the SELECT and WHERE clauses.
In order to make your query indexable, the WHERE in your query should contain an = or IN clause for one of the columns marked with a * in the Indexable column of the table.
Columns
| Indexable | Name | Type | Description | |
| * | thread_id | int | The ID of the thread being queried. | |
|---|---|---|---|---|
| * | folder_id | int | The ID of the folder that belongs to the thread you are querying. The ID can be one of: 0 (for Inbox), 1 (for Outbox), or 4 (for Updates). | |
| subject | string | The subject of the thread. | ||
| recipients | array | The user IDs of the recipients of the thread. | ||
| updated_time | int | The created_time of the most recent message in the thread. | ||
| parent_message_id | string | The ID of the message from which this thread was branched, or 0 if this thread is not a branch. The parent_message_id is a concatenation of the thread ID and the message ID, joined by an underscore. | ||
| parent_thread_id | int | The ID of the thread from which this thread was branched, or 0 if this thread is not a branch. | ||
| message_count | int | The number of messages in this thread. | ||
| snippet | string | A short bit of text from the most recent message. | ||
| snippet_author | int | The user ID of the author of the snippet. | ||
| object_id | int | The object that sent this message, or 0 if it was not sent by an object. You can get more information about this object in the profile table. | ||
| unread | int | This is 0 if the message is read, and it is higher than that if there are unread messages in the thread. | ||
| viewer_id | int | The ID of the user whose Inbox you are querying. |
Examples
Get all threads in a user's Inbox.
SELECT ... FROM thread WHERE folder_id = 0 LIMIT 20
Search a user's Inbox for threads containing 'hello'.
SELECT ... FROM thread WHERE CONTAINS('hello')
Get all unread threads in a user's Inbox.
SELECT ... FROM thread WHERE folder_id = 0 AND unread != 0
Notes
- Searching the Inbox does not currently include messages sent by an object.
- To get started, as a developer you can access the Inbox APIs via the
read_mailboxpermission in order to develop and test your application. To launch your application to all users, please apply to the Inbox API whitelist here.
