Automation library · Chat assistants

Build a WhatsApp AI shopping bot with Gemini and OpenAI

Started by an incoming WhatsApp message, and works across Google Drive, Google Sheets, MongoDB, Redis and one other. It puts Gemini and OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 70 steps, 10 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: Gemini, OpenAIRetrieval

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

The flow

Starts it 1Model 9Logic 24Service 26

The steps in the order they run, from what starts it. The first 60 of 70.

  1. 1GPT-5-nano (intent classifier)Lm Chat Open AiModel
  2. 2GPT-4o (order agent)Lm Chat Open AiModel
  3. 3Create order in MongoDBMongo Db ToolService
  4. 4Get product info from MongoDBMongo Db ToolService
  5. 5Log order to Google SheetsGoogle Sheets ToolService
  6. 6OpenAI embeddingsEmbeddings Open AiModel
  7. 7WhatsApp message triggerWhats App triggerStarts it
  8. 8Session memory for shopping agentMemory Buffer WindowModel
  9. 9Session memory for order agentMemory Buffer WindowModel
  10. 10AI shopping agent (BytezBot)AgentModel
  11. 11Order orchestration AI agentAgentModel
  12. 12MongoDB Atlas vector searchVector Store Mongo DBAtlasModel
  13. 13Check if message is button or imageIfLogic
  14. 14Detect JSON intent or plain text replyCodeLogic
  15. 15Send order confirmationWhats AppService
  16. 16Download product image from DriveGoogle DriveService
  17. 17Combine vector search results with imagesMergeLogic
  18. 18Route interactive vs image messageSwitchLogic
  19. 19Validate incoming messageCodeLogic
  20. 20Append AI reply to session historyCodeLogic
  21. 21Convert product image to base64Extract From FileService
  22. 22Combine products with base64 imagesCodeLogic
  23. 23Parse button and user dataCodeLogic
  24. 24Get VTO context from RedisRedisService
  25. 25Pass valid messages, block invalidIfLogic
  26. 26Save session to RedisRedisService
  27. 27Aggregate all product base64 imagesAggregateLogic
  28. 28Store products in cacheRedisService
  29. 29Route VTO vs order button tapSwitchLogic
  30. 30Is VTO product ID stored in Redis?IfLogic
  31. 31Get user session from RedisRedisService
  32. 32Send validation error to userWhats AppService
  33. 33Route JSON intent vs plain text replyIfLogic
  34. 34Unpack products from cache resultCodeLogic
  35. 35Set VTO context in RedisRedisService
  36. 36Extract image ID, waId, and product IDCodeLogic
  37. 37Ask user to send correct photoWhats AppService
  38. 38Load session and append user messageCodeLogic
  39. 39Route product search vs recommendSwitchLogic
  40. 40Send text response to userWhats AppService
  41. 41Loop through productsSplit In BatchesLogic
  42. 42Prompt user to upload selfieWhats AppService
  43. 43Get product image from MongoDBMongo DbService
  44. 44Get WhatsApp media URLHttp RequestService
  45. 45Build Redis cache key from search queryCodeLogic
  46. 46Build product card message bodyCodeLogic
  47. 47Download product image from Drive (VTO)Google DriveService
  48. 48Download user selfieHttp RequestService
  49. 49Check Redis cacheRedisService
  50. 50Convert product image base64 to binaryCodeLogic
  51. 51Resize product image to 1024pxEdit ImageService
  52. 52Analyze user selfie with GeminiGoogle GeminiModel
  53. 53Resize user selfie to 1024pxEdit ImageService
  54. 54Is product cached in Redis?IfLogic
  55. 55Upload product image to WhatsAppHttp RequestService
  56. 56Extract product image as base64Extract From FileService
  57. 57Gemini: confirm exactly one personIfLogic
  58. 58Extract user selfie as base64Extract From FileService
  59. 59Parse cached product JSON arrayCodeLogic
  60. 60Send product message with buttonsHttp RequestService

How it's built

Starts on
An incoming WhatsApp message
Steps
70, with 10 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Google Drive, Google Sheets, MongoDB, Redis, WhatsApp
Model
Gemini, OpenAI
Retrieval
Answers are drawn from documents you supply, not from the model alone

Questions

What does it need to run?

An n8n account, plus your own Google Drive, Google Sheets, MongoDB, Redis and WhatsApp accounts, and a key for Gemini and OpenAI. 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 and OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 70 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 70 steps before you point it at anything that matters.