Automating your Facebook page post is extremely easy. All you need is Graph API token and Python code.
Create a facebook app on developer.facebook.com
Change the app status to live to make it public.
Go to tools -> Graph Api explorer.
Select your application.
Select page access token and then select the page name on which you want to post message using python code.
Select the 'i' icon at the start of access token.
Click on 'Open in Access Token Tool'.
On the next page, click on on 'Extend Access Token'.
Copy this access token and keep in config file. Remember not to commit this token into git.
It is recommended that you create a virtual environment using python3.
Activate the virtual environment and install the facebook-sdk==2.0.0
package.
source path-to-venv/bin/activate pip install facebook-sdk==2.0.0
Use below code to post on your page on behalf of your facebook app your created above.
import facebook page_access_token = "YOUR TOKEN GOES HERE" graph = facebook.GraphAPI(page_access_token) facebook_page_id = "67509909999999" graph.put_object(facebook_page_id, "feed", message='test message')
After executing above script, verify on your page if post has been published or not.
You can schedule a cron to post the status on facebook page regularly.
Remember to renew the page access token before it expires.
Feel free to comment in case of any issue.
Host your Django App for Free.