Skip to content

Supabase → Airtable Sync

This workflow automatically synchronizes data from a Supabase database to an Airtable base, keeping coaching program records up-to-date across both platforms. It runs on a scheduled basis to ensure data consistency between the operational database and the reporting/collaboration workspace.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

Based on the workflow structure, this appears to be designed for a coaching program that manages: - Coach profiles and availability - Youth participant profiles and business development stages - Coaching session messages and communications - AI-generated bottleneck diagnoses and recommended actions

The sync ensures that stakeholders using Airtable for reporting, analysis, or collaboration have access to the latest data from the operational Supabase database.

How It Works

  1. Scheduled Trigger: The workflow runs automatically every minute to check for data updates
  2. Parallel Data Retrieval: Four Supabase queries run simultaneously to fetch:
    • All coach records
    • All youth profile records
    • All message records (currently disabled)
    • All bottleneck diagnosis records
  3. Data Processing: Messages go through a JavaScript transformation to parse nested JSON content
  4. Airtable Sync: Each dataset is upserted into corresponding Airtable tables using ID-based matching
  5. Completion: All tables are updated with the latest data from Supabase

Workflow Diagram

graph TD
    A[Schedule Trigger] --> B[Coaches - Supabase]
    A --> C[Youth Profiles - Supabase]
    A --> D[Messages - Supabase]
    A --> E[BottleNeck Diagnoses - Supabase]

    B --> F[Create or update coaches - Airtable]
    C --> G[Create or update youth profiles - Airtable]
    D --> H[Code in JavaScript]
    E --> I[Create or update diagnoses - Airtable]

    H --> J[Create or update messages - Airtable]

Trigger

  • Type: Schedule Trigger
  • Frequency: Every minute
  • Purpose: Ensures near real-time data synchronization between Supabase and Airtable

Nodes Used

Node Type Node Name Purpose
Schedule Trigger Schedule Trigger Initiates the workflow every minute
Supabase Coaches Retrieves all coach records from Supabase
Supabase Youth Profiles Retrieves all youth profile records from Supabase
Supabase Messages Retrieves all message records from Supabase (disabled)
Supabase BottleNeck Diagnoses Retrieves all bottleneck diagnosis records from Supabase
Code Code in JavaScript Transforms message data structure for Airtable compatibility
Airtable Create or update coaches Upserts coach data into Airtable Coaches table
Airtable Create or update youth profiles Upserts youth data into Airtable Youth Profiles table
Airtable Create or update messages Upserts message data into Airtable Messages table (disabled)
Airtable Create or update diagnoses Upserts diagnosis data into Airtable Bottleneck Diagnoses table

External Services & Credentials Required

Supabase

  • Credential Name: "Supabase account 2"
  • Required Access: Read permissions on tables: coaches, youth_profiles, messages, bottleneck_diagnoses
  • Configuration: API URL and service role key

Airtable

  • Credential Name: "Airtable Personal Access Token account 2"
  • Base: "Iganga DB on Supabase" (appM1t4bTPBLfADiZ)
  • Required Tables:
    • Coaches (tblDkVtaosm11PYxP)
    • Youth Profiles (tblnWtyCBEuG5fmsL)
    • Messages (tblcCFjTBqAugQKKD)
    • Bottleneck Diagnoses (tblzFzggqPYMG5dfu)
  • Required Access: Create and update records in all tables

Environment Variables

No environment variables are explicitly configured in this workflow. All configuration is handled through n8n credentials.

Data Flow

Input Data (from Supabase)

  • Coaches: ID, name, gender, contact info, role, location details, contract info, status
  • Youth Profiles: ID, name, contact info, location, business type, current stage, notes
  • Messages: ID, session_id, message content (JSON), timestamps
  • Bottleneck Diagnoses: ID, youth_id, session_id, stage, bottleneck details, AI reasoning, micro-actions

Output Data (to Airtable)

  • Coaches Table: All coach fields mapped directly with proper field names
  • Youth Profiles Table: All youth fields mapped with snake_case preserved
  • Messages Table: Flattened message structure with parsed content and type
  • Bottleneck Diagnoses Table: All diagnosis fields with proper capitalization

Data Transformations

  • Message JSON parsing: Extracts type and content from nested message structure
  • Field name mapping: Converts between database conventions and Airtable field names
  • ID string conversion: Ensures all IDs are treated as strings for consistency

Error Handling

The workflow uses basic n8n error handling: - Failed Supabase queries will stop the respective branch - Airtable upsert operations will retry on temporary failures - No custom error handling or notification mechanisms are implemented

Known Limitations

  • Messages sync is currently disabled (nodes are marked as disabled)
  • Runs every minute which may be excessive for some use cases
  • No incremental sync - always processes all records
  • No data validation or transformation beyond basic message parsing
  • No conflict resolution for concurrent updates

No related workflows are mentioned in the available context.

Setup Instructions

  1. Import the Workflow

    • Copy the workflow JSON into n8n
    • Save the workflow
  2. Configure Supabase Credentials

    • Create a new Supabase credential in n8n
    • Add your Supabase project URL and service role key
    • Ensure the service role has read access to all required tables
  3. Configure Airtable Credentials

    • Create a new Airtable Personal Access Token credential
    • Generate a token with access to the target base
    • Ensure the token has create/update permissions
  4. Verify Table Structure

    • Confirm Airtable base "Iganga DB on Supabase" exists
    • Verify all required tables exist with correct field names
    • Check that field types match the expected data
  5. Test the Workflow

    • Run a manual execution to verify data sync
    • Check Airtable for updated records
    • Monitor for any error messages
  6. Activate the Workflow

    • Enable the workflow to start automatic syncing
    • Monitor execution history for any failures
  7. Optional: Adjust Schedule

    • Modify the Schedule Trigger interval if needed
    • Consider data volume and update frequency requirements