Instant Games

Custom Updates

Updated: Nov 5, 2026
Copy for LLM
Custom Updates let your game send rich, interactive messages
This guide covers what custom updates are, the different types and strategies available, the SDK API, payload format, customization options, rate limiting policies, and best practices for creating effective updates.
Note: The examples on this page use SDK 8.0, which removes FBInstant.player.getName() and FBInstant.player.getPhoto(). Under Zero Permissions, player names and photos are not accessible in your game code. To include player data in update text and images, use template expressions like {{FBInstant.player.name}} and overlay-enhanced updates. See Custom Updates, Invites, and Shares for details.

What Are Custom Updates?

A custom update is a structured message that your game sends to one or more players through the Facebook platform. Unlike generic notifications, custom updates are rich and interactive -- they can include:
  • A custom image (screenshot, achievement badge, challenge graphic)
  • Personalized text (player names, scores, game-specific context)
  • An action button with a call-to-action (“Play Now,” “Beat This Score,” “Accept Challenge”)
  • Embedded data that your game can read when the recipient opens the update
Custom updates appear in the conversation thread or context where the game is being played. When a recipient taps on an update, they are taken directly into your game with the embedded data available, allowing you to deep-link them to specific content or actions.

Common Use Cases

  • Challenges: “Sarah scored 2,450 points. Can you beat it?” with a “Play Now” button
  • Turn notifications: “It’s your turn! Mike just made their move.” with a “Take Your Turn” button
  • Achievements: “Sarah just reached Level 25!” shared with the game group
  • Re-engagement: “Your daily reward is ready! Come back and claim it.” with a “Claim Reward” button
  • Score updates: “New high score! Sarah scored 5,000 points on Endless Mode.” shared to the context

Update Templates

The template field in updateAsync() is a string identifier that you define in the fbapp-config.json file bundled with your game’s assets. Templates serve two purposes:
  • App review: The example text helps reviewers understand what your updates will look like.
  • Analytics: The template name is logged so you can track the performance of different update types in your analytics.
Templates do not perform any text substitution of their own. The text field you pass to updateAsync() is displayed to recipients as you provide it, with one exception: template expressions such as {{FBInstant.player.name}} are resolved by Meta at render time.

Defining templates in fbapp-config.json

Add a custom_update_templates object under instant_games in your fbapp-config.json, alongside the required navigation_menu_version field. Each key is a template identifier, and the value is an object with a required example field:
{
  "instant_games": {
    "navigation_menu_version": "NAV_BAR",
    "custom_update_templates": {
      "score_challenge": {
        "example": "Sarah just scored 2,450 points! Can you beat it?"
      },
      "turn_notification": {
        "example": "It's your turn! Mike just made their move."
      },
      "daily_reward": {
        "example": "Your daily reward is ready! Come back and claim it."
      },
      "level_complete": {
        "example": "Sarah just reached Level 25! Can you catch up?"
      }
    }
  }
}
Schema:
FieldTypeRequiredDescription
<template_id>
string (key)
Yes
A unique identifier for the template. This is the value you pass as the template field in updateAsync().
example
string
Yes
A human-readable example of what an update using this template looks like. Used for app review. Not displayed to players.
Validation rules:
  • The custom_update_templates field is optional. If omitted, no error occurs.
  • If present, it must be an object. Each value must also be an object containing a string example field.
  • Invalid entries (missing example, wrong types) produce build errors when you upload your game bundle.

Using templates with updateAsync()

When you call updateAsync(), set the template field to one of the keys you defined in fbapp-config.json. The actual message content comes from the text field, which you construct yourself:
await FBInstant.updateAsync({
  action: 'CUSTOM',
  template: 'score_challenge',  // Matches a key in fbapp-config.json
  text: {
    default: `{{FBInstant.player.name}} scored ${score} points! Can you beat it?`,
  },
  image: challengeImage,
  cta: 'Beat This Score!',
  strategy: 'IMMEDIATE',
  notification: 'PUSH',
  data: { challengeScore: score },
});

Including player names in updates

SDK 8.0 removes FBInstant.player.getName() and FBInstant.player.getPhoto(), so your game code cannot read player names or photos. Instead, write template expressions into your update content and Meta resolves them at render time. The name never passes through your game.
Sender name: Use {{FBInstant.player.name}} anywhere in the text field. In an update, it resolves to the player who sent the update.
await FBInstant.updateAsync({
  action: 'CUSTOM',
  template: 'score_challenge',
  text: {
    default: `{{FBInstant.player.name}} just scored ${score} points! Think you can beat it?`,
  },
  imageOverlayPath: 'overlays/score_card.xml',
  pathToCSS: 'overlays/styles.css',
  initialData: { score: score },
  strategy: 'IMMEDIATE',
  notification: 'PUSH',
});
The overlay XML renders the sender’s name and photo into the update image:
<View className="scoreCard">
  <Image src="{{FBInstant.player.photo}}" className="avatar" />
  <Text content="{{FBInstant.player.name}} scored {{score}} points!" className="scoreText" />
</View>
Other player names: Use FBInstant.context.getPlayersAsync() to retrieve the players in the current context (for example, a Messenger thread). In SDK 8.0, those player objects expose only getID() -- no names or photos. Pass the ID into your overlay through initialData and render the name with {{FBInstant.players[PLAYER_ID].name}}.
async function sendTurnNotification() {
  const players = await FBInstant.context.getPlayersAsync();
  const nextPlayerID = pickNextPlayer(players.map(player => player.getID()));

  // Note: you cannot target a single recipient. The text you provide here
  // is what all players in the context will see.
  await FBInstant.updateAsync({
    action: 'CUSTOM',
    template: 'turn_notification',
    text: {
      default: '{{FBInstant.player.name}} just made their move. Your turn!',
    },
    imageOverlayPath: 'overlays/turn_card.xml',
    pathToCSS: 'overlays/styles.css',
    initialData: { nextPlayerID: nextPlayerID },
    cta: 'Take Your Turn',
    strategy: 'IMMEDIATE',
    notification: 'PUSH',
    data: { lastMove: currentMove },
  });
}
<View className="turnCard">
  <Image src="{{FBInstant.player.photo}}" className="avatar" />
  <Text content="{{FBInstant.player.name}} played. {{FBInstant.players[{{nextPlayerID}}].name}} is up next!" />
</View>
Leaderboard-style updates with multiple player names: Pass a list of player IDs and scores in initialData and loop over it in the overlay with <For>. Your game only ever handles IDs.
async function sendLeaderboardUpdate(topScores) {
  await FBInstant.updateAsync({
    action: 'CUSTOM',
    template: 'level_complete',
    text: {
      default: `{{FBInstant.player.name}} just finished Level ${level}!`,
    },
    imageOverlayPath: 'overlays/leaderboard_card.xml',
    pathToCSS: 'overlays/styles.css',
    // Each entry holds a player ID and a score -- never a name
    initialData: { entries: topScores },
    cta: 'Play Now',
    strategy: 'LAST',
    notification: 'NO_PUSH',
    data: { level: level },
  });
}
<View className="leaderboard">
  <For source="{{entries}}" itemName="e" sortKey="score" order="DESC" limit="5">
    <View className="row">
      <Image src="{{FBInstant.players[{{e.id}}].photo}}" className="avatar" />
      <Text content="{{FBInstant.players[{{e.id}}].name}}: {{e.score}}" />
    </View>
  </For>
</View>
Note: Custom updates are sent to the current game context (for example, the Messenger thread). You cannot target a specific recipient. The text you provide is displayed to all participants in the context, so template expressions that name a specific player are visible to everyone in the context.

Sending Custom Updates

Use FBInstant.updateAsync() to send a custom update. This method accepts a payload object that defines the update’s content and behavior.

Basic Example

async function sendScoreUpdate(score) {
  try {
    await FBInstant.updateAsync({
      action: 'CUSTOM',
      cta: 'Beat My Score!',
      image: generateScoreImage(score), // Must be a base64-encoded image
      // Overlay the sender's name and photo onto the image
      imageOverlayPath: 'overlays/score_card.xml',
      pathToCSS: 'overlays/styles.css',
      initialData: { score: score },
      text: {
        default: `{{FBInstant.player.name}} just scored ${score} points! Think you can beat me?`,
        localizations: {
          es_LA: `{{FBInstant.player.name}} acaba de anotar ${score} puntos! Crees que puedes ganarme?`,
          pt_BR: `{{FBInstant.player.name}} acabou de marcar ${score} pontos! Acha que pode me vencer?`,
        },
      },
      template: 'score_challenge',
      data: {
        myScore: score,
        challengeType: 'score_beat',
      },
      strategy: 'IMMEDIATE',
      notification: 'PUSH',
    });
    console.log('Update sent successfully!');
  } catch (error) {
    console.error('Failed to send update:', error);
  }
}

Update Payload Format

The payload object passed to updateAsync() has the following fields:
FieldTypeRequiredDescription
action
string
Yes
The type of update. Use 'CUSTOM' for custom updates. Other values include 'LEADERBOARD' for leaderboard updates.
cta
string
No
The text displayed on the action button (call-to-action). For example, 'Play Now', 'Beat My Score!', or 'Accept Challenge'. If omitted, a default CTA may be used.
image
string
Conditional
A base64-encoded image string that serves as the visual content of the update. The image should be a data URI (e.g., 'data:image/png;base64,...'). Recommended size is 1200x628 pixels. At least one of image or imageOverlayPath is required.
imageOverlayPath
string
Conditional
Path to an XML overlay file that Meta renders on top of the update image. This is how you include player names and photos, which SDK 8.0 does not expose to your game code. At least one of image or imageOverlayPath is required.
pathToCSS
string
No
Path to a CSS file that styles the XML overlay. Required if the overlay XML uses className.
initialData
object
No
Data object supplying values for template expressions in the overlay XML (for example, {{score}}).
text
object
Yes
The text content of the update. Must include a default key with the text string. Can optionally include a localizations object for translated versions. Template expressions such as {{FBInstant.player.name}} are resolved at render time, in default and in localizations.
template
string
Yes
A string identifier for this update type, matching a key in the custom_update_templates object in your fbapp-config.json. Used for analytics tracking.
data
object
No
A JSON-serializable object containing custom data. This data is available to your game when the recipient opens the update, allowing you to deep-link to specific content. Maximum size is 1000 characters when serialized.
strategy
string
No
Determines when the update is delivered. See the Strategy section below.
notification
string
No
Controls whether a push notification is sent. See the Notification section below.
aiDisclosure
string
No
Declares whether the image, GIF, or video was generated or edited with AI: 'AI_GENERATED' or 'NOT_AI_GENERATED'. Required starting December 15, 2026, for most games. See AI-generated media.

Strategy Options

The strategy field controls how the update is delivered:
ValueDescription
'IMMEDIATE'
The update is sent immediately and appears in the conversation thread right away. Use this for time-sensitive updates like challenges or turn notifications.
'LAST'
Only the most recent update with this strategy is shown. If multiple LAST updates are sent, only the newest one is visible. Use this for status updates where only the latest state matters (e.g., current score).
'IMMEDIATE_CLEAR'
The update is sent immediately. When the recipient opens the game, this update and all previous IMMEDIATE_CLEAR updates are removed from the conversation. Use this for transient information that becomes irrelevant once the player opens the game.

Notification Options

