I’m building a WhatsApp customer service automation with n8n and I’m stuck on a core workflow design issue.
Goal / desired behavior
User sends a message to our WhatsApp number
n8n receives it via the WhatsApp Trigger
We reply with a WhatsApp template message that contains interactive buttons (quick replies)
The user taps a button
Based on the selected button, the workflow should continue the conversation logic (route to the correct path)
Problem
The WhatsApp Trigger fires on every inbound message, including the button reply.
So when the user taps a button, that reply comes in as a new inbound message and the entire workflow starts again from the beginning (step 1), instead of continuing from where we left off.
That means I can’t “pause” after sending the template and then “resume” on button selection. I also don’t want a UX where every user action re-triggers the whole flow.
What I’m looking for
The best-practice pattern in n8n to handle WhatsApp interactive replies without restarting the whole logic
How you usually implement:
conversation state / session handling (per phone number)
routing based on button payload (button_reply id / payload)
preventing the “start menu” from being resent when the reply is a button click
Ideally: a recommended node setup or pattern (Data Store / Redis / DB / workflow splitting / correlation id, etc.)
Context
We send a Meta WhatsApp template message with buttons after the first inbound message.
The button click comes back as an inbound webhook event and triggers the workflow again.
I can read the button payload/id from the incoming JSON, but I’m unsure how to structure the workflow so it continues the same “session” instead of restarting.
If anyone has a proven architecture for this in n8n, or a small example workflow, I’d really appreciate it. Thanks.
Hi @Mika1!
This type of problem is very common, what i recommend is that using a session approach where you log user’s information as status that is he live or firstmessage and what this approach would clarify is that for a long term scalable operation also add each user as it’s own queue of session something like this
And also something i would mention with my own experience that try to keep things either in HITL or in single thread endings, like in apps like telegram and whatsapp instead of letting user interact is nice but this openly like your current workflow is not a good practice, so instead of complete workflow required to run everytime make the conversation pattern so that the user gets what he needs in single workflow run or just use HITL nodes for interactive conversation instead of letting the workflow run with every single message for the same user. Hope this helps!
thanks a lot for your detailed answer, that helped me understand the direction (state/session per user + optional buffering with a short timer).
I’m still struggling a bit with the practical implementation in n8n, especially the “don’t restart the whole workflow on every incoming message” part. Do you happen to have a simple template workflow (or a screenshot / example structure) you could share that solves this pinpoint problem?
Would be extremely helpful. I’d really appreciate it.
Sure a thing @Mika1! What i said with ‘do not restart your workflow on every incoming message’ is that make the workflow enough broad to cover at least every user’s common problem that instead of running workflow with every query every new message try to enlarge the workflow with more personalized experience as if user sends a message it should get either HITL for conversation and information or the user should get what he is texting for, for example if i may show a high level overview of how your workflow should be looking like it would be:
So what i wanted to cover in this workflow kind of plan is to showcase that each query is being handled completely like in your example you have sent a template and that is where your workflow ended , instead use HITL node and get the input then further classify it and make it complete the user’s question, so with this there will be no room left for workflow have to run multiple times or workflow sending templates multiple times. This approach is pretty solid! Let me know what you think.