Automation library · Chat assistants

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.

LargeCalls a model: Gemini

29 stepsLarge: read it before trusting it with anything live
5Branches: places the flow splits
1Loop or waits
2Services it connects to

The flow

Starts it 1Model 3Logic 12Service 13

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

  1. 1When WhatsApp Message ReceivedWhats App triggerStarts it
  2. 2Gemini Chat AI ModelLm Chat Google GeminiModel
  3. 3Parse Structured OutputOutput Parser StructuredModel
  4. 4Set Message DetailsSetLogic
  5. 5Intelligent Response AgentAgentModel
  6. 6Check for Message ContentIfLogic
  7. 7Dispatch WhatsApp ReplyWhats AppService
  8. 8Check If Text MessageIfLogic
  9. 9Free Processing LockRedisService
  10. 10Fetch Deduplication KeyRedisService
  11. 11Notify Non-Text MessageWhats AppService
  12. 12Check Processing StatusIfLogic
  13. 13Ignore Duplicate MessageNo OpLogic
  14. 14Record Deduplication KeyRedisService
  15. 15Retrieve Message BufferRedisService
  16. 16Integrate Message into BufferSetLogic
  17. 17Store Merged BufferRedisService
  18. 18Update Message TimestampRedisService
  19. 19Wait 15 Seconds to DebounceWaitLogic
  20. 20Verify Message TimestampRedisService
  21. 21Confirm Latest Message StatusIfLogic
  22. 22Acquire Processing LockRedisService
  23. 23Abort Stale ProcessNo OpLogic
  24. 24Check If Lock is BusyIfLogic
  25. 25Abort Due to Busy LockNo OpLogic
  26. 26Establish Processing LockRedisService
  27. 27Fetch Final Message BufferRedisService
  28. 28Assemble Combined TextSetLogic
  29. 29Reset Message BufferRedisService

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.