This demo contains code that demonstrates common scenarios in a backend service that supports an Instant Game client: a game bot and a storage service.
- npm (Install npm)
- Postgresql(Install Postgresql)
$ npm install
You can rename the file template.env
into just .env
and input test values of the variables below. This file will be used for local testing. When you host your code in the cloud, you'll need to reconfigure these variables to their production values.
BOT_VERIFY_TOKEN
: create a memorable word. You'll use that to validate webhooks with your Messenger BotAPP_SECRET
: paste your App Secret. This can be found in your App's settings page.USE_SECURE_COMMUNICATION
: 1PAGE_ACCESS_TOKEN
: leave blank for now.DATABASE_URL
: connection string to your Postgres installation
- Follow the instructions on the Game Bot setup guide to setup a Facebook page that will host your game bot
- When associating the Webhooks, under the Verify Token field, input the memorable word you created for
BOT_VERIFY_TOKEN
above - Once webhooks are configured, copy your Page's access token into the
PAGE_ACCESS_TOKEN
environment variable of your hosted app.
All done! Your Backend service is configured! You can run your code with
$ node index
Follow the instructions in the README.md of the client-side counterpart of this demo: