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.
- 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
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.
- Create new workspace using Daytona, which will clone the repository:
daytona create -r https://github.com/nkkko/callovessupabase.git
- Start your IDE:
daytona code
You can also select your prefered IDE with daytona ide
.
- 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
- 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
- Start the Flask development server:
python3 listener.py
This will start the web server on http://localhost:5000/
.
- 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.
- 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.
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.
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:
- Install Gunicorn:
pip install gunicorn
- Create a
wsgi.py
file in the project directory with the following content:
from listener import app
if __name__ == "__main__":
app.run()
- 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.
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.
This project is licensed under the Apache.