FQL:notification

From Facebook Developer Wiki (FbDevWiki.com)
Jump to: navigation, search

Query this table to get the notifications for the current session user, that is, any notification that appears on http://www.facebook.com/notifications.php. You can identify app-to-user notifications because for those notifications, both the sender_id and the recipient_id contain the same user ID.

Facebook deletes notifications older than 7 days, so only notifications less than a week old get returned in a query on this table.

For Facebook applications (like Photos or Wall), the notification is always sent in the user's language and locale that were set at the time the notification was sent.

Contents

Columns

Highlighted rows are indexable / searchable and one is usually required in the WHERE portion of the query.

Name Type Description
notification_id int The ID of the notification. This ID is not globally unique, so the recipient_id must be specified in addition to it.
sender_id int The user ID of the sender of the notification.
recipient_id int The user ID of the recipient of the notification. It is always the current session user.
created_time time The time the notification was originally sent. Notifications older than 7 days are deleted and will not be returned via this table or notifications.getList
updated_time time The time the notification was originally sent, or the time the associated application's notifications were hidden or unhidden by the user, whichever is later.
title_html string The main body of the notification in HTML.
title_text string The plaintext version of title_html, with all HTML tags stripped out.
body_html string Any additional content the notification includes, in HTML.
body_text string The plaintext version of body_html, with all HTML tags stripped out.
href string The URL associated with the notification. This is usually a location where the user can interact with the subject of the notification.
app_id int The ID of the application associated with the notification.
is_unread bool Indicates whether the notification has been marked as read. Use notifications.markRead to mark a notification as read.
is_hidden bool Indicates whether the user hid the associated application's notifications.

Examples

Retrieves's notifications that are not hidden, are unread, and were created after .

SELECT notification_id, sender_id, title_html, body_html, href FROM notification WHERE recipient_id=me()
  AND is_unread = 1 AND is_hidden = 0 AND created_time > <time>


Usage Notes

For an example of the table being used to pop up real-time notifications, see the Facebook for Adobe AIR application.

Facebook filed bug 6799, which describes how body_text returns HTML markup in the field and body_html returns escaped markup.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Graph API
FQL
Toolbox