Set up a Game Bot for re-engagement

Facebook instant games can have a Messenger Platform Bot attached. Although this is optional, it gives your game a powerful channel for re-engagement. Here's how to create and set up your Game Bot:

Step 1: Create a Page

To create a Game bot, you'll first need to create a Facebook page. In order for the page to work correctly with your Instant Game it needs meet some specific criteria:

  • The page's category must be App Page or Video Game (and only these categories)
  • The page's name needs to contain the name of the app.
  • The page cannot be associated with another app.

To create a page with these criteria, visit your App Dashboard and follow these steps:

  1. In the Product menu, expand the Instant Games dropdown and select Details
  2. On the Details page, find the section titled App Page and click Create New Page
  3. Go to the App Page section of the Instant Games product. Before moving on to the next step, make sure that your App Page section looks like the step on the right:

Note: If your Instant Game is not correctly associated with a page as explained above, your bot will not be able to receive messaging_game_plays events.

Step 2: Activate your Bot

After creating your page, you'll need to make sure to respond to its messaging webhooks. Webhooks are HTTP calls that we send to your backend when a messaging event is sent to your page. Your server's logic will then decide how to properly respond to each event, if a response is appropriate. To associate your server's endpoints with your page events, follow the instructions on the Messenger Platform Quickstart Tutorial to enable the bot for your page. The table below contains information about the webhooks and permissions you will need to make your bot work with Instant Games:

Section Values

Page events

messages and messaging_game_plays



Instant Games bots are only permitted to use standard messaging but not pages_messaging_subscriptions. Note: do not use the GAME_EVENT message tag when sending bot messages as it is not supported anymore.

If your bot has other functionality that requires subscription messaging or customer matching you should create a separate app and apply for Messenger platform permissions again.

Step 3: Respond to messaging_game_plays webhooks

Once your bot is correctly configured, your server application will start receiving messaging_game_plays webhooks every time a player closes the Instant Game. Below is an example of a server application detecting and responding to one of these webhooks.

if (event.game_play) {
  var senderId =; // Messenger sender id
  var playerId = event.game_play.player_id; // Instant Games player id
  var contextId = event.game_play.context_id; 
  var payload = event.game_play.payload;
  var playerWon = payload['playerWon'];
  if (playerWon) {
      'Congratulations on your victory!', 
      'Play Again'

  } else {
      'Better luck next time!', 

You can refer to the Messenger Platform documentation for more information on this webhook: Game Play Webhook Documentation.

Step 4: Bring your players back into the game

Below is an example of how to use the Graph API to send a game_play button to your players.

   -X POST 
   -H "Content-Type: application/json" 
   -d '{
  "messaging_type": "UPDATE",
  "recipient": {
    "id": "<RECIPIENT_ID>"
  "message": {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "generic",
        "elements": [
            "title": "It has been a while since your last game. Time to get back",
            "buttons": [
                "type": "game_play",
                "title": "Play Tic-Tac-Toe.",
                "payload": "{}",
                "game_metadata": {
                  "context_id": "<CONTEXT_ID>"

You can refer to the Messenger Platform documentation for more information on this button: Game Play Button Documentation.

Step 5: Follow our guidelines and policies

Before it is launched to production, your game bot should go through Messenger Platform submission process. Make sure to have a look at our Bot Checklist before submitting it for review.


Please refer to the documents below for more information on how to build and optimize your Game bot.

Next steps

Now that you know how to build an Instant Game with an associated Game bot, it's time to test it, and prepare for launching: Testing, publishing and sharing your Instant Game