Build a WhatsApp AI shopping bot with virtual try-on using Gemini and GPT

Go to Workflow
0 views
Built by BytezTech BytezTech
Created on February 19, 2026

Description

Build a WhatsApp AI shopping bot with virtual try-on using Gemini

šŸ“Œ Overview

This workflow fully automates your T-shirt store's WhatsApp shopping experience using GPT for intent detection, MongoDB Atlas for vector-based product search, Redis for session management, and Google Gemini for AI-powered virtual try-on.

It automatically handles customer messages, finds relevant products, processes orders, and generates realistic try-on images — all inside WhatsApp, with no app or website required.

Customers can search for T-shirts, place orders, and virtually try on items in a single conversation. Redis ensures fast product caching and session tracking. MongoDB Atlas stores the product catalog and orders. Google Sheets logs every order automatically. Gemini generates realistic try-on images from customer selfies.

This workflow eliminates manual order handling, improves customer experience, and gives store owners full visibility into orders and product searches.

āš™ļø How it works

This workflow runs automatically when a customer sends a WhatsApp message.

šŸ” Product search

šŸ’¬ Receives the customer message via WhatsApp Business API
🧠 GPT classifies the intent as product search, recommendation, or general query
⚔ Checks Redis cache for existing results (TTL: 1 hour)
šŸ”Ž On a cache miss, runs MongoDB Atlas vector search using OpenAI embeddings
šŸ›ļø Sends matching products as interactive WhatsApp cards with Order Now and Virtual Try-On buttons

šŸ›’ Order flow

šŸ‘† Triggered when the customer taps the Order Now button
šŸ“¦ AI agent fetches product details from MongoDB
šŸ—ƒļø Creates a new order document in MongoDB
šŸ“Š Logs the order to Google Sheets automatically
āœ… Sends an order confirmation message to the customer via WhatsApp

šŸ‘— Virtual try-on flow

šŸ‘† Triggered when the customer taps the Virtual Try-On button
šŸ’¾ Stores the product ID in Redis (TTL: 10 minutes)
šŸ“ø Prompts the customer to send a clear front-facing selfie
šŸ” Gemini validates that exactly one real person is in the photo
šŸ–¼ļø Merges the product image and selfie and generates a realistic try-on image
šŸ“© Sends the try-on result back to the customer via WhatsApp
šŸ—‘ļø Clears the Redis context after delivery

šŸ›  Setup steps

Import this workflow into n8n
Connect your WhatsApp Business Cloud API credentials
Connect your OpenAI API credentials (for embeddings and GPT model)
Connect your Google Gemini API credentials
Connect your MongoDB Atlas credentials and create a vector index named ShopingBot on the product collection
Connect your Redis credentials
Connect your Google Drive service account credentials
Connect your Google Sheets service account credentials
Import your product catalog with embeddings into the MongoDB product collection
Activate the workflow

The workflow will run automatically when customers send WhatsApp messages.

šŸš€ Features

🧠 AI-powered shopping

šŸ¤– Automatically classifies customer intent using GPT
šŸ”Ž Semantic product search using OpenAI embeddings and MongoDB Atlas vector search
⚔ Redis caching for ultra-fast repeated search results (TTL: 1 hour)
šŸ’¬ Interactive WhatsApp product cards with Order Now and Virtual Try-On buttons
šŸ”„ Sliding window session memory (last 20 messages per user)

šŸ›’ Order management

šŸ“¦ Fully automated order creation saved to MongoDB
šŸ“Š Automatic order logging to Google Sheets
šŸ¤– AI agent handles the complete order flow without manual input
āœ… Instant order confirmation sent to the customer via WhatsApp

šŸ‘— Virtual try-on

✨ AI-powered try-on image generation using Google Gemini
šŸ“· Selfie validation ensures exactly one real person is in the photo
šŸ–¼ļø Product and selfie images resized and merged before generation
šŸ“© Try-on result delivered directly in the WhatsApp conversation
šŸ—‘ļø Redis TTL automatically clears try-on context after delivery

šŸ” Security and reliability

šŸ›”ļø Advanced message validation with spam and XSS protection
āŒ Unsupported message types rejected with friendly error messages
šŸ” Retry logic on critical HTTP request nodes
šŸ“¦ Modular workflow architecture for easy customisation and scaling

šŸ“‹ Requirements

You need the following accounts and credentials:

šŸ”§ n8n
šŸ“± WhatsApp Business Cloud API
šŸ¤– OpenAI API (embeddings and GPT model)
✨ Google Gemini API
šŸƒ MongoDB Atlas (with vector index named ShoppingBot on the product collection)
⚔ Redis server
šŸ“ Google Drive (service account)
šŸ“Š Google Sheets (service account)

šŸŽÆ Benefits

šŸš€ Fully automated WhatsApp shopping experience
šŸ™Œ No manual order handling required
šŸ‘— Customers can try on products before buying
⚔ Fast product search with Redis caching
šŸ“Š All orders automatically tracked in Google Sheets
šŸ’¼ Reduces support workload for store owners
šŸ• Works 24/7 without human intervention

šŸ‘Øā€šŸ’» Author

BytezTech Pvt Ltd

Nodes Used (13)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Edit Image
n8n-nodes-base.editImage
Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi
Google Drive
n8n-nodes-base.googleDrive
Google Gemini
@n8n/n8n-nodes-langchain.googleGemini
HTTP Request
n8n-nodes-base.httpRequest
MongoDB
n8n-nodes-base.mongoDb
MongoDB Atlas Vector Store
@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Redis
n8n-nodes-base.redis
Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
WhatsApp Business Cloud
n8n-nodes-base.whatsApp