Skip to main content
The GameRequestDialog module allows you to display a dialog for sending game requests to Facebook friends, inviting them to play your game or sending in-game gifts.

Import

Methods

canShow

Checks whether the game request dialog can be displayed.
Returns a Promise that resolves to true if the dialog can be shown, false otherwise. Example:

show

Displays the game request dialog with the specified content.
GameRequestContent
required
Configuration object defining the game request content, recipients, and behavior.
Returns a Promise that resolves to a GameRequestDialogResult object containing the request ID and recipient list.

Usage Examples

Simple Game Request

Send Request with Title

Send Gift to Friends

Ask for Items

Turn-Based Game Request

Send to Specific Recipients

Filter by App Users

Invite Non-Users

With Suggested Friends

Complete Example with Error Handling

TypeScript Types

GameRequestContent

Configuration for a game request.

ActionType

Defines the type of game request.

Filters

Controls which friends are displayed in the selector.

GameRequestDialogResult

Result object returned when the dialog completes.

Important Notes

Action Type Requirements:
  • When using actionType: 'send' or actionType: 'askfor', the objectId parameter is required
  • The objectId refers to an Open Graph object representing the item being sent or requested
Filters vs Suggestions:
  • filters and suggestions cannot be used together
  • Use filters to show only certain types of friends (app users vs non-users)
  • Use suggestions to prioritize specific friends in the dialog
Data Parameter:
  • The data field has a maximum length of 255 characters
  • Use it to pass custom tracking information or game state
  • Consider using JSON.stringify() for structured data

Best Practices

  1. Always check canShow() before attempting to display the dialog
  2. Handle cancellation gracefully - users may close the dialog
  3. Keep messages concise and engaging
  4. Use actionType appropriately for different request scenarios
  5. Include custom data to track request context
  6. Limit recipient lists to avoid overwhelming users
  7. Test with both app users and non-users to verify filters work correctly

Common Use Cases

  • Invite friends to download and play your game
  • Send gifts or bonuses to existing players
  • Request help with challenging levels or tasks
  • Challenge friends to beat your score
  • Notify turn-based game opponents when it’s their turn
  • Share achievements and invite friends to compete