Connect Supabase storage to ittybit

View Markdown

This guide shows you how to connect your Supabase Storage bucket to ittybit to verify end-to-end triggers and webhooks.

1. Get S3 credentials from Supabase

First, ensure your storage bucket exists.

Using SQL (recommended):

INSERT INTO storage.buckets (id, name) VALUES ('ittybit-files', 'ittybit-files');

Get credentials:

  • Go to Settings → API in Supabase.
  • Copy the entire S3 configuration JSON.
  • Ensure the bucket value matches your created bucket.

2. Save the credentials in ittybit

  • Create an environment variable: S3_CONNECTION_JSON.
  • Paste your complete credentials JSON into that variable.

3. Use the saved connection in POST requests

Create the automatic trigger:

CREATE OR REPLACE FUNCTION trigger_ittybit_on_insert()
RETURNS TRIGGER LANGUAGE PLPGSQL AS $$
BEGIN
  PERFORM NET.HTTP_POST(
    URL := 'https://api.ittybit.com/tasks',
    HEADERS := JSONB_BUILD_OBJECT(
      'Content-Type', 'application/json',
      'Authorization', 'Bearer YOUR_ITTYBIT_API_KEY'  -- Replace with your key
    ),
    BODY := JSONB_BUILD_OBJECT(
      'kind', 'automation',
      'automation_id', 'YOUR_AUTOMATION_ID',  -- Replace with your automation ID
      'connection', '{{ project.connections.SUPABASE }}',
      'key', NEW.NAME
    )
  );
  RETURN NEW;
END;
$$;

CREATE TRIGGER on_new_object
  AFTER INSERT ON storage.objects
  FOR EACH ROW EXECUTE FUNCTION trigger_ittybit_on_insert();

Reference connections in API calls:

{
  "connection": "{{ project.connections.SUPABASE }}"
}

4. Use the saved connection in automation workflows

{
  "connection": "{{ env.S3_CONNECTION_JSON }}"
}

On this page