Skip to content

This project demonstrates the integration of Twilio and Google Calendar for managing events through WhatsApp messages. Users can interact with their Google Calendar by sending WhatsApp messages to a Twilio phone number.

Notifications You must be signed in to change notification settings

pollyminatel/API-integration-twilio-GCP-Google-Calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio, Google Cloud (GCP) and Google Calendar API Integration for WhatsApp

This project demonstrates the integration of Twilio and Google Calendar for managing events through WhatsApp messages. Users can interact with their Google Calendar by sending WhatsApp messages to a Twilio phone number.

Prerequisites

  1. Google Cloud Platform (GCP) Account:
  2. Deploy Flask App to Google Cloud App Engine:
    1. Install Google Cloud SDK: Follow the instructions for your OS [Installing Google Cloud SDK](https://cloud.google.com/sdk/docs/install).
    2. Set Up a Google Cloud Project: Create a new project on the [Google Cloud Console](https://console.cloud.google.com/). Enable billing.
    3. Enable App Engine API: Enable the App Engine API for your project.
    4. Configure Google Cloud SDK: Run `gcloud init` and follow the instructions.
    5. Navigate to Your Flask App Directory: Open a terminal and go to your Flask app directory.
    6. Create `app.yaml` File: Create a file named `app.yaml` with the provided content in the README.
    7. Install Gunicorn: Run `pip install gunicorn` to install Gunicorn.
    8. Deploy to App Engine: Run `gcloud app deploy` to deploy your Flask app.
    9. Access Your App: After deployment, you will get a public URL for your app.
  3. Google Calendar API:
    • Enable the Google Calendar API for your project.
    • Create credentials (OAuth client ID) for the project. Download the JSON file containing client ID and secret.
  4. Google Cloud Storage:
    • Set up a Google Cloud Storage bucket to store OAuth tokens.
    • Note the bucket name.
  5. Service Account:
    • Create a service account with the necessary permissions (Google Calendar API, Google Cloud Storage).
    • Download the JSON key file for the service account.
  6. Twilio Account:
    • Create a Twilio account: Twilio Console.
    • Acquire a Twilio phone number configured for WhatsApp.

Project Setup

  1. Clone the repository:
git clone https://github.com/your-username/your-project.git
cd your-project
  1. Install dependencies:
pip install -r requirements.txt
  1. Copy the Google Calendar API credentials JSON file and the service account JSON key file to the project directory.

Running the Application Locally (optional)

  1. Run the Flask web application:

There is no need to run the application locally, but you can run it to check if it is working.

python app.py

The application will be accessible at http://localhost:5000.

  1. Configure your Twilio WhatsApp phone number:
  • Log in to Twilio Console.
  • Navigate to your Twilio WhatsApp phone number.
  • Set the "Incoming Webhook" to your gcloud uri https://PROJECT_ID.REGION_ID.r.appspot.com/webhook.

Usage

  1. Send a WhatsApp message to your Twilio phone number with commands like:
    • next events: List upcoming events.
    • add event <event details>: Add a new event to the calendar.
  2. Receive WhatsApp responses with relevant information.

Troubleshooting

  • If you encounter issues with Google Cloud Storage permissions, ensure that the service account has the necessary roles (e.g., Storage Object Admin) on the storage bucket.
  • Check the Twilio WhatsApp logs for any errors related to webhook requests.

References and tutorials

About

This project demonstrates the integration of Twilio and Google Calendar for managing events through WhatsApp messages. Users can interact with their Google Calendar by sending WhatsApp messages to a Twilio phone number.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages