Skip to content

nkkko/CalLovesSupabase

Repository files navigation

Cal.com x Supabase ❤️

This quick project is a Flask-based web application that integrates with the Cal.com calendar service and the Supabase database platform. The application sets up a webhook endpoint to receive events from Cal.com and stores the event data in a Supabase table.

Table of Contents

Features

  • Receives webhook events from Cal.com
  • Extracts relevant event data from the webhook payload
  • Port forward your dev server using Daytona
  • Stores the event data in a Supabase table

Prerequisites

Before you can run this project, you'll need to have the following installed:

  • Daytona
  • Python 3.7 or later
  • Flask
  • Supabase Python client
  • Dotenv

You'll also need to have a Supabase account and API keys.

Installation

  1. Create new workspace using Daytona, which will clone the repository:
daytona create -r https://github.com/nkkko/callovessupabase.git
  1. Start your IDE:
daytona code

You can also select your prefered IDE with daytona ide.

  1. Set up your development workspace—optionally you can also use the provided devcontainer.json:
sudo apt update
sudo apt install pip
pip install supabase
pip install python-dotenv

Install the required dependencies:

pip install -r requirements.txt
  1. Create a .env file in the project directory and add your Supabase URL and API key:
SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-supabase-api-key

Usage

  1. Start the Flask development server:
python3 listener.py

This will start the web server on http://localhost:5000/.

  1. Use the daytona tool to forward your localhost port to be accessible publicly:
daytona forward 5000 --public

You will get a URL that you can paste in the Cal.com webhook Subscriber URL.

  1. Configure your Cal.com webhook to send events to the generated URL. You can do this by navigating to the Cal.com dashboard, selecting your event, and configuring the webhook settings.

Whenever a webhook event is received from Cal.com, the handle_cal_com_webhook() function will be called, which will extract the event data and store it in the Supabase table.

Configuration

There are no additional configuration options for this project. All the necessary configuration is done through the .env file, which should contain your Supabase URL and API key.

Deployment —OPTIONAL—

To deploy this application, you can use a production-ready WSGI server, such as Gunicorn or uWSGI. Here's an example of how you can use Gunicorn:

  1. Install Gunicorn:
pip install gunicorn
  1. Create a wsgi.py file in the project directory with the following content:
from listener import app

if __name__ == "__main__":
    app.run()
  1. Run the Gunicorn server:
gunicorn --bind 0.0.0.0:5000 wsgi:app

This will start the Gunicorn server and serve the Flask application on port 5000.

Contributing

If you find any issues or have suggestions for improvements, feel free to submit a pull request or open an issue on the GitHub repository.

License

This project is licensed under the Apache.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages