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.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.
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
Filters vs Suggestions:
filtersandsuggestionscannot be used together- Use
filtersto show only certain types of friends (app users vs non-users) - Use
suggestionsto prioritize specific friends in the dialog
Data Parameter:
- The
datafield 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
- Always check
canShow()before attempting to display the dialog - Handle cancellation gracefully - users may close the dialog
- Keep messages concise and engaging
- Use actionType appropriately for different request scenarios
- Include custom data to track request context
- Limit recipient lists to avoid overwhelming users
- 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
Related
- LoginManager - Authenticate users before sending requests
- AppEventsLogger - Track game request metrics
- Facebook Game Requests Documentation