Sync public facebook page events to Google Calendar.
Before beginning you will need to create and configure a facebook app and use it to acquire a page access token for Graph API.
You will also need to set up a Google service account to acquire a credentials file to authenticate with Google APIs.
Install fest
using pip:
bash
pip install fest
Use clients for facebook's Graph API and Google's Calendar API to create FacebookPage
and GoogelCalendar
objects, then synchronize:
```python import facebook from googleapiclient import discovery
import fest
graphapi = facebook.GraphAPI('
page = fest.FacebookPage(graphapi, '
req = gcal.sync(page, time_filter='upcoming') res = req.execute() ```
Several methods of deployment are provided.
A pair of terraform modules module are provided to deploy this tool as a Lambda function on AWS and invoke it on a cron using CloudWatch.
```hcl
resource "aws_secretsmanager_secret_version" "facebook" { secret_id = module.facebook_gcal_sync.facebook_secret.id secret_string = "my-facebook-app-token" }
resource "aws_secretsmanager_secret_version" "google" { secret_id = module.facebook_gcal_sync.google_secret.id secret_string = file("./path/to/my/svc/acct/creds.json") }
module facebook_gcal_sync { source = "amancevice/facebook-gcal-sync/aws" version = "~> 1.0"
facebook_page_id = "
A terraform module module is provided to deploy this tool as a Heroku application.
hcl
module facebook_gcal_sync {
source = "amancevice/facebook-gcal-sync/heroku"
app_name = "<unique-app-name>"
facebook_page_id = "<facebook-page-id>"
google_calendar_id = "<google-calendar-id>"
google_credentials_file = "<path-to-google-service-credentials>"
facebook_page_token = "<facebook-page-access-token>"
}
Alternatively, deploy with one click:
EXPECTED BEHAVIOUR sync all events added to my Facebook page (not only the one created by it)
this is how I can add whatever event to my page:
CURRENT BEHAVIOUR the script synchronize only the events created by the page :(
Migrate to pyproject.toml Drop support for Python 3.6 and lower
Python 3.9 support
This release includes major changes the fest
API and drastically reduces the scope of the project. Instead of attempting to sync facebook events with multiple targets, the project is now solely concerned with syncing events to Google Calendar.
Additionally, a terraform module is provided to help deploy this tool as a Lambda function on AWS with support to invoke on a cron with CloudWatch.
A heroku terraform module is also planned.
Security update
Fixed bug in Tribe (Wordpress) event deletion
Use google-auth
library for authenticating with Google Calendar
Drop support for Python 2 and 3.3
facebook google-calendar heroku aws python