🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Postgres + Gallabox: WhatsApp follow ups that stick

Lisa Granqvist Partner Workflow Automation Expert

Your leads don’t really “go cold.” They just stop hearing from you because follow-ups slip, someone forgets the timing, or the last message isn’t logged anywhere useful.

This is where Postgres WhatsApp follow ups automation pays off. Marketing managers chasing MQLs feel it daily. So do busy sales reps juggling inboxes, and agency operators who can’t afford a leaky pipeline.

This workflow pulls “not ready” leads from Postgres, sends the right Gallabox WhatsApp template at the right time, and writes everything back to your database so you always know what happened.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Postgres + Gallabox: WhatsApp follow ups that stick

The Problem: Follow-ups fall apart after “not interested (yet)”

Most teams are decent at the first touch. It’s the follow-ups where everything breaks. The lead was marked “unqualified,” someone promised to check in later, and then it becomes a guessing game. Was the last message 2 days ago or 2 weeks ago? Did anyone send the brochure link? Did the lead reply and no one saw it? Over time, the mess costs real money: good-fit leads never get revived because the process depends on memory, spreadsheets, and whoever is least overwhelmed that day.

It adds up fast. Here’s where it breaks down in practice.

  • Follow-ups happen at random times, so leads either feel spammed or forgotten.
  • Message content drifts because people copy old templates and “tweak” them inconsistently.
  • There’s no reliable audit trail, which makes it hard to learn what actually converts.
  • When a teammate is out, the whole nurture sequence pauses because the logic lives in someone’s head.

The Solution: A timed WhatsApp drip driven by Postgres

This n8n workflow runs on a schedule and checks your Postgres database for leads marked disposition = unqualified that are due for a follow-up. It doesn’t blast everyone. It uses a retry counter (0 through 3) and simple time delays so each lead gets nudged at sensible intervals. For every lead it finds, the workflow chooses a WhatsApp template message that matches both the lead’s product interest (like nexus, magnus, reo, or a general option) and their current retry stage. Then it sends the message via the Gallabox API with the lead’s name and phone number filled in, logs the full activity (including message_id and API response), and updates the lead record so the next follow-up happens later, not immediately.

The workflow starts with a schedule trigger and a Postgres query that only returns eligible leads. From there, it processes leads one-by-one, generates the correct message text, sends the Gallabox WhatsApp template, and writes everything back into Postgres so your team has clean history and consistent timing.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you have 40 “unqualified” leads per week that you still want to nurture. Manually, a rep might spend about 5 minutes per lead to find the record, choose the right template, send the WhatsApp message, and note it somewhere, which is roughly 3 hours weekly. With this workflow, the “work” is basically zero: the schedule runs, Postgres returns eligible leads, and Gallabox sends the message automatically. You only step in for replies, not the busywork.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Postgres for storing leads and message logs.
  • Gallabox to send WhatsApp template messages.
  • Gallabox API credentials (generate in your Gallabox settings/dashboard).

Skill level: Intermediate. You’ll connect accounts, confirm table/field names, and paste an API key.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A scheduled check runs automatically. n8n starts this workflow on a timer (seconds-based in the template), so follow-ups happen even when nobody is watching.

Your database decides who is eligible. A Postgres query pulls leads from mql_contacts that are still marked unqualified and match the retry logic (count 0–3 plus the built-in waiting periods).

Message content is chosen for that specific lead. A small code step picks the right text based on the lead’s “model” and their current retry count, so the follow-up doesn’t feel like the same copy pasted four times.

Gallabox sends the WhatsApp template and Postgres records the truth. The workflow sends the template message (with dynamic fields like name and phone), inserts a row into mql_logs with the message_id and API response, then updates mql_contacts to increment the count and refresh last_message_sent.

You can easily modify the retry timing and the message matrix based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Schedule Trigger

Set up the workflow schedule so the automation runs on a repeating interval.

  1. Add and open Scheduled Automation Start.
  2. Set the Rule interval field to seconds so the trigger runs continuously based on seconds.
  3. Connect Scheduled Automation Start to Run Database Query to start the data fetch when the schedule fires.

Step 2: Connect Postgres and Fetch Lead Records

Query your database for leads that are due for follow-up messages.

  1. Open Run Database Query and set Operation to executeQuery.
  2. Set the Query to SELECT * FROM "MQL".mql_contacts WHERE ( (count = 0) OR (count = 1 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '3 minutes') OR (count = 2 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '5 minutes') OR (count = 3 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '8 minutes') ) AND disposition = 'unqualified' ;.
  3. Connect Run Database Query to Batch Iterate Records to process each lead in sequence.
  4. In Batch Iterate Records, leave default options to process items in batches and loop through each record.

