Search code examples
javascriptfacebookpermissionsfacebook-wall

Prompt (or not) the user to publish a story to a profile's feed in Javascript


I'm doing an app which loads as tab (iframe) inside a Page
I'm using both, PHP and JS SDK, latest I've been able to post to user's wall with PHP, after user authorized stream_publish, etc. permissions

Now my problem is to post to user's wall when he clics one of the buttons showed in my tab.
I'm trying this code:

function post_wall()
{
    FB.ui(
    {
        method: 'feed',
        name: 'Publish example of www.compilaron.com',
        link: 'http://example.com/myapp/files/506625449_thumb.jpg',
        picture: 'http://example.com/myapp/files/506625449_thumb.jpg',
        caption: 'Example caption',
        description: 'Example description to test the post',
        message: 'Facebook Dialogs are not easy!',
        redirect_uri: 'http://www.facebook.com/myFanPage?sk=app_ID'
    },
    function(response) {
        if (response && response.post_id) 
        {
            alert('Post was published in Wall.' );//+ response.toSource());
        } 
        else 
        {
            alert('Post was not published in Wall.' );//+ response.toSource());
        }
    });
}

First, I got api error 191. Then added redirect_uri parameter and now getting api error 100. Seems like the code I'm using is old, but can't find some code that can publish to user's wall without leaving the fanpage, redirecting and going back stuff (as stated in the following url)

https://developers.facebook.com/docs/reference/dialogs/feed/

Also, If you have a JS code to post directly to user's feed, no probs, user granted permissions...

Any ideas?
Thanks


Solution

  • I guess I found a solution to my problems.

    A complete facebook iframe application with examples of posting share dialog, status update, with ajax, etc. in php and js...

    http://thinkdiff.net/facebook/iadvance-graph-api-iframe-base-facebook-page-app-development/