The notification field controls push notification behavior:
ValueDescription
'NO_PUSH'
No push notification is sent. The update appears in the conversation but does not alert the recipient’s device. Use this when the player is likely already engaged or when the update is low-priority.
'PUSH'
A push notification is sent to the recipient’s device. Use this for important, actionable updates like challenges, turn notifications, or time-sensitive events.

Image Customization

The image field is one of the most important parts of your custom update. A compelling, visually clear image dramatically increases the likelihood that a recipient will tap on the update.

Image Requirements

  • Format: Base64-encoded data URI (e.g., 'data:image/png;base64,...' or 'data:image/jpeg;base64,...')
  • Recommended size: 1200 x 628 pixels (the standard Open Graph image size)
  • Maximum file size: Keep images under 300 KB for fast loading
  • Content: The image should clearly communicate the update’s purpose -- a score, a challenge, an achievement, or a game moment

Generating Images Dynamically

Many games generate update images dynamically using an HTML5 canvas. In SDK 8.0 the canvas can draw everything except player data -- names and photos are not available to your game code. Draw the game content on the canvas, then layer the sender’s name and photo on top with imageOverlayPath.
function generateChallengeImage(score) {
  const canvas = document.createElement('canvas');
  canvas.width = 1200;
  canvas.height = 628;
  const ctx = canvas.getContext('2d');

  // Draw background
  ctx.fillStyle = '#1a1a2e';
  ctx.fillRect(0, 0, canvas.width, canvas.height);

  // Draw title
  ctx.fillStyle = '#ffffff';
  ctx.font = 'bold 48px Arial';
  ctx.textAlign = 'center';
  ctx.fillText('Challenge!', canvas.width / 2, 200);

  // Draw score
  ctx.font = 'bold 96px Arial';
  ctx.fillStyle = '#e94560';
  ctx.fillText(score.toLocaleString(), canvas.width / 2, 350);

  // Leave room at y=460 for the overlay that renders the sender's name
  return canvas.toDataURL('image/png');
}
The sender’s name and photo come from the overlay (overlays/challenge_card.xml):
<View className="challengeCard">
  <Image src="{{FBInstant.player.photo}}" className="avatar" />
  <Text content="{{FBInstant.player.name}} dares you to beat this score!" className="challengeText" />
</View>
// Usage:
await FBInstant.updateAsync({
  action: 'CUSTOM',
  template: 'score_challenge',
  image: generateChallengeImage(2450),
  imageOverlayPath: 'overlays/challenge_card.xml',
  pathToCSS: 'overlays/styles.css',
  text: { default: '{{FBInstant.player.name}} dares you to beat this score!' },
  strategy: 'IMMEDIATE',
  notification: 'PUSH',
});
Note: Overlay views cannot load images from an external CDN, even one on your CSP allowlist. Use a path inside your game bundle, a template expression such as {{FBInstant.player.photo}}, or a base64 data URL passed through initialData.

Reading Update Data on Launch

When a player taps on a custom update and enters your game, you can retrieve the embedded data from the update using FBInstant.getEntryPointData(). This allows you to deep-link the player to the appropriate screen or action.
async function handleEntryPoint() {
  await FBInstant.initializeAsync();

  const entryPointData = FBInstant.getEntryPointData();

  if (entryPointData) {
    console.log('Entered from a custom update:', entryPointData);

    if (entryPointData.challengeType === 'score_beat') {
      // Player entered from a score challenge
      showChallengeScreen(entryPointData.myScore, entryPointData.challengerId);
    } else if (entryPointData.giftType === 'daily_reward') {
      // Player entered from a reward notification
      showRewardScreen();
    }
  } else {
    // Player entered normally (not from an update)
    showMainMenu();
  }

  await FBInstant.startGameAsync();
}

Localization

