A modern helper to post updates and links to your Facebook Pages
Posting to Facebook requires specific tokens and identifiers. Follow these steps to obtain them:
Go to the Meta for Developers Dashboard and register.
Before posting, your app needs permission to manage and publish posts on your behalf.
Go to the App Dashboard, locate your product list, and check for these permission scopes:
pages_manage_posts (Required to publish posts)pages_read_engagement (Required to read page insights/status)pages_show_list (Required to find pages connected to your account)Use the Graph API Explorer to generate a temporary token representing your user account:
pages_manage_posts, pages_read_engagement,
and pages_show_list.Exchange the short-lived token for a long-lived user token (valid for 60 days) by making a GET request to the following endpoint (replace values):
GET https://graph.facebook.com/v20.0/oauth/access_token?Copy the new access_token from the JSON response.
A Page Access Token is required to post to a Page. If you generate it using a Long-Lived User Token, the Page Access Token will never expire!
Make a request to the following endpoint using your long-lived user access token:
GET https://graph.facebook.com/v20.0/me/accounts?The response will list all pages you manage. Locate your target page and copy its
access_token. This is your permanent token!
You can find your Facebook Page ID in a few ways:
id field.