In this article we will discuss how to simplify your facebook page engagement by automating the facebook page posts with python and facebook graph API.
We will cover the following topics in this article:
- Intro to Facebook Graph API
- Getting your facebook page access token
- Sending a post to your facebook page using Graph API and python
- Sending a photo to your facebook page using Graph API and python
- How to swap short life access token for a long life access token
- Send posts to Facebook on a schedule
Intro to Facebook Graph API
You can access the Facebook Graph API on this link: https://developers.facebook.com/docs/graph-api/ — the documentation covers code snippets for interacting with the API from getting your access tokens to sending posts to facebook.
The Facebook Graph API provides url endpoints that you can send GET and POST requests to, in order to interact with your facebook page or send information, posts to your facebook account. You can use the API to: (1) Read the messages on your timeline, (2) send messages, (3) read posts, (4) create posts, edit posts or even delete posts. The API is a powerful tool to interact with your facebook account or page programatically, hence providing a tool to automate your facebook.
We are going to focus on how to use the API to automate posts, specifically on a Facebook page.
Before you can access the graph API, you need access tokens. These are like digital keys that unlock your account and enable you to interact with it programatically.
Getting your Facebook Page Access Tokens
We are going to start by getting the short-life access tokens, these are the tokens you can get from the facebook developer front-end. Go to the url: https://developers.facebook.com/
Create a facebook developer account and log in to the dashboard. At the top left, click on the “create app” green button: