Facebook API - Post to business page?

3 replies
Hi all,

I'm developing a custom application to automatically post to my business Facebook page.

The problem is I cannot see how to do it? I mean I've created a new app profile and got the API key and secret key and know how to post to my personal Facebook page (without needing to logon) -- however how can I then get my application to post to my business Facebook account automatically?

Cheers ...
Gerald.
#api #business #facebook #page #post
  • Profile picture of the author IdeaBox
    You need to request the manage_pages permission, for the admin user you assigned to the pages. When you return from the authorize URL, where you get the user's access token, you need to call the https://graph.facebook.com/me/accoun...KEN_FROM_ABOVE URL, which will give you a collection of pages, each with its own access token.

    When you use that access token for publishing, it should publish as the Page.

    Facebook Login - Facebook Developers - Check the Page Login section.

    This is the URL, you redirect the browser to:

    https://graph.facebook.com/oauth/aut...i=REDIRECT_URL

    When the user returns to the specified Redirect URL, you grab the value in the code URL parameter and call the Facebook API to exchange it for an access token. All this, you've probably already done, since you have an application that posts on a user's wall.

    What you'll do now, using the access token, is call https://graph.facebook.com/me/accoun...KEN_FROM_ABOVE which will give you the collection of pages the authenticated user manages, and each one have its own access token.

    Grab the desired access token, and use that to post on the pages wall.
    {{ DiscussionBoard.errors[8456789].message }}
    • Profile picture of the author Geraldm
      Hi,

      Thank you for the reply.

      I've tried the below using the Graph API Explorer. I get my access token and submit me/?fields=accounts however it's only returning:

      {
      "id": "1848002xxx"
      }

      I guess this is just my personal page id? I have ready added my personal account as a "admin/manager" for my Business page so why is it not listed above? Also no info about access tokens is displayed?

      Cheers .....
      Gerald.




      Originally Posted by IdeaBox View Post

      You need to request the manage_pages permission, for the admin user you assigned to the pages. When you return from the authorize URL, where you get the user's access token, you need to call the https://graph.facebook.com/me/accoun...KEN_FROM_ABOVE URL, which will give you a collection of pages, each with its own access token.

      When you use that access token for publishing, it should publish as the Page.

      Facebook Login - Facebook Developers - Check the Page Login section.

      This is the URL, you redirect the browser to:

      https://graph.facebook.com/oauth/aut...i=REDIRECT_URL

      When the user returns to the specified Redirect URL, you grab the value in the code URL parameter and call the Facebook API to exchange it for an access token. All this, you've probably already done, since you have an application that posts on a user's wall.

      What you'll do now, using the access token, is call https://graph.facebook.com/me/accoun...KEN_FROM_ABOVE which will give you the collection of pages the authenticated user manages, and each one have its own access token.

      Grab the desired access token, and use that to post on the pages wall.
      {{ DiscussionBoard.errors[8457755].message }}
  • Profile picture of the author Geraldm
    Ok ignore my previous email. Worked out I needed to add additional permissions to my generated access token to be able to see information regarding business page (including business page access token).

    Thanks for your help!
    {{ DiscussionBoard.errors[8457780].message }}

Trending Topics