This project contains code for syncing Google Drive data with a Guidebook Guide.
- An Amazon Web Services (AWS) account
- A Guide set up in Builder with an empty CustomList
- An API key from Builder
- A Google Drive folder
- A Google Cloud Platform project
- Create a virtualenv and run
pip install -r requirements.txt
to get the package dependencies.
This project uses a scheduled Google Drive lambda to add, update and remove files as CustomListItems in Builder. However, an initial data load must be performed to populate the guide with data.
Steps to load data:
- Update all of the values in
settings.py
to your settings - Run
python data_loader.py
from within your virtualenv.
- Create a Google Cloud Platform project
- In IAM and Admin for this project, create a service account. This will be used for authentication.
- Under the new service account, create a private JSON key. Download the key - the contents will be used in settings and parameter store to authenticate the requests to Google Drive.
- In APIs and Services for this project, enable the Google Drive API.
- In Google Drive, navigate to the folder that contains the files you want uploaded to CustomListItems in Builder. Share the folder with your service account.
Steps to setup lambdas:
- Login to your AWS account and create a new lambdas
- Create a deployment package for your lambda and either upload the package to AWS via the console or using lambda-uploader
The lambda code is contained in:
drive_webhook_receiver.py
- Schedule your lambda to run every five minutes.
- Add the following parameters to AWS Systems Manager (Parameter Store)
Name | Type | Value |
---|---|---|
/lambdas/googledrivewebhookreceiver/api_key |
SecureString | Your Builder API key |
/lambdas/googledrivewebhookreceiver/guide_and_list_ids |
String | List of guide and custom list ids to update in Builder, ex: (<guide1_id>, <list1_id>), (<guide2_id>, <list2_id>) |
/lambdas/googledrivewebhookreceiver/service_account_credentials |
SecureString | The credentials dictionary for your service account generated for the project. |
/lambdas/googledrivewebhookreceiver/start_page |
String | The starting page of changes to watch in Google Drive. |
/lambdas/googledrivewebhookreceiver/drive_folder_name |
String | The name of the folder to watch in Google Drive. |
- Deploy the lambda.