Automated WhatsApp lead nurturing with personalized messages via Postgres & Gallabox
$20/month : Unlimited workflows
2500 executions/month
THE #1 IN WEB SCRAPING
Scrape any website without limits
HOSTINGER 🎉 Early Black Friday Deal
DISCOUNT 20% Try free
DISCOUNT 20%
Self-hosted n8n
Unlimited workflows - from $4.99/mo
#1 hub for scraping, AI & automation
6000+ actors - $5 credits/mo
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.
- Type:
Execute a SQL query
- Type:
n8n-nodes-base.postgres - Fetches leads from
mql_contactsthat:- Have
count= 0, 1, 2, or 3. - Respect time delays:
count=1→ after 3 minutescount=2→ after 5 minutescount=3→ after 8 minutes
- Must have
disposition = unqualified.
- Have
- Type:
Loop Over Items4
- Type:
n8n-nodes-base.splitInBatches - Iterates over each lead individually.
- Ensures one-by-one processing.
- Type:
Code1
- Type:
n8n-nodes-base.code - Selects message content based on:
- Lead’s model (
nexus,magnus,reo,general). - Current count (0–3).
- Lead’s model (
- Ensures personalized, varied message text.
- Type:
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.
- Type:
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).
- Type:
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.
- Type:
Sticky Notes
- Provide inline documentation:
- SQL query purpose.
- Message matrix explanation.
- Gallabox API role.
- Postgres update/logging details.
- Provide inline documentation:
⚙️ 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.