AI Contact Data Enrichment and Supabase Logging - n8n Workflow

Use this powerful n8n workflow to enrich contact data using dynamic AI providers (OpenAI, Anthropic), generate detailed insights, and log results securely in Supabase. Explore versatile n8n templates for advanced sales automation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Sales Operations Teams: Seeking automatic lead enrichment and persona generation upon form submission.
Marketing Professionals: Requiring clean, comprehensive contact data logged in a centralized database.
Automation Specialists: Looking for robust n8n workflow examples that leverage environment variables for flexible AI configuration (OpenAI, Anthropic, custom LLMs).
Developers: Needing a reliable, auditable method to process webhook data using an n8n trigger and external APIs.

Overview

The challenge of maintaining rich and accurate contact data is solved by this sophisticated n8n workflow. It provides a highly flexible solution for teams who need instant, AI-generated buyer personas and company details derived from partial contact information. This specific design functions as versatile n8n templates, allowing the user to switch AI backends (OpenAI, Anthropic, etc.) simply by changing environment variables. Every step of the process, including the input data and the AI's response, is meticulously logged using the Supabase n8n node, ensuring full data governance and audit trails for compliance.

How it Works

This comprehensive n8n workflow begins execution when the Webhook Trigger n8n node receives an incoming request containing contact information.


  1. Ingestion & Standardization: The initial payload is handled by the Process Data code n8n node, which standardizes the input and adds crucial metadata like a unique ID and timestamp.

  2. Dynamic AI Configuration: The Prepare AI Request n8n node reads environment variables (AIPROVIDER, AIAPIKEY, AIMODEL) to dynamically configure the endpoint details. This is key to making this n8n templates solution vendor-agnostic.

  3. AI Enrichment: The Call AI API HTTP Request n8n node uses the dynamic configuration to send the contact data to the chosen LLM (e.g., GPT-4 via OpenAI). The AI performs the enrichment, providing deep insights.

  4. Database Logging: The resulting enriched data and the original payload are passed to the Save to Supabase n8n node, which inserts a new record into the workflow_logs table, fulfilling the tracking requirement.

  5. Success Confirmation: Finally, the Format Response code n8n node returns a clean, simple JSON success message to confirm that the n8n workflow completed successfully.

Installation Guide

To deploy this n8n workflow, follow these steps:


  1. Import: Copy the JSON data and import it directly into your n8n instance.

  2. Supabase Credentials: Create or configure an existing Supabase API credential named 'Supabase API' and link it to the Save to Supabase n8n node.

  3. Database Setup: Ensure your Supabase database has a table named workflowlogs with the columns: workflowname, data, airesponse, and createdat.

  4. Environment Variables: Set the following variables in your n8n instance's environment configuration (required for the dynamic configuration n8n node):

AIPROVIDER (e.g., 'openai')
AI
APIKEY (Your API key)
AIMODEL (e.g., 'gpt-4' or 'claude-3-opus')
AI_ENDPOINT (Optional, required for custom providers).

  1. Activation: Activate the n8n workflow. The Webhook Trigger will provide the URL needed to start sending contact data.

Node Details

This n8n workflow utilizes several specialized n8n node types to achieve its goal:

Webhook Trigger (n8n trigger):
Function: Serves as the activation point, listening for incoming POST requests at the defined path /contact-enrichment.
Key Configuration: Path: contact-enrichment.
Process Data (Code n8n node):
Function: Standardizes the incoming payload and adds a unique ID and a current timestamp for better tracking.
Prepare AI Request (Code n8n node):
Function: Dynamically constructs the AI configuration object by accessing credentials and settings stored in n8n environment variables.
Call AI API (HTTP Request n8n node):
Function: Executes the external API call to the configured LLM endpoint (OpenAI, etc.) for enrichment. It uses HTTP Header Authorization with the dynamically supplied API key.
Key Configuration: URL is conditional (={{$json.aiConfig.provider === 'openai' ? ... : $json.aiConfig.endpoint}}), ensuring maximum compatibility.
Save to Supabase (Supabase n8n node):
Function: Persists the workflow execution details (input data and the AI response) into the workflowlogs table.
Key Configuration: Operation: insert. Table: workflowlogs.
Format Response (Code n8n node):
* Function: Generates a clean, simple success response to the client that initiated the n8n trigger.

Related n8n Workflows

Paid

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Founder of The Workflow Muse & @SheCodesFlow. I craft elegant, task-focused automations for creators, founders, and soft-tech enthusiasts. “Automate with grace. Scale with power.”

Featured*