LifeCycleEvent
Outline
Life Cycle Event is a mechanism that notifies the partner server when certain events occur in relation to an application. The following events are currently available:
Event |
Explanation |
---|---|
addapp |
User has installed the application. |
removeapp |
User has uninstalled the application. |
joingroup |
User has joined the game’s official group. |
leavegroup |
User has left the game’s official group. |
postdiary |
User has posted a diary entry about the game. |
Implementing Life Cycle Events
Adding a description to the Gadget XML file.
Describe the settings of the partner server that will receive event notifications.
Attribute |
Value |
---|---|
rel |
The life cycle event type (event.addapp | event.removeapp | event.joingroup | event.leavegroup | event.postdiary) |
href |
The URL to receive notifications at the partner server = endpoint URL |
method |
Type of request made to the endpoint URL (GET | POST) |
Notification requests
Request type
addapp
An event which occurs when an application is installed.
Parameter name |
Explanation |
---|---|
eventtype |
The type of event (event.addapp) |
opensocial_app_id |
Application ID |
id |
User ID of the user who installed the application |
mbga_invite_from |
User ID of the user who sent the invitation |
removeapp
- An event which occurs when an application is uninstalled.
Parameter name
Explanation
eventtype
Type of event (event.removeapp)
opensocial_app_id
Application ID
id
User ID of the user who has uninstalled the application
joingroup
- An event which occurs when a user joins a game’s official group.
Parameter name
Explanation
eventtype
Type of event "event.joingroup"
opensocial_app_id
Application ID
id
User ID of the user who has joined the game’s official group
leavegroup
- An event which occurs when a user leaves a game’s official group.
Parameter name
Explanation
eventtype
Type of event "event.leavegroup"
opensocial_app_id
Application ID
id
User ID of the user who has left the game’s official group
postdiary
- An event which occurs when a user posts a diary entry about a game.
Parameter name
Explanation
eventtype
Type of event "event.postdiary"
opensocial_app_id
Application ID
mbga_diary_id
DiaryID
id
User ID of the user who has posted a diary entry about the game
Request format
- When id:102 is invited by id:101 and then installs Application A.
- When id:101, id:102, and id:103 install Application A, and the notifications are issued simultaneously.
- When id:101 and id:102 join the official group of Application A.
- When id:101 posts a diary entry about Application A.
A signature by OAuth is applied to requests. Make sure to confirm the validity of the Authorization request header.
Response
When a response other than the above is returned, it is regarded as an error and then re-sent at the time of the next notification. It is also regarded as an error if the response takes 10 seconds or more from the time the request is issued. If a certain number of notification errors is reached, the notification is destroyed.
Notification frequency
Event notifications to an endpoint are not carried out on a real time basis from user actions, but are issued with a time lag. Notifications usually arrive in a few minutes in both the production and Sandbox environments, but notifications may be delayed due to system load.
Be sure to implement settings such that 200 is returned as the status code indicating successful reception at the endpoint.
Restrictions
Life Cycle Event currently has the following restrictions.
- No notifications will be sent for joingroup, leavegroup, and postdiary if the user has not yet installed or has uninstalled an application.
Reference link
OpenSocial v1.0 Lifecycle Events
OpenSocial v0.9 Lifecycle Events
Change history
- 12/03/2012
- Added information regarding event notification frequency.
- 07/29/2011
- Added description of the events joingroup, leavegroup, and postdiary.