crmIQ - Store Clients in PostgreSQL
Introduction
This guide walks you through setting up and running the crmIQ - Store Clients in PostgreSQL workflow. This use case provides an automated pipeline that receives inbound client, contact, and meeting payloads via a Webhook (e.g., from LibreChat), maps them into cascading relational tables inside a PostgreSQL database, and triggers parallel autonomous AI Research Agents to enrich your records with deep corporate profiles, stakeholder insights, and interaction sentiment tracking.
Note that this is a Use Case Instruction, you can use this Use Case as an example to build your own custom CRM Ingestion and Enrichment Workflow in n8n.
Prerequisites
Check out Connecting n8n Workflows to OpenWebUI via Function to connect OpenWebUI to n8n. You need to have set this up before starting this tutorial. Additionally, you will need:
An active PostgreSQL database instance with admin privileges.
OpenAI API or a LiteLLM gateway credential hooked into your n8n workspace.
Check out Connecting n8n Workflows to OpenWebUI via Function to connect OpenWebUI to n8n. You need to have set this up before starting this tutorial.
Steps
Step 1: Open the Workflow
On the Use Cases Page find the column crmIQ - Store Clients in PostgreSQL. Now, press the
Downloadicon.Open n8n in you Dashboard and create a workflow. Click on the three dots in the right corner of your screen and then on
Import from URL....

Enter the URL in the pop-up that appears.

Click on
Importand the Demo Workflow will appear on your page.Follow the Setup in the Workflow.
Step 2: Create a Table
In the n8n application canvas, locate the section labeled Postgres Database Maintenance.
Double-click the node Create Table and execute it. This script establishes your core relational database architecture, incorporating constraints, primary UUID keys, and flexible JSONB properties to house downstream AI enrichments:
SQL
Step 3: Initialize Inbound Webhook Listening
Navigate to the section titled Webhook Trigger (OpenWebUI).
Open the Webhook node. It is preconfigured to listen for a
POSTrequest on the pathlibrechat-mcp.Copy the Production URL from this node.
Paste this endpoint directly into your OpenWebUI Pipe Function configuration settings (
n8n_url) to securely funnel conversational payloads into the extraction pipeline.
Step 4: Configure Storage Engine & Relational Mapping
Locate the canvas block labeled Store Information. This module processes entities sequentially using cascading relationships to enforce clean data structures.
Insert or Update 'crm_companies': This node maps incoming organizational names and domains, applying an Upsert rule anchored to the
namecolumn.Insert or Update 'crm_contacts': Maps stakeholder records using
emailas the matching constraint while automatically binding the correct parentcompany_idfrom the prior node.Insert 'crm_interactions' & 'crm_tasks': Automatically records meeting logs and logs outstanding actions or filters. Double-click these nodes to verify that variable paths correctly intercept your inbound text arrays:
JavaScript
Step 5: Validate Mutation Handlers & Autonomous Research
Move over to the parallel blocks running along the right side of the canvas. Once data fields are stored, the workflow forks into three distinct AI Agents:
Company Research Agent: Uses your attached chat model to research the corporate entity using its name and website variables.
Person Research Agent: Evaluates job titles to determine seniority levels, key executive focus regions, and tailor highly optimized sales hooks.
Relationship Research Agent: Acts as an unstructured conversational text parser. It isolates emotional sentiment profiles and spots named competitors or friction patterns.
Review how each block requires its returned structured information to strip out accidental markdown tags. Open the data update nodes to review the JSON parameters:
JavaScript
Step 6: Deploy Language Models & Enrichment Injection
Within the core intelligence block, link up your active model parameters.
Double-click OpenAI Chat Model 1, 2, and 3.
Attach your specific AI provider API credentials (e.g., your GLBNXT LiteLLM or OpenAI instance).
Confirm the target engine parameter is locked at exactly
gpt-4.1(or your preferred core LLM engine).The Update database layers will automatically catch these evaluated payloads and dump them directly into the target
ai_research_enrichment,ai_profile_enrichment, andai_extracted_entitiesJSONB columns.
Step 7: Manage Database State & Housekeeping
To audit your workflow output during deployment, return to the Postgres Database Maintenance zone.
View Tables Node: Execute this node to verify running tracking statistics by viewing raw logs straight from your relational rows.
Truncate Tables Node: During staging, manually trigger this block to cleanly reset all tracking rows and clear testing data without breaking database schemas:
SQL
Need help? Contact the GLBNXT support team or ask a GLBNXT agent to walk you through the setup.
Last updated
Was this helpful?