Game Play Button Reference

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.

Contents

Button Syntax

{
  "type":"game_play",
  "title":"Play",
  "payload":"{<SERIALIZED_JSON_PAYLOAD>}",
  "game_metadata": { // Only one of the below
    "player_id": "<PLAYER_ID>",
    "context_id": "<CONTEXT_ID>"
  }
}

Example Usage

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>"

Example Response

{
  "recipient_id": "1254477777772919",
  "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P"
}  

Properties

Property Type Description

type

String

Type of button. Must be game_play.

title

String

Button title, e.g. "Play".

payload

String

Optional. This data will be sent to the game.

game_metadata

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

player_id

String

Optional. Player ID (Instant Game name-space) to play against.

context_id

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.