The game play button launches an Instant Game that is associated with the bot page.
For more information on using the game play button, see Game Play Button.
{
"type":"game_play",
"title":"Play",
"payload":"{<SERIALIZED_JSON_PAYLOAD>}",
"game_metadata": { // Only one of the below
"player_id": "<PLAYER_ID>",
"context_id": "<CONTEXT_ID>"
}
}
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"<PSID>"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"Try the game play button!",
"buttons":[
{
"type":"game_play",
"title":"Play",
"payload":"SERIALIZED_JSON_PAYLOAD",
"game_metadata": {
"player_id": "4590736473645"
}
}
]
}
}
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
{ "recipient_id": "1254477777772919", "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P" }
Property | Type | Description |
---|---|---|
| String | Type of button. Must be |
| String | Button title, e.g. "Play". |
| String | Optional. This data will be sent to the game. |
| Object | Optional. Parameters specific to Instant Games. |
game_metadata
By providing the optional game_metadata
, you can trigger the game to be started against a specific player_id
or in a specific context_id
.
Property | Type | Description |
---|---|---|
| String | Optional. Player ID (Instant Game name-space) to play against. |
| String | Optional. Context ID (Instant Game name-space) of the THREAD to play in |
Refer to Game Play webhook event for the event that will be sent to the bot when a user finishes a game round.