Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Facebook Graph to simply post a wall message with just javascript

In Facebook how can I post a message onto a user's wall saying "I scored 8/10 on objects game" then a URL?

I really don't want to have to use the full API, as I don't want to handle user login details. I don't mind if Facebook needs to authenticate and then post the message.

Is it possible using the new Graph API and JavaScript?

like image 714
Glycerine Avatar asked Apr 27 '10 20:04

Glycerine


People also ask

Is Facebook Graph API deprecated?

API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.


1 Answers

Note 4/16/2011: stream.publish seems to have been deprecated, There's a new way to do this: http://developers.facebook.com/docs/reference/dialogs/feed/

You can use something like this to publish to a wall, the user will need to confirm before it get sent. Don't forget that you'll need to use FB.init and include the JS SDK link.

 function fb_publish() {      FB.ui(        {          method: 'stream.publish',          message: 'Message here.',          attachment: {            name: 'Name here',            caption: 'Caption here.',            description: (              'description here'            ),            href: 'url here'          },          action_links: [            { text: 'Code', href: 'action url here' }          ],          user_prompt_message: 'Personal message here'        },        function(response) {          if (response && response.post_id) {            alert('Post was published.');          } else {            alert('Post was not published.');          }        }      );     } 
like image 126
Soufiane Hassou Avatar answered Oct 06 '22 02:10

Soufiane Hassou