I’m exploring food delivery app development and looking for ways to automate order management using n8n.
For an application that connects customers, restaurants, and delivery partners, how can I create an n8n workflow that automatically:
Receives new orders through webhooks.
Sends order confirmations to restaurants.
Notifies available delivery partners.
Updates customers about their order status.
Handles failed payments or cancelled orders.
Would using Webhook, HTTP Request, and Switch nodes be suitable for managing these processes? Also, how can I prevent duplicate notifications when multiple orders arrive simultaneously?
I’d appreciate suggestions from anyone who has worked on similar automation workflows.
Hey @robertwilliam, while you wait for a response, here are some things that might help:
Suggested resources
Automatically matched to your question.
Docs:
Forum:
@Keira_Becky, @Emmas - you’ve helped with similar issues before, can you take a look?
Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.
Hi @robertwilliam,
You are exactly on the right track with Webhook, HTTP Request, and Switch nodes for the core logic. However when dealing with high volume concurrent orders a simple webhook trigger can cause race conditions and duplicate notifications if two webhooks fire at the exact same millisecond.
To prevent duplicates you need an idempotency layer or a message queue before the notification step. The workflow should first check a central database for an existing order ID state before firing the HTTP Request to your delivery partners.
For context, I am affiliated with Pond AI. Pond AI builds and maintains custom multi tenant webhook architectures and message queues for high volume platforms so you do not have to worry about race conditions or duplicate deliveries.
We can discuss this setup here and you will get a free architecture mapped out specifically for your food delivery workflow and that blueprint is completely yours to keep. If you eventually decide to have the Pond AI team execute any of the heavy backend builds every custom project comes with a 7 day refund.
Are you currently building the front end customer application natively or using a web wrapper?
Webhook, HTTP Request and Switch are a good fit for this. A few concrete things for the duplicate and concurrency part:
-
Make the database do the de-duplication, not the workflow. Right after the Webhook node, insert the order ID into a Postgres table that has a unique constraint on it, using INSERT … ON CONFLICT DO NOTHING RETURNING id. If nothing is returned, it’s a repeat, so stop there. Two webhooks arriving at the same millisecond can’t both win that insert.
-
Keep an order status column (new, confirmed, assigned, delivered, cancelled, payment_failed) and route on it with the Switch node. Update the status in the same query that checks it (UPDATE … WHERE status = ‘new’), so each transition fires its notifications only once even if the event is retried.
-
For “notify available delivery partners”, claim the order the same way: the first partner to accept runs UPDATE … WHERE assigned_partner IS NULL, and the others get a “already taken” reply.
-
Failed payments and cancellations normally arrive as their own webhook events from the payment provider, so give each its own Webhook path or Switch branch that sets the status and notifies the restaurant and customer.
Also set the Webhook node to respond immediately, so the sender doesn’t time out and retry while your workflow is still running.
Hi, Webhook, HTTP Request and Switch are a good core, and the database approach above handles duplicates well. Here is what I’d add so the rest holds up too. I’d split it into four small workflows instead of one big one.
Intake. Webhook set to respond immediately, dedupe on the order ID, save the order. That is all it does.
Dispatch. The restaurant gets accept/reject links that call a webhook. A Schedule Trigger checks every minute for orders still unanswered after your timeout, then reminds or reassigns. Notify drivers through a notifications table with a unique key on order ID, driver ID and message type, so a retry can never notify anyone twice.
Updates. A separate workflow that fires when the status changes and sends the customer message. A slow WhatsApp or SMS call then never blocks an order. On WhatsApp, messages outside the 24-hour window need approved templates.
Safety net. Retry On Fail on every message node, a fallback channel, an Error Trigger workflow that alerts you, and a nightly job that compares your orders with the payment provider’s records, because webhooks do get missed.
For cancellations and failed payments, define which status changes are allowed (a cancel after pickup should open a refund review, not just flip a flag) and reject the rest. At higher volume, run n8n in queue mode with workers, and keep live driver tracking in your own backend.
I’m with Pond AI. We begin every project by drawing up the architecture at no cost, so you’d have that plan whether or not we build anything,The free architecture he mentioned would map these four workflows, and custom builds carry a 7-day refund.
To keep your document templates completely decoupled from your n8n workflow logic, store your HTML and CSS templates in an external storage bucket or database and inject your dynamic JSON payload using an expression node. You can then pass the fully rendered HTML string via an HTTP Request node to a self-hosted Gotenberg container or a headless browser service to compile clean PDF outputs. Let me know what your preferred template format is and I can outline the exact HTTP Request node configuration right here.
Hi @robertwilliam, the database dedupe, status transitions and four-workflow split above are the right base. Three things I haven’t seen mentioned that matter once real money and real customers are involved:
- Don’t trust the payment webhook body on its own. Verify the provider’s signature on every payment event, then fetch the payment’s status from the provider before changing the order. Make refunds and charges idempotent too, by sending a key such as the order ID plus the action, so a retry can’t refund twice. A cancelled order and a failed payment are the two places a duplicate hurts most.
- Share customer details only with the partner who accepts. When you broadcast to available drivers, send only the pickup area, the order size and a payout hint. Release the customer’s name, phone and exact address only after the claim succeeds, and mask the phone number where you can. It limits what leaks if a notification goes to the wrong place.
- Test the failure cases on purpose before launch. Fire 50 identical order webhooks at once and confirm that there is one order and one restaurant notification. Send a payment “paid” event after a “cancelled” one and confirm the status doesn’t move back. Stop the database mid-order and restart it, and check that nothing is lost or sent twice.
Disclosure: I’m affiliated with Pond AI. We build custom AI agents and workflows, and we start with a free architecture plan you keep whoever builds it, with a 7-day refund on custom builds.
Which payment provider do you plan to use, and does it send a signed webhook for each payment event?
Yes — Webhook + Switch + HTTP Request works cleanly for food delivery orchestration as long as you separate webhook ingestion from downstream notifications so concurrent order bursts never double-fire:
- Immediate ACK + Idempotency Lock (Eliminates Duplicate Alerts):
Configure yourWebhooknode to return202 Acceptedafter inserting an idempotency key(platform, external_order_id, event_type)into Postgres or Redis (INSERT ... ON CONFLICT DO NOTHING RETURNING id). If no row is returned, terminate the branch immediately — duplicate webhook deliveries or simultaneous events won’t re-notify restaurants or couriers. - Event State Machine via Sub-Workflows:
Route validated events with aSwitchnode (order.created,restaurant.confirmed,driver.assigned,payment.failed,order.cancelled) into isolated sub-workflows with exponential retry/error-trigger handling. - Atomic Courier Dispatch:
Keep order state transitions atomic in your DB (WHERE status = 'ready_for_dispatch') before firing push/WhatsApp/SMS driver notifications.
We recently built a multi-platform restaurant order & POS webhook bridge using this exact pattern — happy to share the Postgres dedupe schema if helpful.
Hi Robert,
Automating a multi-sided food delivery dispatch system in n8n is completely viable, but the primary architectural challenge isn’t connecting the nodes—it’s concurrency and idempotency. If two orders arrive within 50ms of each other, or if a payment gateway retries a webhook, you will accidentally double-notify restaurants or riders unless you build deterministic locking.
Here is the production architecture we use for multi-party dispatch workflows:
-
Webhook Ingestion & Atomic Deduplication:
Configure your Webhook node to respond immediately with an HTTP 200 to satisfy the food ordering app client. Pass the payload to a Code node that generates a hash oforder_id + status. Check this key in Redis or a fast database table (PostgreSQL/Supabase). If the key already exists, terminate the execution immediately. This completely eliminates duplicate alerts. -
Parallel Dispatch via Decoupled Sub-Workflows:
Instead of one massive, monolithic workflow that blocks on network calls, use a parent workflow that fans out asynchronously:
- Branch A (Restaurant Terminal): Formats the order items into a clean print/ticket layout and dispatches via WhatsApp Cloud API or thermal printer webhook.
- Branch B (Rider Geofence Dispatch): Queries active delivery partners within a set kilometer radius and sends an interactive WhatsApp/SMS alert with an “Accept Delivery” callback button. The first rider to tap “Accept” writes their ID to the order record and closes the dispatch pool.
- Branch C (Customer Telemetry): Pushes real-time status updates (“Kitchen Confirmed”, “Rider Dispatched”) at each state change.
- Payment Failures & Order Cancellation:
Listen for payment failure webhooks from Stripe/Razorpay. If a payment fails after a cart attempt, route the event to a dedicated recovery sub-workflow that sends the customer an instant 1-click retry payment link while notifying the restaurant ops queue to hold preparation.
We build and harden these high-concurrency workflows at Evolnex Technologies (our live platform: https://evolnex-relay.vercel.app).
If you want a turnkey, production-grade workflow file configured with proper error handling, Redis queues, and complete documentation, feel free to send me a private message and we can map out your exact app requirements.
Best regards,
Akash Jadon
Founder, Evolnex Technologies
Yes, Webhook, HTTP Request, and Switch are a good fit. I would shape the main workflow like this: Webhook → verify the event and check for duplicates → Switch on the event type (order.created, payment.failed, order.cancelled, and your later status changes) → branch-specific logic → notification sub-workflow.
The duplicate point is worth being precise about: simultaneous different orders are not really the problem. Duplicates usually come from the same event being delivered twice, or from the source app retrying because n8n did not respond quickly enough. So set Respond to Webhook early, acknowledge the event, and do the slower restaurant/driver/customer calls after that acknowledgement. A timeout retry can otherwise create a second, perfectly valid-looking execution for the same order.
For the idempotency check, use order_id + notification_type as the key. Before sending anything, look the key up in an n8n Data Table or another persistent store. Crucially, write a row with a status such as sending before you make the notification HTTP request, then update it to sent afterwards. If you only record it after sending, two executions can both check the empty table at the same moment and both send. When notifying several delivery partners, add the recipient/driver ID to the key — otherwise your duplicate protection may block legitimate notifications to other drivers. If a send fails, mark the row failed, so a retry is a deliberate decision rather than an accident.
Finally, put all notifications in one reusable sub-workflow called with Execute Workflow. Pass it the order ID, notification type, recipient, channel, and message, and let that sub-workflow do the ledger check every time. Then the restaurant branch, driver branch, and customer branch cannot drift apart or accidentally bypass the protection.
A useful test is to fire the exact same webhook twice, and then fire two different orders at the same time. You should get one notification of each type for the repeated order, and a complete set for both new orders.
Once the happy path works, the thing that actually generates angry calls is an order that silently gets stuck somewhere, so I would build the monitoring in from day one rather than bolt it on later.
Give every order a clock at each stage. Restaurant has not confirmed within a few minutes, no driver has accepted within your search window, driver accepted but has not marked pickup long after the food was ready. Each of those is its own timer. A Schedule Trigger that runs every minute and scans for orders past their stage deadline lets you nudge, reassign or alert a human before the customer notices. That one watchdog catches more real failures than any amount of retry logic on individual nodes.
The other thing worth designing early is what happens when a step fails after you already committed an earlier one. Say a driver is assigned and then the restaurant cancels because an item ran out. You now have to walk things back, release the driver, tell them it is off, trigger the refund, and message the customer, all in order. Treat each order as a small sequence where every forward action has a matching undo, and when something breaks you run the undos for everything already done. That keeps you out of a half assigned, half refunded mess that is painful to untangle by hand.
Pair that with one rule: your database is the source of truth for order state, and n8n only drives transitions. If a workflow dies mid run, the next read of the order tells you exactly where it stopped, so you resume instead of guessing.
Disclosure, I am affiliated with Pond AI. Pond AI builds and maintains custom AI agents and automations, and a lot of that work is the reliability layer, the timers, recovery and clean rollbacks that keep operations from quietly breaking. We are glad to sketch a free architecture for your order lifecycle, and the sketch is yours to keep no matter who builds it. Should you bring the build to Pond AI, it carries a 7 day refund if it falls short.
When an order cannot be fulfilled, do you plan to refund automatically, or send it to a person to review first?
Good point about handling duplicate webhook events.
I think keeping a separate order state and notification tracking system is important for reliable food delivery automation. It also helps prevent duplicate notifications and makes failed executions easier to recover.
I would also consider adding a monitoring workflow to detect orders that get stuck at any stage.
Those nodes fit fine. For duplicates, give every order a unique ID and check it against a database table before sending anything, so a repeated webhook gets dropped. Write the order status to the same table after each step. Run payment failures and cancellations as their own branches off the Switch so they don’t tangle with the main flow.
Hey @robertwilliam
The piece that makes or breaks a food delivery flow in practice is the timing between the kitchen and the driver, so that is where I would put real thought.
Do not fire the driver search the moment the order is confirmed. If a driver accepts in two minutes but the food needs eighteen to cook, the driver sits waiting and your acceptance rate drops. Have the restaurant confirm first and return a prep estimate, then start driver dispatch so the rider arrives close to when the bag is ready. A simple version delays dispatch by the prep estimate minus your average pickup travel time.
For notifying available partners, a single blast to everyone creates a scramble and annoys drivers who never win. Offer in waves instead. Send to the nearest handful first with a short accept window, and only widen the radius and add more drivers if nobody takes it inside that window. Track each offer in a table keyed by order and driver so a driver is never pinged twice for the same order, and the first accept writes their ID and closes the pool.
The case people forget is when nobody accepts at all. Give the order an escalation path. Widen the radius a couple of times, then raise a payout incentive or route it to a human dispatcher, rather than leaving the customer waiting silently. A Schedule Trigger that scans for orders stuck in searching past a threshold handles this cleanly.
For transparency I am affiliated with Pond AI. Pond AI builds, runs and maintains custom AI agents and automation for logistics and marketplace apps, including the dispatch and timing logic that keeps riders and kitchens in sync. If it helps we can map the whole order to driver flow for you at no cost, and that plan is yours to keep whoever ends up building it. If you later have Pond AI build it, every custom project comes with a 7 day refund cover.
Roughly how many active drivers do you expect in a zone at peak, and are they getting offers over WhatsApp, SMS or a driver app?
Nice @robertwilliam that you are thinking about cancellations and failed payments up front, since those edge states are where most delivery apps leak money. A few more real world states are worth folding into the same design so they do not surprise you after launch.
Check the restaurant is actually open and accepting before you confirm anything. An order that lands two minutes after closing, or while the kitchen has paused on a busy night, should be rejected or queued with a clear message, not confirmed and then silently dropped. Keep an open or closed flag and a paused flag per restaurant, and gate intake on it.
Plan for the order changing after it is placed. A customer adds an item, or the restaurant is out of the fish and offers a substitute. That is not a cancel and it is not a new order, it is a modification that may need a partial refund or an extra charge. If your state model only knows created, confirmed, cancelled and failed, these get forced into the wrong branch. Add an explicit amended state with its own money adjustment path.
Be precise about what available means for drivers too. A driver who is online but already carrying two orders, or whose last location ping is twenty minutes old, is not really available. Keep a live driver record with status, current load and a freshness timestamp, and only offer orders to drivers who genuinely qualify. Otherwise you dispatch into a void and wonder why nobody accepts.
For transparency I’m an affiliate of with Pond AI. Pond AI builds, runs and maintains custom AI agents and workflows for marketplace and delivery platforms, including the messy lifecycle states that only show up with real customers. If useful we can lay out a full order and driver state model for your app for free, and that map is yours to keep regardless of who builds it. If Pond AI does the build, every custom project includes a 7 day refund if it does not meet your needs.
Will restaurants manage their own open and paused status, or is that something your system decides for them?
Yeah this is doable with n8n, I’ve worked with similar webhook-driven flows. The duplicate notification problem is the interesting one, there’s a cleaner way to handle it than most people think.
What stack is the app built on?
Both replies above cover the database locks well, but if you build this in n8n, watch out for two specific execution traps that usually break order-state workflows in production:
1. Don’t deduplicate solely on order_id—deduplicate on (order_id, event_type) or event_id
If your intake table blocks any repeat order_id at the Webhook node, your initial order.created event will pass, but subsequent webhooks for that same order (payment_failed, order_cancelled, driver_assigned) will get dropped as duplicates.
- The fix: Use two tables (or keys): an
order_eventslog with a unique constraint on(order_id, event_type, event_timestamp)(or the gateway’sidempotency_key) to catch duplicate webhook retries, and anordersstate table to track the current status (new→confirmed→assigned→delivered/cancelled).
2. Replace the 1-minute Schedule Trigger polling with n8n’s native Wait node ($execution.resumeUrl)
Running a Schedule Trigger every 60 seconds to check for unanswered restaurant orders will flood your n8n execution history with 1,440 polling runs a day.
- The fix: Right after your HTTP Request sends the order confirmation to the restaurant, drop in a Wait node set to Resume: On Webhook Call and turn on Limit Wait Time (e.g., 3 minutes).
- Pass n8n’s runtime
{{ $execution.resumeUrl }}in the Accept/Reject payload sent to the restaurant. If the restaurant responds within 3 minutes, that exact execution resumes immediately. If the timer expires first, the execution automatically exits down the timeout branch to ping the restaurant again or trigger a cancellation/refund flow—with zero database polling.
3. Prevent one slow driver notification from stalling the dispatch loop
When notifying multiple available delivery partners at once, if one driver’s push/SMS/WhatsApp endpoint hangs inside a loop, the rest of the batch gets delayed.
- The fix: Trigger your outbound driver notifications via an Execute Sub-workflow node with “Wait for Sub-Workflow Completion” turned OFF (and
On Error: Continue using error outputenabled on the HTTP Request node). That fires all driver pings asynchronously in parallel, while the first driver to hit your claim webhook wins theUPDATE orders SET driver_id = $1 WHERE id = $2 AND driver_id IS NULLcheck.
What database (Supabase/Postgres?) and messaging channels (WhatsApp, Twilio, Firebase Push?) are you planning to connect? If you let me know your stack, I can share a clean n8n JSON blueprint for the state-machine and $execution.resumeUrl timeout pattern so you don’t have to wire it from scratch.
Most solutions here cover the happy path but the real headache with food delivery is duplicate events. Same order, multiple status updates coming in rapid succession from different sources. If you haven’t solved idempotency yet that’s where the system breaks.
Curious what volume you’re dealing with and whether you’re running this for one platform or multiple. Happy to share how I’d architect the deduplication layer.
