messaging_game_plays Webhook Event Reference

This callback occurs after a person played a round of Instant Games. To receive this event, you must subscribe to this callback by selecting the messaging_game_plays field when setting up your webhook.

{
  "sender": {
    "id": "<PSID>"
  },
  "recipient": {
    "id": "<PAGE_ID>"
  },
  "timestamp": 1469111400000,
  "game_play": {
    "game_id": "<GAME-APP-ID>",
    "player_id": "<PLAYER-ID>",
    "context_type": "<CONTEXT-TYPE:SOLO|THREAD>",
    "context_id": "<CONTEXT-ID>", # If a Messenger Thread context
    "score": <SCORE-NUM>, # If a classic score based game
    "payload": "<PAYLOAD>" # If a rich game
  }
}

Properties

sender

PropertyTypeDescription

id

String

The PSID of the user that triggered the webhook event.

recipient

PropertyTypeDescription

id

String

Your Page ID.

game_play

Property Description Type Values

game_id

App ID of the game

String

player_id

ID of the user in the Instant Game name-space. By linking this ID to the PSID received in the sender field, the bot can send messages to a user after a game play.

String

context_type

Type of the social context a game is played in.

String

SOLO|THREAD|GROUP

context_id

ID of the context if not a SOLO type. This ID is in the Instant Game name-space.

String

score

Best score achieved by this user in this game round. Only available to Classic score based games.

Integer

payload

JSON encoded payload data, set using FBInstant.setSessionData(). Only available to game with Rich Games Feature enabled.

String

Response

You must respond to the callback with an HTTP status of 200.