To specify settings for your application, create a configuration file named fbapp-config.json in the root directory of your bundle. The settings in this file apply to all users to which the bundle is served, which means that you can target different audiences by launching different bundles along with different application settings.
The content of your fbapp-config.json configuration file should be a valid JSON object with the member sections described below.
Type: {instant_games: {platform_version: "RICH_GAMEPLAY"
, orientation: ("PORTRAIT"
| "LANDSCAPE"
), override_web_orientation: ("PORTRAIT"
| "LANDSCAPE"
), navigation_menu_version: ("NAV_BAR"
), custom_update_templates: {}, surfaceable_stats: {}, match_player_config: {min_context_size: number, max_context_size: number}}}
Properties
instant_games
{platform_version: "RICH_GAMEPLAY"
, orientation: ("PORTRAIT"
| "LANDSCAPE"
), override_web_orientation: ("PORTRAIT"
| "LANDSCAPE"
), navigation_menu_version: ("NAV_BAR"
), custom_update_templates: {}, surfaceable_stats: {}, match_player_config: {min_context_size: number, max_context_size: number}} instant_games.platform_version
"RICH_GAMEPLAY"
instant_games.orientation
("PORTRAIT"
| "LANDSCAPE"
) instant_games.override_web_orientation
("PORTRAIT"
| "LANDSCAPE"
) instant_games.navigation_menu_version
("NAV_BAR"
) instant_games.custom_update_templates
{} instant_games.surfaceable_stats
{} instant_games.match_player_config
{min_context_size: number, max_context_size: number} instant_games.match_player_config.min_context_size
number instant_games.match_player_config.max_context_size
number "Instant Games"-specific settings
Examples
{ "instant_games": { "custom_update_templates": { "first_place": { "example": "Player X just became the first place in game Y!" } }, "surfaceable_stats": { "rank": { "priority": 1, "order": 1, "label": { "localizations": { "en_US": "Rank", "th_TH": "\\u{0E22}\\u{0E28}" }, "fallback": "Rank" }, "values": { "0": "Unranked", "1": "Bronze", "2": "Silver", "3": "Gold" } } }, "orientation": "PORTRAIT", "override_web_orientation": "LANDSCAPE", "navigation_menu_version": "NAV_BAR", "match_player_config": { "min_context_size": 2, "max_context_size": 20 } } }
Indicates the orientation the game uses. Supported orientations: 'PORTRAIT' and 'LANDSCAPE'
Overrides the orientation the game uses on web. Supported orientations: 'PORTRAIT' and 'LANDSCAPE'
Indicates the platform navigation menu version the game should use.
The only navigation menu version that is currently supported is NAV_BAR
, which displays a fixed top bar menu above the game container.
Configures the templates for custom updates that the game can send out using the FBInstant.updateAsync API. The value of "custom_update_templates" should be an object, where the key is the ID of each template, and value is an object that configures the template. The value object should have the following properties: 'example' - a string example of what a custom update of this template will look like.
Examples
{ "instant_games": { "custom_update_templates": { "pass_score": { "example": "Kun just scored 100 and passed Alissa's highscore!" }, "play_turn": { "example": "Kun just played HELLO. Now it's Alissa's turn!" } } } }
// game.js FBInstant.updateAsync({ action: 'CUSTOM', template: 'play_turn', text: 'Kun just played HELLO. Now it\'s Alissa\'s turn!', image: '...', data: '...', })
Configures stats for the player that can be displayed. The value of "surfaceable_stats" should be an object, where the key is the ID of each stat, and value is an object that configures the stat for display. The value object should have the following properties: 'priority' - an integer representing how important it is for the stat to displayed compared to the others, where 1 is the highest priority. Multiple stats can have the same priority. 'order' - specifies where it should be displayed in a list relative to the other stats, where a value of 1 means it should go first. The order values of the stats should be consecutive integers starting at 1 with no duplicates. 'label' - an object with two properties: 'localizations': an object where each key is a Facebook locale and each value is the string to display as the stat's name if the viewer is in that locale. 'fallback': the string to show if the viewer's locale is not found in the localizations object. 'values' - used to display stat values as strings like "Silver" or "Deckswabber" instead of integers. This property should be an object where each key is a string representation of a number (eg "1") and each value is what to display if the stat equals that number (such as "Gold").
Examples
{ "instant_games": { "surfaceable_stats": { "rank": { "priority": 1, "order": 1, "label": { "localizations": { "en_US": "Rank", "th_TH": "\u{0E22}\u{0E28}", }, "fallback": "Rank" }, "values": { "0": "Unranked", "1": "Bronze", "2": "Silver", "3": "Gold", } } } } }
Configures various settings for the matchPlayerAsync API. Currently the only configurable settings are minimum and maximum context sizes, which describes how big of a Messenger thread the players may be matched into when using the matchPlayerAsync API. The config must provide both 'min_context_size' and 'max_context_size', or the default values will be used for both.
'min_context_size' - The minimum number of players be matched together. The range should be between 2 and 50. Default is 2. 'max_context_size' - The maximum number of players be matched together. The range should be between 2 and 50. Default is 20.