Testing, Publishing, and Sharing an Instant Game

With Instant Games, we've made it really easy for you to test your development version locally, automate publishing, and to share the build with your team. This document will explain these steps in detail:

  1. Testing the game from a local server
  2. Uploading your build
  3. Testing the published build
  4. Submit for App Review

Testing the game from a local server

A big part of the Instant Games experience comes from the native overlays that are added to the game before and after each play session. In order to facilitate the development and testing workflow, we enable developers to run the game from a local server with a very similar experience to what their players will see in our platform. This is done through our embedded test player, which requires a small amount of configuration.

Enabling SSL via localhost

Since our embedded test player is working under the facebook.com domain, it can only be served through https. In order to embed content in a page served via https, the embedded content also needs to be served via SSL. The next steps will walk you through setting up a localhost server that serves secure content. We are showing one option below, but there are many solutions possible to enable this behavior.

> $ npm install -g http-server
  • 2. Create a private key and a certificate via openssl. This is necessary to run the secure local server.
> $ cd path/to/my/game/
> $ openssl genrsa 2048 > key.pem
> $ openssl req -x509 -days 1000 -new -key key.pem -out cert.pem
# Fill out necessary information
  • 3. Run the game from localhost with SSL. Once the key and certificate are ready, you can serve from localhost using SSL.
# Starts to serve via HTTPS, with cache disabled
> $ http-server --ssl -c-1 -p 8080 -a 
Starting up http-server, serving ./ through https
Available on:
Hit CTRL-C to stop the server
  • 4. After this, pointing your browser to https://localhost:8080 should show you the game running. You might need to approve a security warning from your browser before continuing.

Running the embedded player from your browser

Now that the game is being served from localhost via a secure connection, you can embed it in our player. Point your browser here:


You should see your game running in the Instant Games Player, like this:

At this point you should be able to use all features of the Instant Games SDK, from the game running at your local server.

For security reasons, localhost is the only supported domain for testing with the embedded test player.

Playing from local server in a specific conversation

You can run the game from your local server in a specific context. To do that just use the embedded player as explained above. You can then leverage the FBInstant.context methods (such as switchAsync(), createAsync() and chooseAsync()) to switch to different contexts.

This allows you to effectively play the game from localhost in a conversational context and to test if your context updates are being sent correctly.

Uploading your build

Package your game into a single .zip file

Instant Games content is hosted on Facebook infrastructure, so you don't need to host the game content on your own or use third-party services. Once the game is ready for testing, package all game files into a single .zip file. Please note that the index.html file should be in the root of this archive and not in any sub-folders. There are two ways to upload your bundle:

1. Upload the .zip file via the developer website

To upload the .zip file, click the Web Hosting tab in the App Dashboard. From there select "Instant Game" from the dropdown menu and click Upload Version which will allow you to upload the .zip file to Facebook's hosting service.

After that, the build will process the file, which should only take a few seconds. When the state changes to "Standby", click the "★" button to push the build to production.

2. Upload an archive via Graph API

Alternatively, you can upload your bundle via a Graph API call. This is useful if you have an automated deployment system. To do this, you need to request an upload token from the Web Hosting section, by clicking the Get Asset Upload Access Token button on the top.

With the token from the dialog, you can submit the following call to our Graph API to submit your .zip. Note that we are using the video sub-domain, but that's intentional, since that URL is configured to receive larger uploads.

curl -X POST https://graph-video.facebook.com/{App ID}/assets 
  -F 'access_token={ASSET UPLOAD ACCESS TOKEN}' 
  -F 'type=BUNDLE' 
  -F 'asset=@./{YOUR GAME}.zip' 
  -F 'comment=Graph API upload'

After that, your game will show up normally in the list of uploaded bundles. You can use this call to integrate with your existing build system.

Hosting restrictions

Keep in mind Facebook hosting has several restrictions, most importantly:

  • Server-side logic (e.g. php) is not supported.
  • The total size of uploaded files may not exceed 200MB.
  • The number of files inside a single application upload may not exceed 500.

Check Web Hosting documentation for more details.

Testing the published build

Once you have a build in "production" you'll want to test that build, instead of the build running in your current local server. You can do it in either of these two ways.

1. Play your game on Facebook

To share your game in the News Feed, click the Share button in the Share Your Game section. This will allow you to share the game in the News Feed and test it from any surface (Desktop, iOS or Android).

2. Play your game on Messenger

In the Instant Games list in Messenger, you and your team (people who are assigned "Admin, "Developer" or "Tester" roles in your app) should have a list of all the games that are under construction. The list is called In development. This helps you test games in Messenger even if they are unpublished.

If you have associated a page with your game, you can also generate a shareable link. This link will take users to a conversation with your bot on Messenger and open the game automatically if you have a bot setup. If not, it will take users to your Page on Facebook and open the game automatically from there. Either way, anyone who clicks the link should be able to play the game right away.

Submit for App Review

Once you're happy with your published version, you need to submit your game to App Review so our team can evaluate it for quality and compliance to our Platform Policies.
Make sure to check our Release Checklist before submission and that your game meets all specified criteria. That guide also contains instructions of how to publish your game once it has been reviewed.

Next steps

Now that you know how to test and publish your game, check out our launch checklist before submitting your game: Instant Games Launch Checklist. Also please check our Best Practices section for recommendations on design and updates for your game.