Skip to main content

Sync facebook events to Google Calendar

Project description

Facebook Event State Transfer

pypi python pytest coverage maintainability

Sync public facebook page events to Google Calendar.

Prerequisites

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.

Installation

Install fest using pip:

pip install fest

Basic Use

Use clients for facebook's Graph API and Google's Calendar API to create FacebookPage and GoogelCalendar objects, then synchronize:

import facebook
from googleapiclient import discovery

import fest

# Connect to Graph API & Calendar API
graphapi = facebook.GraphAPI('<facebook-page-token>')
calendarapi = discovery.build('calendar', 'v3', cache_discovery=False)

# Get Page/Calendar objects
page = fest.FacebookPage(graphapi, '<facebook-page-name-or-id>')
gcal = fest.GoogleCalendar(calendarapi, '<google-calendar-id>')

# Sync Calendar <= Page
req = gcal.sync(page, time_filter='upcoming')
res = req.execute()

Deployment

Several methods of deployment are provided.

AWS

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.

module secrets {
  source                  = "amancevice/facebook-gcal-sync-secrets/aws"
  facebook_page_token     = "<your-page-access-token>"
  facebook_secret_name    = "facebook/MyPage"
  google_secret_name      = "google/MySvcAcct"
  google_credentials_file = "<path-to-credentials-JSON-file>"
}

module facebook_gcal_sync {
  source               = "amancevice/facebook-gcal-sync/aws"
  facebook_page_id     = "<facebook-page-id>"
  facebook_secret_name = "${module.secrets.facebook_secret_name}"
  google_calendar_id   = "<google-calendar-id>"
  google_secret_name   = "${module.secrets.google_secret_name}"
}

Heroku

A terraform module module is provided to deploy this tool as a Heroku application.

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:

Deploy

Project details


Release history Release notifications | RSS feed

This version

5.1.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fest, version 5.1.2
Filename, size File type Python version Upload date Hashes
Filename, size fest-5.1.2.tar.gz (26.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page