Create a post in the user's activity feed
showFeedPostBox(content)
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]
Feed Posts
This feature displays a dialog requesting permission to make a feed post to a player's wall on behalf of the game. If the player is not authenticated, it will require the player to authenticate before displaying the dialog.
The player may optionally allow all posts from your game. If the player choses to enable that feature, then this will automatically make a post on that player's wall without invoking the dialog.
The showFeedPostBox
method takes a content argument, which can either be a string containing the text to place into the feed, or an object that contains properties defining the content, image, and parameters to be passed into the game. It fires a callback once the dialog is closed.
Name | Type | Description |
---|---|---|
content | String or Object | A string containing the text for the feed post, or an object with content , image_uri , and kv_params fields. |
callback | Function | A callback method which will be called with an object containing type , recipients , success , and error fields. |
Note
While the game is not published (in "preview" mode), the post will not actually show on the user's feed. This is to avoid confusion around games that aren't public sending out messages. As long as you get the pop-up friend selection box and confirmation the API is integrated correctly
Making a Feed Post
Feed posts are composed of two components: the content of the feed post, and (optionally) an image URI that you specify. If you do not specify an image URI, then the game's icon will be used instead.
Basic Feed Posts
If you don't need a custom image, you may invoke showFeedPostBox with a string containing the post content:
kongregate.services.showFeedPostBox("Praise the Sun!", function(result:Object):void {
trace("Success: " + result.success);
});
kongregate.services.showFeedPostBox("Praise the Sun!", function(result) {
console.log("Success: " + result.success);
});
Using a Custom Image and Parameters
If you wish to specify a custom image and parameters to be passed into the game when clicked, then you will need to pass in an object with the properties:
Name | Type | Description |
---|---|---|
content | String | The text content for the feed post |
image_uri | String | Link to an image to use as an icon for the feed post |
kv_params | Object | Optional parameters to be passed into the game when the feed post link is followed |
Example: Complex feed post:
kongregate.services.showFeedPostBox({
content: "Come help defeat the boss!",
image_uri: "http://your-domain.tld/feed-post-images/really-hard-boss-face.png",
kv_params: { kv_promo_code: 12345 }
}, function(result:Object):void {
trace("Success: " + result.success);
});
kongregate.services.showFeedPostBox({
content: "Come help defeat the boss!",
image_uri: "http://your-domain.tld/feed-post-images/really-hard-boss-face.png",
kv_params: { kv_promo_code: 12345 }
}, function(result) {
console.log('Success: ' + success);
});