Facebook breaking changes to post on users wall

| | August 6, 2015

I am working currently on an application to post on Facebook wall automatically.
I went through all blogs and articles that talking about this type of applications.
Finally I came out with this result. Firstly I have to authenticate the user and grant the required permissions such as shown in my JavaScript code below:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

<div id="fb-root"></div>
<script type="text/javascript">


var appId = "xxxxxxxxxxxxx";
var redirectUrl = "http://www.mydomain.com";

if (0 <= window.location.href.indexOf ("error_reason"))
$(document.body).append ("<p>Authorization denied!</p>");

window.fbAsyncInit = function(){

appId : appId,
status : true,
cookie : true,
oauth : true,
channel: true,
channelURL: "http://www.mydomain.com/channel/"

FB.getLoginStatus (onCheckLoginStatus);

var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";

function onCheckLoginStatus (response)
if (response.status != "connected")
top.location.href = "https://www.facebook.com/dialog/oauth?client_id=" + appId + "&redirect_uri=" + encodeURIComponent (redirectUrl) + "&scope=publish_stream,email,user_birthday,publish_actions,offline_access";
// Start the application (this is just demo code)! ///////////////////////////////////
$(document.body).append ("<p>Authorized!</p>");
FB.api('/me', function (response) {
$(document.body).append ("<pre>" + JSON.stringify (response, null, "t") + "</pre>");


After the user’s session has been successfully authenticated and he accepted my permissions requests to post on his behalf, it comes to the hardest piece of code which I worked around for more than two weeks moving from one site to another one. But it’s useless.

I found the following code to publish posts but only on the currently logged-in user’s wall:

<script type="text/javascript">

    function updateStatusViaJavascriptAPICalling(){
        var status  =   document.getElementById('status').value;
            FB.api('/me/feed', 'post', { message: status }, function(response) {
                if (!response || response.error) {
                     alert('Error occured');
                } else {
                     alert('Status updated Successfully');

It works like a charm but when I change /me/feed to another Facebook uid it says that publishing as this application to other users is not working. However I tried to put app access token and user access token and changed post to PHP feed dialog but also in vain.

I tried all codes either PHP or JavaScript to accomplish this job but unfortunately nothing worked. Especially after Facebook prevented applications developers to post on friends’ walls.

All I need is to post on behalf of my users on their wall automatically even if they are offline. How can I do that?

One Response to “Facebook breaking changes to post on users wall”

  1. You CANNOT post to user’s friends through the graph Api. Only way to achieve this is to invoke the Javascript SDK Feed Dialog.

    Regarding the access tokens, you can extend the short lived access token for a long lived access token [ that holds good for 60 days ]. Read more : http://developers.facebook.com/roadmap/offline-access-removal/

Leave a Reply