Credential Required: Connect your Postgres credentials in Run Database Query, Log Message Record, and Update Lead Counters before running the workflow.

Step 3: Set Up the Message Logic

Transform each lead into a message variant based on model and count.

  1. Open Transform Message Matrix and paste the full JavaScript from the workflow, which maps model and count to message text.
  2. Ensure the code uses inputs from the batch item: $input.first().json.model and $input.first().json.count.
  3. Confirm the output returns { model, count, output } so the next step can reference $json.output.
  4. Connect Batch Iterate Records to Transform Message Matrix, then to Send WhatsApp Template.

⚠️ Common Pitfall: If model values don’t match the matrix keys (e.g., nexus, reo, magnus, general), the code falls back to 🛵 default.

Step 4: Configure WhatsApp Sending and Database Updates

Send the WhatsApp template, log the message, and update the lead counters in your database.

  1. Open Send WhatsApp Template and set URL to https://server.gallabox.com/devapi/messages/whatsapp and Method to POST.
  2. Set JSON Body to the provided payload, including the dynamic fields like {{ $('Run Database Query').item.json.name }}, {{ $('Run Database Query').item.json.phone }}, and {{ $json.output }}.
  3. Set JSON Headers to { "apiKey": "", "apiSecret": "" } and replace with your API credentials.
  4. Set Authentication to genericCredentialType and Generic Auth Type to httpCustomAuth.
  5. Open Log Message Record and map columns using the expressions, such as {{ $('Run Database Query').item.json.name }}, {{ $json.body.id }}, and {{ $json.statusCode }}.
  6. Open Update Lead Counters and set Operation to update, mapping count to {{ $('Run Database Query').item.json.count + 1 }} and phone to {{ $('Run Database Query').item.json.phone }}.
  7. Follow the execution loop: Send WhatsApp TemplateLog Message RecordUpdate Lead CountersBatch Iterate Records to continue processing remaining leads.

Credential Required: Connect your HTTP Custom Auth credentials in Send WhatsApp Template to authorize the API request.

Step 5: Test and Activate Your Workflow

Validate the workflow with a manual run and then switch it on for production.

  1. Click Execute Workflow and verify that Run Database Query returns rows from MQL.mql_contacts.
  2. Confirm Send WhatsApp Template returns a successful status and message_id in the response body.
  3. Check that Log Message Record inserts a row into MQL.mql_logs and that Update Lead Counters increments the count field.
  4. Turn on the workflow by toggling Active to ensure scheduled runs execute automatically.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Gallabox credentials can expire or need specific permissions. If things break, check your Gallabox API key status and template approval settings first.
  • If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this Postgres WhatsApp follow ups automation?

About 45 minutes if Postgres and Gallabox are already set up.

Do I need coding skills to automate Postgres WhatsApp follow ups?

No. You’ll mainly plug in credentials and confirm your Postgres fields match what the workflow expects.

Is n8n free to use for this Postgres WhatsApp follow ups workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Gallabox costs based on your WhatsApp messaging plan.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this Postgres WhatsApp follow ups workflow for different lead stages?

Yes, and you should. You can adjust the Postgres query to pull different dispositions (like “no answer” or “interested later”), then update the message-selection code to map those stages to the right template text. Common customizations include adding more than four follow-ups, changing the delays, and swapping the quick-reply buttons to match your actual next steps (pricing, calendar link, brochure, or a call request).

Why is my Gallabox connection failing in this workflow?

Usually it’s an expired or incorrect API token, or a template that isn’t approved for your WhatsApp number. Regenerate the key in Gallabox, paste it into the HTTP Request node in n8n, then test with one known-good phone number. If it still fails, check the Gallabox response being stored in your logs, because the status/code there often tells you exactly what’s wrong.

How many leads can this Postgres WhatsApp follow ups automation handle?

Plenty for most small teams: hundreds per day is realistic, and if you self-host n8n there’s no hard execution cap beyond your server and Gallabox limits.

Is this Postgres WhatsApp follow ups automation better than using Zapier or Make?

Often, yes, because this flow relies on database querying, branching logic, and a clean audit log, not just “when X happens, do Y.” n8n is comfortable with Postgres and lets you loop through leads one-by-one, which keeps messaging controlled. It’s also easier to store responses (like message_id and API status) back into your own tables. Zapier or Make can still work, but multi-step logic plus database writes tends to get expensive or brittle. If you want a sanity check before you build, Talk to an automation expert.

Set this up once, and your “not ready” leads stop slipping through the cracks. The workflow handles the repetitive follow-ups and logging so your team can focus on actual conversations.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal