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.

0
Downloads
1
Views
7.73
Quality Score
beginner
Complexity
Created:9/10/2025
Updated:11/17/2025

πŸ”’ Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments