# Debounce and buffer WhatsApp AI replies with Redis and Gemini: n8n workflow

> Started by an incoming WhatsApp message, and works across Redis and WhatsApp. It hands the judgement calls to Gemini.

Source: https://millionrounds.com/workflow/debounce-and-buffer-whatsapp-ai-replies-with-redis-and-gemin (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Chat assistants](https://millionrounds.com/workflows?category=Chat+assistants#library)

# Debounce and buffer WhatsApp AI replies with Redis and Gemini

Started by an incoming WhatsApp message, and works across Redis and WhatsApp. It hands the judgement calls to Gemini. 29 steps, 5 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fdebounce-and-buffer-whatsapp-ai-replies-with-redis-and-gemin)

**29 steps** Large: read it before trusting it with anything live

**5** Branches: places the flow splits

**1** Loop or waits

**2** Services it connects to

## The flow

Starts it 1 Model 3 Logic 12 Service 13

The steps in the order they run, from what starts it.

- 1 **When WhatsApp Message Received** Whats App trigger *Starts it*
- 2 **Gemini Chat AI Model** Lm Chat Google Gemini *Model*
- 3 **Parse Structured Output** Output Parser Structured *Model*
- 4 **Set Message Details** Set *Logic*
- 5 **Intelligent Response Agent** Agent *Model*
- 6 **Check for Message Content** If *Logic*
- 7 **Dispatch WhatsApp Reply** Whats App *Service*
- 8 **Check If Text Message** If *Logic*
- 9 **Free Processing Lock** Redis *Service*
- 10 **Fetch Deduplication Key** Redis *Service*
- 11 **Notify Non-Text Message** Whats App *Service*
- 12 **Check Processing Status** If *Logic*
- 13 **Ignore Duplicate Message** No Op *Logic*
- 14 **Record Deduplication Key** Redis *Service*
- 15 **Retrieve Message Buffer** Redis *Service*
- 16 **Integrate Message into Buffer** Set *Logic*
- 17 **Store Merged Buffer** Redis *Service*
- 18 **Update Message Timestamp** Redis *Service*
- 19 **Wait 15 Seconds to Debounce** Wait *Logic*
- 20 **Verify Message Timestamp** Redis *Service*
- 21 **Confirm Latest Message Status** If *Logic*
- 22 **Acquire Processing Lock** Redis *Service*
- 23 **Abort Stale Process** No Op *Logic*
- 24 **Check If Lock is Busy** If *Logic*
- 25 **Abort Due to Busy Lock** No Op *Logic*
- 26 **Establish Processing Lock** Redis *Service*
- 27 **Fetch Final Message Buffer** Redis *Service*
- 28 **Assemble Combined Text** Set *Logic*
- 29 **Reset Message Buffer** Redis *Service*

## How it's built

- **Starts on:** An incoming WhatsApp message
- **Steps:** 29, with 5 branches, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Redis, WhatsApp
- **Model:** Gemini

## Questions

What does it need to run?

An n8n account, plus your own Redis and WhatsApp accounts, and a key for Gemini. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming WhatsApp message.

Does it use AI?

Yes. It calls Gemini. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 29 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 29 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fdebounce-and-buffer-whatsapp-ai-replies-with-redis-and-gemin)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Redis](https://millionrounds.com/workflows?service=Redis#library)[WhatsApp](https://millionrounds.com/workflows?service=WhatsApp#library)

## Workflows like it

Also chat assistants, with the same services where possible, closest in size first.

- [**Run a multimodal WhatsApp AI assistant with OpenAI** 30 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/run-a-multimodal-whatsapp-ai-assistant-with-openai)
- [**WhatsApp chat agent with Gemini and Supabase** 28 steps · calls a model · Supabase, WhatsApp](https://millionrounds.com/workflow/whatsapp-chat-agent-with-gemini-and-supabase)
- [**AI Restaurant Virtual Waiter Chatbot for WhatsApp & Website** 27 steps · calls a model · Google Sheets, WhatsApp](https://millionrounds.com/workflow/ai-restaurant-virtual-waiter-chatbot-for-whatsapp-and-websit)
- [**AI-powered WhatsApp chatbot for text, voice, images & PDFs** 26 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/ai-powered-whatsapp-chatbot-for-text-voice-images-and-pdfs)
- [**Build RAG-powered WhatsApp chatbots for docs with OpenAI** 32 steps · calls a model · Google Docs, WhatsApp](https://millionrounds.com/workflow/build-rag-powered-whatsapp-chatbots-for-docs-with-openai)
- [**Build an AI WhatsApp chatbot with Gemini and Wikipedia** 24 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/build-an-ai-whatsapp-chatbot-with-gemini-and-wikipedia)
