Supabase
Connect HookFlo with Supabase to receive alerts for database and authentication events
Integration Guide
This guide will help you set up a webhook integration between Supabase and HookFlo, allowing you to receive real-time alerts when database changes, authentication events, and other activities occur in your Supabase project.
Supabase uses a combination of database triggers and Postgres functions to deliver webhook events. HookFlo seamlessly integrates with both Supabase’s built-in webhooks and custom webhook implementations.
Prerequisites
- A HookFlo account with an active project
- A Supabase project with admin access
- Basic understanding of Supabase database and functions
Integration Overview
The integration process follows these key steps:
- Set up a webhook in HookFlo
- Configure notification channels (email/Slack)
- Connect Supabase to HookFlo
- Test the integration
Setting Up Your HookFlo Webhook
After logging into HookFlo, follow these steps to create and configure your Supabase webhook:
Create a Webhook
Setting Up Your Webhook Endpoint
Setting Up Your Webhook Endpoint
- From your Hookflo Dashboard, navigate to > Manage Webhooks
- Click on + Create Webhook
- Your webhook will be created in an inactive state by default
Once created, you’ll see your webhook in manage webhooks table.
Setup Notification Channel
Configure Email Notifications
Configure Email Notifications
- Toggle the Email Notifications switch to enable email alerts
- In the dialog box that appears, enter the email address where you want to receive notifications
- Select an email template from the dropdown menu
- Click Preview Template to see how your notifications will look
- Use the editor to customize the template if needed
- Click Save Configuration to confirm your settings
Email notifications are perfect for critical alerts that require immediate attention and have lower usage limits, Use it for critical Alerts.
Configure Slack Notifications
Configure Slack Notifications
- Toggle the Slack Notifications switch to enable Slack alerts
- In the dialog box, paste your Slack webhook URL (see
- )
- Keep the random generated name or enter a custom one (optional)
- Select a notification template from the available options
- Preview and edit the template as needed
- Click Save Configuration to confirm your settings
Slack notifications are ideal for team collaboration and awareness, Highly recommended to use Slack and this has 3x Usage limits than email.
Connect your Webhook with application
Configure Application
Configure Application
- Click the Connect button to activate your webhook
- Select Supabase as application to integrate
- A configuration panel will appear with your webhook credentials:
- Webhook URL: The HTTP POST request endpoint Supabase will send events to
- x-webhook-id: Your unique webhook identifier
- x-webhook-token: Your security token for authentication
- Copy these values for the next section
You can also configure notification channels from this panel if you haven’t done so already.
Configuring Supabase
Now that your HookFlo webhook is set up, you need to configure Supabase to send events to it:
Setup Supabase Webhook
Access Supabase Webhooks
Access Supabase Webhooks
- Log in to your Supabase Dashboard
- Select your Project
- Select Integrations option in the left sidebar
- Choose Database Webhooks (Official) app from panel, Install it if not already done.
- After Clicking Database Webhooks app you will see 2 tabs Overview and Webhooks choose Webhooks and proceed with next step.
This is where you’ll create database webhooks that trigger on table events.
Create a Database Webhook
Configure Webhook Details
Configure Webhook Details
- Click Create a new webhook
- Provide a descriptive name for your webhook (e.g.,
hookflo-users-events
) - Select the table you want to monitor from the dropdown
- Choose which events to trigger the webhook:
- INSERT: When new records are created
- UPDATE: When existing records are modified
- DELETE: When records are removed
- Under Webhook configuration choose Type of webhook as HTTP Request
- In the URL field, paste your HookFlo webhook URL
- Add the following HTTP headers:
x-webhook-id
: [Your webhook ID from HookFlo]x-webhook-token
: [Your webhook token from HookFlo]
- Click Save to create the webhook
Enable HTTP Extension (If Needed)
Configure Http Extension
Configure Http Extension
For webhooks to function correctly, Supabase needs the HTTP extension enabled. Most projects created after December 2022 have this extension enabled by default.
To check or enable it:
- Go to the SQL Editor in your Supabase dashboard
- Run the following SQL command:
- Click Run to execute the command
Select Tables to Monitor
Choose Database Tables
Choose Database Tables
When creating your database webhook in Supabase, you can monitor any table:
- Public schema tables: Your application’s main tables
- Auth schema tables: Supabase authentication tables to track user-related events
- Any other schema: Custom schemas you’ve created
Simply select the appropriate table from the dropdown when creating your webhook. Supabase will send events to HookFlo whenever the selected events (INSERT, UPDATE, DELETE) occur on that table.
Testing Your Integration
To ensure your integration is working properly:
Generate Test Events
Run Test Events
Run Test Events
- In your Supabase project, make a change to the monitored table:
- Insert a new record
- Update an existing record
- Delete a record
For authentication events, perform the corresponding action (e.g., create a new user).
Verify in HookFlo
Validate Alert Delivery
Validate Alert Delivery
- Return to your HookFlo dashboard
- Navigate to Notification Logs
- You should see the test events appear with details about the changes
- If you’ve configured notification channels, check your email or Slack for alerts
This confirms that your Supabase webhook is correctly sending events to HookFlo, and your notification channels are properly configured.
Advanced Configuration
Using SQL for Custom Webhook Triggers
Using SQL for Custom Webhook Triggers
For more control over your webhooks, you can use SQL to create custom triggers:
This approach gives you fine-grained control over what data is sent and when.
Webhook Payload Structure
Here’s an example of what the webhook payload looks like for different events:
Database Event Payload
Authentication Event Payload
Troubleshooting
Webhook Not Firing
Webhook Not Firing
If your webhook isn’t sending events to HookFlo:
- Check that the
http
extension is enabled in your Supabase project - Verify that your trigger is correctly set up on the table
- Check the Supabase logs for any errors related to the webhook function
- Ensure the webhook URL and headers are correctly configured
- Verify that your HookFlo webhook is in the active state
Events Received but No Notifications
Events Received but No Notifications
If HookFlo is receiving events but you’re not getting notifications:
- Check your notification channel configurations in HookFlo
- Verify that your email/Slack webhooks are correctly set up
- Check if you have any conditional rules that might be filtering out your events
- Look for any errors in the HookFlo event logs
- Try a test notification from the HookFlo dashboard
Performance Considerations
Performance Considerations
For tables with high-frequency changes:
- Consider adding conditions to your triggers to only fire on specific records
- Implement rate limiting in your webhook function
- Use batch processing for high-volume tables
- Set up more specific alert rules to filter out noise
Example: Monitoring New User Signups
Here’s a complete example of setting up HookFlo to alert your team when new users sign up:
Create the Webhook in HookFlo
Follow the steps above to create a Supabase webhook in HookFlo and configure your notification channels.
Configure the Database Webhook in Supabase
- In your Supabase dashboard, go to Database > Webhooks
- Create a new webhook named “user-signups”
- Select the
auth.users
table (or your custom users table) - Choose the INSERT event type to trigger on new user creations
- Add your HookFlo webhook URL and headers (x-webhook-id and x-webhook-token)
- Save the webhook
Security Considerations
When setting up webhook integrations between Supabase and HookFlo, keep these security best practices in mind:
- Protect your webhook credentials: Keep your x-webhook-id and x-webhook-token secure
- Use row-level security: Limit what data can be included in webhook payloads
- Implement data minimization: Only send the fields you actually need
- Regular audits: Remove webhooks from tables that no longer need monitoring
- Use HTTPS only: Ensure all webhook communications use secure protocols
Congratulations! 🎉
You’ve successfully set up real-time event tracking and alerting between Supabase and HookFlo in just few minutes. Your team can now receive immediate notifications about important database and authentication events, helping you respond quickly to critical situations.
Need more help? Contact our support team or join our Discord forum or DM me directly on X.