Post to Facebook Page Wall using restfb Graph API in ADF & Java

Sharing is Caring

This is next post working with Facebook Graph API series and is about how to post to Facebook page wall, Previously I have posted about getting access token and use it to get Facebook Profile detail and Posting status on your Facebook Timeline using restfb Facebook Graph API

Go through previous posts for the better understanding of this blog post

Now, this post is about Facebook Pages, Facebook Page is a way to connect people to promote your brand, website, business, cause etc. This post uses no new code, Posting on pages is the same as updating the status on Facebook Timeline.

The only difference is of access tokens, For Timeline status posting we use User Access Token but for managing pages, we need to use Page Access Token.

Open Graph API Explorer and Click on Get Page Access Token

When we ask for Page Access Token, Graph API asks permission to manage pages

Next step is to click on Get User Access Token for some more permissions

As our requirement is to post on pages so for that we need to grant permission for this- publish_pages

Grant permission to Graph API to publish as pages

After this, a token is generated that is user access token with permissions of managing and publishing as pages
Change in GET Request and write me/accounts to get details of all pages managed by you

Here you can see different access token and id for each page Now use access token and id of any page to post status

Check after clicking on Post button and see on Page
Post to Facebook Page
If you want to post on your page wall under visitors post using your name then use User Access Token and Page Id (ID of the page on that you want to post) to post

Cheers 🙂 Happy Learning

Related Posts

0 thoughts on “Post to Facebook Page Wall using restfb Graph API in ADF & Java”

  1. Hi Ashish,

    Can we publish any post on other's(suppose my friend's) timeline instead of mine.
    fbClient.publish("me/feed",FacebookType.class,Parameter.with("message", description));
    Instead of above line(Instead of "me/feed") can we use below(userId or emailId+"/feed")
    Suppose I know my friend's facebook Id or emailId through he uses facebook
    fbClient.publish(userId+"/feed",FacebookType.class,Parameter.with("message", description));


Leave a Reply

Your email address will not be published. Required fields are marked *