Custom updates support localization through the text.localizations object. Providing translations for your most common player locales ensures that your updates feel native and personal regardless of the recipient’s language.
Template expressions are resolved in localized strings as well, so use {{FBInstant.player.name}} in every translation.
await FBInstant.updateAsync({
  action: 'CUSTOM',
  cta: 'Play Now',
  image: challengeImage,
  text: {
    default: '{{FBInstant.player.name}} challenged you! Can you score higher?',
    localizations: {
      en_US: '{{FBInstant.player.name}} challenged you! Can you score higher?',
      es_LA: '{{FBInstant.player.name}} te ha retado! Puedes superar su puntaje?',
      pt_BR: '{{FBInstant.player.name}} te desafiou! Consegue fazer mais pontos?',
      fr_FR: '{{FBInstant.player.name}} vous a defie! Pouvez-vous faire mieux?',
      de_DE: '{{FBInstant.player.name}} hat dich herausgefordert! Kannst du mehr Punkte erzielen?',
      ja_JP: '{{FBInstant.player.name}}があなたに挑戦しました!もっと高いスコアを出せますか?',
    },
  },
  template: 'friend_challenge',
  data: { challengeScore: score },
  strategy: 'IMMEDIATE',
  notification: 'PUSH',
});

Rate Limiting and Policies

Facebook enforces rate limits on custom updates to protect players from spam and ensure a positive experience. Understanding these limits is important for designing your update strategy.

Rate Limit Guidelines

  • Per-player limits: There is a maximum number of custom updates that can be sent to a single player within a given time window. If you exceed this limit, updateAsync() will reject with an error.
  • Per-context limits: Updates sent within a single context (e.g., a Messenger thread) are also subject to limits.
  • Push notification limits: Updates with notification: 'PUSH' are subject to stricter limits than those with notification: 'NO_PUSH'. Use push notifications judiciously.
  • Aggregate limits: Your app has an overall daily limit on the total number of updates that can be sent across all players.

Content Policies

  • No spam. Do not send updates that are repetitive, irrelevant, or not driven by genuine gameplay events. Updates should always be the result of a player action.
  • No misleading content. Update text and images must accurately represent the game content. Do not use clickbait or deceptive messaging.
  • No prohibited content. Updates must comply with Facebook’s Platform Policies and Community Standards⁠.
  • Player-initiated. Updates should be the result of an action the player took (e.g., completing a level, achieving a high score). Do not send updates automatically without a player trigger.

Handling Rate Limit Errors

async function sendUpdateSafely(payload) {
  try {
    await FBInstant.updateAsync(payload);
    console.log('Update sent successfully');
    return true;
  } catch (error) {
    if (error.code === 'RATE_LIMITED') {
      console.warn('Rate limited. Update not sent.');
      // Optionally queue the update for later
      return false;
    }
    console.error('Update failed:', error);
    return false;
  }
}

Best Practices

Make Updates Actionable

Every update should give the recipient a clear reason to open the game. “I played your game” is not actionable. “I just beat your high score -- can you take it back?” gives the recipient a specific, personal motivation to act.

Use High-Quality Images

The image is the first thing a player sees. Invest time in creating visually appealing, informative images that stand out in a conversation thread. Include relevant game data (scores, levels, achievements) directly in the image.

Personalize the Text

Use the player’s name and specific game data in your update text. Personalized messages feel like they were written for the recipient, not generated by a bot. The difference between “Come play!” and “Mike, Sarah just passed your score of 2,100 -- are you going to let that stand?” is enormous. Use {{FBInstant.player.name}} for the sender’s name, and FBInstant.context.getPlayersAsync() plus {{FBInstant.players[PLAYER_ID].name}} for other players in the context. See Including player names in updates for code examples.

Time Updates to Gameplay Moments

Send updates immediately after meaningful gameplay events -- a new high score, a completed level, a tournament result. These are the moments when the sender is most excited and the content is most relevant.

Use the Right Strategy

Choose the appropriate strategy value for each type of update:
  • Use IMMEDIATE for time-sensitive, one-off events (challenges, turn notifications)
  • Use LAST for status updates where only the current state matters (current score, current level)
  • Use IMMEDIATE_CLEAR for transient information (game invitations, temporary offers)

Use Push Notifications Sparingly

Reserve notification: 'PUSH' for updates that truly deserve to interrupt the recipient’s day -- a direct challenge from a friend, a turn notification in an active game, or a time-sensitive tournament. Overusing push notifications will cause players to mute your game.

Include Meaningful Data

Use the data field to pass context that your game can use when the recipient opens the update. This allows you to create deep-linked experiences -- jumping directly to a challenge, showing a specific leaderboard, or displaying a reward.

Test Across Surfaces

Custom updates may appear differently on different platforms (iOS, Android, web) and in different conversation types (1:1, group, game context). Test your updates across all surfaces to ensure they look good and function correctly everywhere.

Provide a Fallback Experience

If a player opens your game from an update but the entry point data is missing or invalid (e.g., the challenge has expired), provide a graceful fallback. Show the main menu or a relevant screen rather than an error message.

Complete Code Example

Here is a complete example that demonstrates sending a challenge update after a gameplay session and handling the incoming challenge on the other end:
// --- Sending a challenge ---

async function onGameOver(finalScore) {
  // Show the player's score
  showScoreScreen(finalScore);

  // Generate a challenge image -- game art only, no player data
  const challengeImage = generateChallengeImage(finalScore);

  // Offer to send a challenge
  const shouldChallenge = await showChallengePrompt();

  if (shouldChallenge) {
    try {
      await FBInstant.updateAsync({
        action: 'CUSTOM',
        cta: 'Beat This Score!',
        image: challengeImage,
        // The overlay renders the challenger's name and photo
        imageOverlayPath: 'overlays/challenge_card.xml',
        pathToCSS: 'overlays/styles.css',
        initialData: { score: finalScore },
        text: {
          default: `{{FBInstant.player.name}} scored ${finalScore.toLocaleString()} points! Can you beat it?`,
        },
        template: 'score_challenge',
        data: {
          challengeScore: finalScore,
          // Pass the ID only -- the recipient resolves the name in an overlay
          challengerId: FBInstant.player.getID(),
        },
        strategy: 'IMMEDIATE',
        notification: 'PUSH',
      });
      showMessage('Challenge sent!');
    } catch (error) {
      if (error.code === 'RATE_LIMITED') {
        showMessage('You have sent too many challenges recently. Try again later.');
      } else if (error.code === 'SAME_CONTEXT') {
        showMessage('Could not send challenge in this context.');
      } else {
        console.error('Challenge failed:', error);
      }
    }
  }
}

// --- Receiving a challenge ---

async function initializeGame() {
  await FBInstant.initializeAsync();
  FBInstant.setLoadingProgress(100);
  await FBInstant.startGameAsync();

  const entryData = FBInstant.getEntryPointData();

  if (entryData && entryData.challengeScore !== undefined) {
    // Player entered from a challenge. The challenger's name is not readable
    // in game code, so render it in an overlay view from their ID.
    const overlay = await FBInstant.overlayViews.createOverlayViewAsync(
      'overlays/incoming_challenge.xml',
      document.getElementById('challengeBanner'),
      'width: 100%; height: 80px; border: none;',
      'overlays/styles.css',
      {
        challengerId: entryData.challengerId,
        challengeScore: entryData.challengeScore,
      }
    );
    await overlay.showAsync();

    startGameWithTarget(entryData.challengeScore);
  } else {
    // Normal game start
    startNormalGame();
  }
}

initializeGame();
overlays/incoming_challenge.xml:
<View className="incomingChallenge">
  <Image src="{{FBInstant.players[{{challengerId}}].photo}}" className="avatar" />
  <Text content="{{FBInstant.players[{{challengerId}}].name}} scored {{challengeScore}} points. Beat that!" />
</View>

Next Steps