Chapter 4. Notifications Tables

Notifications are messages sent to users informing them of invites, comments on their updates, gifts, or requested action from an online game. See Introduction to Notifications for more information.

Notifications Table

Description

The Notifications Table allows you to get, create, or update user notifications.

Table

social.notifications

Allowed Statements

  • INSERT
  • SELECT
  • UPDATE

Keys

Key Name Data Type Allowed for Statements Required for Statements Default Value Description
appid string SELECT   None The ID of the application that created the notification.
appmsg string INSERT INSERT None Message sent with the notification.
category string INSERT, SELECT   None A label used to group notifications. For example: friends, coworkers, games.
choice string UPDATE   None The updated choice given to the receiver of the notification, such as "Accepted". Each notification must offer the receive at least one choice.
choice1 string INSERT INSERT None The primary and required choice of action given to the notification receiver. The choice1 key has two required properties: choice1.label and choice1.urltemplate. Use choice1.label to describe the action that the user can take. For example: choice1.label=Accept. Use choice1.urltemplate to specify a URL template with embedded variables that are populated with values based on the user's action. For example, the following URL template would substitute {choice} with the value "accept" if the user accepts th notification: choice1.urltemplate=https://apps.yahoo.com/myapp?choice={choice}. See URL templates for more information.
choice2 string INSERT   None A secondary choice of action given to the notification receiver. The choice2 key has two required properties: choice2.label and choice2.urltemplate. See the description for the choice1 key for more information.
choice3 string INSERT   None A third choice of action given to the notification receiver. The choice3 key has two required properties: choice3.label and choice3.urltemplate. See the description for the choice1 key for more information.
expiry string INSERT   None The expiration in POSIX time of the notification.
guid string INSERT, SELECT INSERT,SELECT None The GUID of the user who received the notification.
id string SELECT, UPDATE   None A unique ID assigned to a notification when the notification is created.
sender string SELECT   None The email address of the user sending the notification.
sendmsg string INSERT   None Indicates whether a message gets sent with the notification.
since string SELECT   None Used to get notifications from a specified time in RFC 3339 date format.
state string SELECT, UPDATE   PENDING (SELECT) The following values are allowed: PENDING, DEFERRED, COMPLETED
title string INSERT INSERT None The title of the notification that is displayed to user.
type string INSERT   None. The notification type. The only supported type is "nfsimple".
usrmsg string INSERT   None The message that a user writes and sends with the notification.
view string SELECT   tinyusercard Returns the Tinyusercard with the notification.

Example Statements

INSERT

This example statement creates a notification for the game "Car Shop" that is sent to the signed-in user, who can accept to play the game through the notification. The choicel.label key defines a choice given to the user, and the choice1.urltemplate key is used to update the notification when the user takes an action.

INSERT INTO social.notifications (guid, title, appmsg, choice1.label, choice1.urltemplate) values (me, 'Car Shop Game', 'Do you want to play Car Shop?', 'Yes', 'https://apps.yahoo.com/myapp?choice={choice}');

SELECT

This example statement returns the notifications of the signed-in user. Run the query in the YQL Console.

SELECT * FROM social.notifications WHERE guid=me

This example statement returns the notifications that the signed-in user has taken an action on, such as accepted or rejected an invitation notification. Run the query in the YQL Console.

SELECT * FROM social.notifications WHERE guid=me AND state=’COMPLETED’

This example statement returns the notification that has the ID value of "du483p2ednd5s4stuj900".

SELECT * FROM social.notifications WHERE id="du483p2ednd5s4stuj900"

UPDATE

This example statement updates the status of the notification specified by the ID to "COMPLETED".

UPDATE social.notifications SET state='COMPLETED' WHERE id='du490nmu07ctuetp16g4i008lb71j'

Elements of the Notifications Object

See Elements of the Notifications Object in the Notifications API chapter.

Example Responses

JSON Example Response Body for SELECT Notifications
XML Example Response Body for SELECT Notifications

Table of Contents