Library
logo

Connect Your Supabase DB with an AI Agent (Room Booking)

Easily connect your Supabase database to an AI Agent for real-time, dynamic responses. Simply import this template to build a AI room booking system with Supabase.
feature-image

YourGPT with Supabase Integration Template helps you quickly set up a functional room booking system with Supabase database setup for room details, dynamic carousels for displaying room image, JavaScript code for booking updates, and fallback mechanisms for API request failures.

Flow-supabase

1.Understanding the Template

Scenarios:

We have two scenerio:

  • Book_Available_Room Scenerio: To book available rooms scenerio handling the full booking part including checking for available rooms.
  • Get_Available_Room Scenerio: Fetches available room details.
  • AvailableRoom Component created from Get_Available_Room and we are reusing this component on Book_Available_Room.

2. Open Your Project in Supabase

  • Go to the project in Supabase where you have the data tables and APIs set up.
  • You'll be working with the table and API related to room availability.

Step 2.1: Check Our Table Structure

image.png

  • Ensure your table has the necessary fields like room type, availability status, etc.
  • Make sure the data in the table is aligned with your room booking logic.

Step 2.2: Set Up the API Key

image.png

  • Follow these steps to get your API Key for integration:

    1. Go to Project Settings in Supabase.
    2. Click on API under Settings.
    3. Copy the Project URL and the anonpublic key (as shown in the above image).
    4. Go back to your table and make sure the RLS (Row Level Security) is enabled for the table. like this:

    ALL Allow_booking Applied to:public role

    Instead of public you can also define roles as needed.


3. Open Studio & Import the Template

  1. Import the template

For assistance with importing templates, refer to our guide on how to import in Studio.

  1. Add Your Config Variable SUPABASE_URL & SUPABASE_KEY

supabse-configs.png

4. Test & Run on Emulator

roombooking-emulator.png

To run the flow, click on Emulator and start testing the flow


This template saves time by providing a structured framework that is easy to customize.

Download the template now to streamline your development process and build an efficient ai agent-powered booking system.