Rohan Verma
Rohan Verma

Reputation: 445

How to post on a facebook application user's facebook feed?

I have made a snake game using javascript and HTML5 Canvas element. It can be found at apps.facebook.com/snaqe_game. I have attained permissions and authorized the app for publish_feed or something using the Facebook Developer Documentation but the problem I am facing is while posting the player's score on his wall. Following the documentation given by FB, you get a Dialog that asks the user before publishing and he can edit the Post. In a game, if I want to post the player's score, I cannot let him edit his petty 100 point score to a 100,000 point score. I have seen many games made on facebook that let the application post the Score of the Player by just a press of a button.


Please See: apps.facebook.com/mg-copter NOTE: If you play the game on facebook, when you die you will be sent to a page submit.php which does not exist. You must refresh the whole page to replay.

Upvotes: 1

Views: 428

Answers (1)

Poli
Poli

Reputation: 2604

Using the Javascript SDK you can do something like:

var data = {
    method: 'stream.publish',
    display: 'iframe',
    message: 'Message Editable By User',
    attachment: {
        name: 'Title Not Editable By User',
        caption: 'Caption Not Editable By User',
        href: 'http://Link.To.Your.App'
    },
    action_links: [{
        text: 'Beat Me !',
        href: 'http://Link.To.Your.App' 
    }]
}
FB.ui(data);

You can play with the parameters until you get what you look for, but AFAIK you should not post to user's wall a message they can't edit or see.

Users will see a dialog with a predefined message they can edit (message attribute) and another part they cannot edit (attachment attribute).

Upvotes: 1

Related Questions