Search code examples
facebookfacebook-graph-api

How to use the FB Graph API to post a note on a company page


My personal FB account is in the Admin Role of "Manager" on our company's FB page.

I have an Access Token w/ the correct permissions that I can use to successfully post a Note to the Company page using the REST API.

However, when I use the same Access Token to Post a note to https://graph.facebook.com/PROFILE_ID/notes (where PROFILE_ID is replaced with the ID of our Company page, it posts the note to my personal FB page.

How do I use the Graph API to post notes to the company page.

Thanks!


Solution

  • POST requests generally seem to post to the profile of the user that is authenticated, not necessarily the user with the profile ID supplied - it's odd.

    Hence, you need to authenticate as the page, rather than as yourself. The details regarding this are here: https://developers.facebook.com/docs/authentication/pages/

    Essentially, you authenticate as yourself, retrieve a list of pages that you manage with associated access tokens, which you can then use to post the note.

    For the benefit of other users, the process is thus:

    Firstly, acquire the create_post permission, as described in the API Reference A POST request must be issued to https://graph.facebook.com/PAGE_ID/notes?message="MESSAGE_BODY_TEXT"&subject="NOTE_SUBJECT"