Skip to content

garytann/Facebook-GraphAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Facebook GraphAPI

This shows a simple use-case of Facebook's GraphAPI. The API is free to use except with a rate-limit, find out more: https://developers.facebook.com/docs/graph-api/overview/rate-limiting#platform-rate-limits

Setup

Register a developer account with Facebook and creating a meta app

Install dependencies

pip install -r requirements.txt

Usage

Obtain a long-lived access token

https://graph.facebook.com/v16.0/oauth/access_token?grant_type=fb_exchange_token&client_id=${CLIENT ID}&client_secret=${CLIENT SECRET}&fb_exchange_token=${PAGE/USER ACCESS TOKEN}

Using the API

  • You can use the built-in api explorer: https://developers.facebook.com/tools/explorer/ or in my case I prefer the usage of Postman
  • You need to acquire the page-id of your Facebook's page, which could be obtained from the page's url
  • You can begin usage of the API now with:
https://graph.facebook.com/${PAGE ID}/posts?access_token=${ACCESS TOKEN}

Using app.py

  • Create a file secret.py or .env and store your credentials, in app.py import the credentials to be used
  • Retrieve:
    • Parent post content
    • Child comments' content
    • Child comments' author
    • Reactions
    • Dates
    • Hyperlinks
    • Most reacted comments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages