Supabase
Supabase is a simple way to work with your Supabase database from within Nappai.
It lets you add, delete, read, or update rows in any table you choose, and it can also run custom Supabase functions that you have created.
How it Works
When you drop the Supabase component into your workflow, it talks directly to your Supabase database using the credentials you set up in Nappai.
The component sends a request to Supabase’s REST API, telling it which table to touch and what operation to perform.
If you choose “Custom API Call”, the component will call a Supabase function instead of a table operation.
All of this happens behind the scenes, so you only need to pick the operation, fill in a few fields, and the component does the rest.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Insert: Adds a new record to the selected table.
- Delete: Removes records that match the specified filters.
- Get: Retrieves records from the selected table based on filters.
- Update: Modifies existing records that match the filters.
- Custom API Call: Executes a custom Supabase function.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Mapping Mode
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Credential: Select the Supabase API credential you have set up. Make sure you have configured it in the Credentials section of Nappai before using this component.
- Visible in: Insert, Delete, Get, Update, Custom API Call
-
Operation: Select the Supabase operation to perform.
- Visible in: Insert, Delete, Get, Update, Custom API Call
-
Table Name: Select the table to operate on.
- Visible in: Insert, Delete, Get, Update
-
Function: Select the function to execute.
- Visible in: Custom API Call
-
Field to Send: Filter to decide which rows get retrieved.
- Visible in: Update
-
Filter String: Filter string to apply to the query.
- Visible in: Delete, Get, Update
-
Filters: Number of filters to decide which rows are retrieved.
- Visible in: Delete, Get, Update
-
Select Type: Select type of filters.
- Visible in: Delete, Get, Update
-
Limit: Number of results to return.
- Visible in: Get
-
Return All: Whether to return all results or only up to a given limit.
- Visible in: Get
-
Mapping Mode: Enable mapping mode to process multiple data records in batch.
- Visible in: Insert, Delete, Get, Update, Custom API Call
-
Tool Name: The name of the tool that will be used when this component is connected as a tool. This name will be displayed to the agent when it selects tools to use.
- Visible in: Insert, Delete, Get, Update, Custom API Call
-
Tool Description: A detailed description of what this tool does. This description will help the agent understand when and how to use this tool effectively.
- Visible in: Insert, Delete, Get, Update, Custom API Call
-
Tools arguments metadata: Defines the arguments metadata for the tools.
- Visible in: Insert, Delete, Get, Update, Custom API Call
Outputs
-
Data: The raw data returned from Supabase (method: perform_operation).
Use this output to feed into other components or to display results. -
Tool: A tool representation that can be used by Nappai’s agent (method: to_toolkit).
This is useful when you want the agent to call this component automatically.
Usage Example
Insert a New Record
- Drag the Supabase component into your workflow.
- Set Operation to Insert.
- Choose the Table Name (e.g., “customers”).
- In the Mapping Data section, map the fields you want to insert (e.g., “name”, “email”).
- Connect the output of a previous component that provides the data.
- Run the workflow – the new record will appear in your Supabase table.
Get Records with a Filter
- Set Operation to Get.
- Choose the Table Name (e.g., “orders”).
- Set Filter String to something like
status = 'pending'
. - Optionally set Limit to 10 and Return All to false.
- Run the workflow – the component returns the matching rows.
Related Components
- SupabaseComponent – The only component that interacts with Supabase in Nappai.
Use it whenever you need to read, write, or modify data in your Supabase database.
Tips and Best Practices
- Use Mapping Mode when you need to process many rows at once; it saves time and reduces API calls.
- Always set a Filter String or Filters when deleting or updating to avoid accidental changes.
- If you only need a few rows, set Limit and leave Return All unchecked to keep responses small.
- Keep your Supabase credentials secure; never expose them in public workflows.
Security Considerations
- Credentials are stored securely in Nappai’s credential store.
- Use the least‑privilege principle: create a Supabase service key that only has the permissions your workflow needs.
- Avoid sending sensitive data in the Filter String if it could be logged or exposed.
- When using Custom API Call, ensure the function you call does not expose any sensitive endpoints.