Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

weaponsforge/serveraisertictac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instant Games Server Demo

Important

This repository is a migration of an old code repository, re-uploaded for reference and hierarchical tracking. It may not work with the latest Meta (Facebook) Instant Games guidelines. It came from an extension repository created in 2018.

@weaponsforge
20250104


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.

Pre-requisites

  1. npm (Install npm)
  2. Postgresql(Install Postgresql)

Install Dependencies

$ npm install

Configure environment variables

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.

  1. BOT_VERIFY_TOKEN: create a memorable word. You'll use that to validate webhooks with your Messenger Bot
  2. APP_SECRET: paste your App Secret. This can be found in your App's settings page.
  3. USE_SECURE_COMMUNICATION: 1
  4. PAGE_ACCESS_TOKEN: leave blank for now.
  5. DATABASE_URL: connection string to your Postgres installation

Create a Facebook page that will host your bot

  1. Follow the instructions on the Game Bot setup guide to setup a Facebook page that will host your game bot
  2. When associating the Webhooks, under the Verify Token field, input the memorable word you created for BOT_VERIFY_TOKEN above
  3. 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

Running the client-side code

Follow the instructions in the README.md of the client-side counterpart of this demo:

https://github.com/edgarjcfn/fbinstant-communication

About

Game/Bot server for the Tic Tac Toe FB Instant Game

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors