Invite other users to play a game
showInvitationBox(invitation)

🚧

Note

This feature will not function unless we have enabled it for your game. If you would like to have this feature enabled, please email us at [email protected].

Invite Friends

This feature displays a dialog requesting the player send a Private Message to their friends inviting them to try your game. If the player is not authenticated, it will require the player to authenticate before displaying the dialog.

The Private Message includes a game specific message you provide and some text the player may enter in the dialog. The dialog includes an interface for selecting up to 20 friends and other Kongregate members to invite and a Text Field to edit a message. An optional filter parameter may be used to narrow the list of invitees to those that have or have not played the game.

Name

Type

Description

invitation

Object

An object containing fields describing the invitation

The invitation object can contain the following fields:

Name

Type

Description

content

String

The text content of the invitation

filter

String

Optional parameter. If set to played, the dialog will only allow the player to select users that have played the game. When set to not_played, the dialog will only the player to select users that have never played the game. You can also pass a list of user IDs as the filter, and it will only show those users ex "123 8219". When left blank, all users will be available to invite.

kv_params

Object

An optional object containing parameters to be included in the game link. They must all be prepended with kv_ to be passed through to the game

Example Simple invitation:

kongregate.services.showInvitationBox({
  content: "Come try out this awesome game!"
});
kongregate.services.showInvitationBox({
  content: "Come try out this awesome game!"
});

Example Only invite players who have never played:

kongregate.services.showInvitationBox({
  content: "Come try out this awesome game!",
  filter: "not_played",
  kv_params: { kv_promo_code: 12345 }
});
kongregate.services.showInvitationBox({
  content: "Come try out this awesome game!",
  filter: "not_played",
  kv_params: { kv_promo_code: 12345 }
});