{"__v":0,"_id":"570bdf8b504b0917009585e3","category":{"project":"56abbf55f25f160d00e17f4e","version":"56abbf55f25f160d00e17f51","_id":"570a5676ade45d0e00c1ad33","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-04-10T13:34:46.864Z","from_sync":false,"order":3,"slug":"client-side-api","title":"Client Side API"},"parentDoc":null,"project":"56abbf55f25f160d00e17f4e","user":"56abbec30b9e0b0d00616274","version":{"__v":12,"_id":"56abbf55f25f160d00e17f51","project":"56abbf55f25f160d00e17f4e","createdAt":"2016-01-29T19:36:53.665Z","releaseDate":"2016-01-29T19:36:53.665Z","categories":["56abbf56f25f160d00e17f52","56abca6bf9757e0d007c6650","56acddfa0ab3c00d00ce3332","56af65da9d32e30d0006d30f","56af66cab34d210d003d9ad0","56af6afcd21e9c0d00b628d1","56af6d6ecc4cbd0d00ce2c88","5705b12221cfed0e00e8c580","570a5676ade45d0e00c1ad33","570d7d25d1e4b82000d9e385","570eac3c3160d10e0041df0e","575709000fd6a3200010dded"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-11T17:31:55.399Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":22,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Note\",\n  \"body\": \"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 [apps:::at:::kongregate.com](mailto:apps@kongregate.com).\"\n}\n[/block]\n## Invite Friends\n\nThis 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.\n\nThe 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.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`invitation`\",\n    \"0-1\": \"Object\",\n    \"0-2\": \"An object containing fields describing the invitation\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\nThe `invitation` object can contain the following fields:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`content`\",\n    \"0-1\": \"String\",\n    \"0-2\": \"The text content of the invitation\",\n    \"1-0\": \"`filter`\",\n    \"1-1\": \"String\",\n    \"1-2\": \"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.\",\n    \"2-0\": \"`kv_params`\",\n    \"2-1\": \"Object\",\n    \"2-2\": \"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\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n**Example** Simple invitation:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"kongregate.services.showInvitationBox({\\n  content: \\\"Come try out this awesome game!\\\"\\n});\",\n      \"language\": \"haxe\",\n      \"name\": \"ActionScript 3\"\n    },\n    {\n      \"code\": \"kongregate.services.showInvitationBox({\\n  content: \\\"Come try out this awesome game!\\\"\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**Example** Only invite players who have never played:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"kongregate.services.showInvitationBox({\\n  content: \\\"Come try out this awesome game!\\\",\\n  filter: \\\"not_played\\\",\\n  kv_params: { kv_promo_code: 12345 }\\n});\",\n      \"language\": \"haxe\",\n      \"name\": \"ActionScript 3\"\n    },\n    {\n      \"code\": \"kongregate.services.showInvitationBox({\\n  content: \\\"Come try out this awesome game!\\\",\\n  filter: \\\"not_played\\\",\\n  kv_params: { kv_promo_code: 12345 }\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"JavaScript\"\n    }\n  ]\n}\n[/block]","excerpt":"Invite other users to play a game\n`showInvitationBox(invitation)`","slug":"client-api-services-showinvitationbox","type":"fn","title":"Services.ShowInvitationBox"}

fnServices.ShowInvitationBox

Invite other users to play a game `showInvitationBox(invitation)`

[block:callout] { "type": "warning", "title": "Note", "body": "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 [apps@kongregate.com](mailto:apps@kongregate.com)." } [/block] ## 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. [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`invitation`", "0-1": "Object", "0-2": "An object containing fields describing the invitation" }, "cols": 3, "rows": 1 } [/block] The `invitation` object can contain the following fields: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`content`", "0-1": "String", "0-2": "The text content of the invitation", "1-0": "`filter`", "1-1": "String", "1-2": "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.", "2-0": "`kv_params`", "2-1": "Object", "2-2": "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" }, "cols": 3, "rows": 3 } [/block] **Example** Simple invitation: [block:code] { "codes": [ { "code": "kongregate.services.showInvitationBox({\n content: \"Come try out this awesome game!\"\n});", "language": "haxe", "name": "ActionScript 3" }, { "code": "kongregate.services.showInvitationBox({\n content: \"Come try out this awesome game!\"\n});", "language": "javascript" } ] } [/block] **Example** Only invite players who have never played: [block:code] { "codes": [ { "code": "kongregate.services.showInvitationBox({\n content: \"Come try out this awesome game!\",\n filter: \"not_played\",\n kv_params: { kv_promo_code: 12345 }\n});", "language": "haxe", "name": "ActionScript 3" }, { "code": "kongregate.services.showInvitationBox({\n content: \"Come try out this awesome game!\",\n filter: \"not_played\",\n kv_params: { kv_promo_code: 12345 }\n});", "language": "javascript", "name": "JavaScript" } ] } [/block]