A Lead Burst Belongs in a Queue, Not in the Request
When an ad campaign takes off, every lead arrives in the same minute. Store each one first and work on it second.
The short version
5 things that decide this
- 01A good ad day sends leads in a burst. If each lead is processed inside the request that delivers it, the burst competes with your own dashboard.
- 02Store every incoming lead in a queue first. Workers then drain the queue in batches, for intake and for outgoing messages.
- 03Supabase documents its Postgres queues as durable, with messages held until they are explicitly removed.
- 04Delivery from a queue is exactly once only within a visibility window, so build each worker to cope with a repeat.
- 05Ask any vendor what happens to your dashboard on your best campaign day, not a quiet Tuesday. Or run a campaign-sized burst against a staging copy.
How should a lead platform handle a sudden burst of inquiries?
It should write each inquiry to a queue the moment it arrives and do the slow work afterwards. Workers pick leads off the queue in batches to ingest them, send the first text and send the first email. Your dashboard never waits on that work, so a busy campaign can't stall it.
A great ad day can be the app's worst
A clinic switches on a Facebook Lead Ads campaign and it works. The inquiries stop trickling and start pouring in. Each one comes from a form, a webhook or a CRM, and each one needs a first reply within seconds.
That is the moment the platform is judged. Algoricum is the clinic follow-up platform we helped build. Leads from Facebook, Google forms, JotForm, a website and a CRM all land in one pipeline. When a campaign takes off, they land together.
A platform that handles each lead inside the request that delivered it has one place for everything to pile up. Your staff open the dashboard to check the morning's inquiries, and they share that place with the burst.
Inline work turns a burst into a traffic jam
Handling a lead inline means one request does every step. It reads the payload, cleans the fields, saves the row, sends the text and sends the email. Some steps call outside services, and those are slow when they're busy. Every slow call holds its request open.
When a burst of leads arrives in a single minute, a burst of requests stays open at once. Your front desk's dashboard runs on those same servers, which are now waiting on those calls. This is our reasoning about how inline processing behaves, not a measurement from a clinic.
A queue breaks the link. Your request does one small thing: it stores the lead. Everything slow happens later, at a pace the workers set, so a longer line only means a slightly later text.
- 01Request: store the lead and stop.
- 02Queue: hold it until a worker is free.
- 03Worker: do the slow calls, a batch at a time.
- Inquiry arrivesFacebook, Google, JotForm, the website or a CRM, by webhook.
- Stored and queuedStored and queued in PostgreSQL. Nothing slow happens here.
- Worker for intakeTurns the stored payload into a lead.
- Workers for SMS and emailSend the first touch, a batch at a time.
- DashboardReads the pipeline and never waits on the burst.
Webhooks only store. A queue carries the work. Dashboard reads stay untouched.
What the queue gives you, in the vendor's own words
Algoricum is built this way. Its case study says webhook spikes “land in pgmq queues inside PostgreSQL”. Dedicated workers drain those queues in batches, with separate work for lead ingestion, SMS and email. The stated aim is a dashboard that a campaign taking off cannot stall.
Supabase documents the pgmq extension. Its Queues page calls them “Durable Message Queues with Guaranteed Delivery in Postgres”. The pgmq page adds that “Messages stay in the queue until explicitly removed”. Both are claims about the tool, not about any clinic's results.
One line deserves a second read. Supabase also says a message is delivered exactly once to a consumer “within a customizable visibility window”. If a worker dies mid-job, the message can come back after that window. We read that as a reason to make every worker safe to repeat, so a lead never gets two first texts. That conclusion is ours, not Supabase's.
Three choices that make the queue earn its place
Keep your intake step small, so that it only stores the lead and returns. Any step that calls an outside service goes behind the queue, however quick it feels in testing.
We'd give each kind of work its own workers. Intake, SMS and email fail in different ways, and a texting problem shouldn't hold up your email.
We'd also make every worker safe to run twice, by checking whether the first touch already went out. Webhooks that never arrive are a separate problem, and our post on webhooks that break quietly covers it.
What a queue does not fix
A queue protects your app. It doesn't make a lead worth more, and it doesn't answer your patient. The case study is plain that the model is the easy part, and that the plumbing around it makes Algoricum work. A trained assistant also answers only from what a clinic uploads. If you never update the price list, it quotes the old one.
The case study publishes no outcome numbers, and we attach none here. This is an argument about design. Before you trust any platform, including ours, ask what happens to the dashboard on your best campaign day. Then run a campaign-sized burst against a staging copy and watch.
Questions this raises
01What is a message queue in a lead follow-up system?+
It's a holding line for work. You store a new inquiry first, and a worker handles it later. In Algoricum that line lives in PostgreSQL and feeds lead ingestion, SMS and email.
02Why do inbound leads arrive in bursts?+
Ads reach many people at once, and your forms, website and CRM can all fire together. One working campaign can turn a trickle into a flood within a minute.
03Is a Postgres queue enough, or do you need a separate queue service?+
Supabase documents its Postgres queues as durable, with messages kept until explicitly removed. Whether that fits depends on your volume and your team, so run a campaign-sized burst against a staging copy and see whether your dashboard stays quick. Algoricum uses it, and the case study names no limits either way.
04Does a queue guarantee a lead is never processed twice?+
No. Supabase describes exactly-once delivery within a visibility window, so a message can return if a worker fails. Build your workers to check what has already been sent before they send it again, and a repeat does no harm.
Related
- Algoricum: AI clinic lead follow-up →The platform this post draws on, with its queue design in full.
- AI front desk for clinics →What we build for practices that lose inquiries between the ad and the booking.
- Med spa leads go cold between the ad and the booking →Why speed to first touch matters once the lead is in.
- Webhooks break quietly. Design for the day they do. →The other half: events that never reach the queue at all.

