Search Here

Automate Facebook Post to Groups using Graph API and Python

In this article, you will learn how to create a Facebook Bot to post automatically on groups using Facebook Graph API and Python Programming Language. By using this Facebook bot you can post automatically on every Facebook group which you have joined.

Automate Facebook Post to Groups using Graph API and Python


Features of Facebook Bot

  • Get all of the Facebook group ids which you have joined
  • Read post link with a hash tag and description from excel file
  • Post every link (added in excel file) on all Facebook groups (post after 12 to 16 minutes)
  • Get the random link from excel file and post on Facebook groups randomly (post after 12 to 16 minutes)

How to Create Facebook Bot to Post Automatically on Groups

Below are the steps to create a Facebook bot using python and Facebook graph API.
  • Create and generate access tokens by using Facebook Graph API
  • Make a JSON file (named "credentials.json") and use the above token to in that file by creating a python dictionary (key-value pair). The key will be "access_token" and the value should be the generated token.
  • Create an excel file named "link_description.xlsx", the file contains three columns and the name of the columns must be like below.
    • link
    • tag
    • description
  • Each row of your excel file contains the post link, tag, and description. You can add as many rows as you want.

Create and generate access tokens by using Facebook Graph API



Make a JSON File "credentials.json"

{
  "access_token": "your access token goes here"
}

Create an Excel File "link_description.xlsx" 


Automate Facebook Post to Groups using Graph API and Python


Below is the code snippet of the Facebook bot to post automatically in Facebook groups after 12 to 16 minutes.

Post Random Link of Excel File in Random Facebook Groups


Post Every Link of Excel File in All Facebook Groups


Post a Comment

2 Comments

  1. GraphAPIError: (#200) If posting to a group, requires app being installed in the group, and \
    either publish_to_groups permission with user token, or both pages_read_engagement \
    and pages_manage_posts permission with page token; If posting to a page, \
    requires both pages_read_engagement and pages_manage_posts as an admin with \
    sufficient administrative permission

    ReplyDelete
  2. It doesn't work, that facebook app needs to be installed on that particular group to allow API posting on it

    ReplyDelete