Automated WhatsApp Lead Nurturing with Personalized Messages via Postgres & Gallabox
n8n Workflow: WhatsApp Lead Nurturing (MQL)
π Purpose This workflow fetches unqualified leads from Postgres at defined retry intervals, sends personalized WhatsApp template messages via Gallabox API, and logs message activity while updating lead status in the database.
π§© Workflow Structure
Schedule Trigger Type: n8n-nodes-base.scheduleTrigger Runs the workflow automatically at set intervals (seconds-based). Entry point of the workflow.
Execute a SQL query
Type: n8n-nodes-base.postgres
Fetches leads from mql_contacts that:
Have count = 0, 1, 2, or 3.
Respect time delays:
count=1 β after 3 minutes
count=2 β after 5 minutes
count=3 β after 8 minutes
Must have disposition = unqualified.
Loop Over Items4 Type: n8n-nodes-base.splitInBatches Iterates over each lead individually. Ensures one-by-one processing.
Code1 Type: n8n-nodes-base.code Selects message content based on: Leadβs model (nexus, magnus, reo, general). Current count (0β3). Ensures personalized, varied message text.
new_lead_4 Type: n8n-nodes-base.httpRequest Sends WhatsApp template message through Gallabox API. Dynamic fields: Leadβs name and phone. Message details selected from Code1. Quick reply buttons: Show Brochure, Get Showroom Location, Not Interested.
Insert rows in a table4 Type: n8n-nodes-base.postgres Inserts a record into mql_logs. Captures: Phone, name, disposition. Message count, message_id, timestamps. Gallabox API response (status, code).
Update rows in a table4 Type: n8n-nodes-base.postgres Updates mql_contacts: Increments count by 1. Updates last_message_sent timestamp. Matches using phone number.
Sticky Notes Provide inline documentation: SQL query purpose. Message matrix explanation. Gallabox API role. Postgres update/logging details.
βοΈ Data Flow Summary
Trigger** β Runs every X seconds
SQL Query** β Fetches eligible leads (unqualified, retry intervals)
Loop** β Processes each lead sequentially
Code1** β Chooses personalized message based on model & count
HTTP Request** β Sends WhatsApp template via Gallabox
Insert Log** β Stores activity in mql_logs
Update Contact** β Updates count & last sent in mql_contacts
Cycle repeats** until all leads are processed
π Use Case
Automates WhatsApp drip campaigns for unqualified leads.
Respects retry intervals to avoid spamming.
Uses personalized message variations based on product model & retry count.
Provides full traceability with logs and lead updates.
Related Templates
Send structured logs to BetterStack from any workflow using HTTP Request
Send structured logs to BetterStack from any workflow using HTTP Request Who is this for? This workflow is perfect for...
Provide latest euro exchange rates from European Central Bank via Webhook
What is this workflow doing? This simple workflow is pulling the latest Euro foreign exchange reference rates from the E...
Convert Tour PDFs to Vector Database using Google Drive, LangChain & OpenAI
π§© Workflow: Process Tour PDF from Google Drive to Pinecone Vector DB with OpenAI Embeddings Overview This workflow au...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments