Automating sales on WhatsApp: AI chatbot+ Sending from Google Sheets via n8n
.jpeg)
Process description
This automation is a full-fledged AI consultant for an electronics store on WhatsApp. The system automatically receives customer messages, processes various types of content (text, images, voice messages), consults based on the current product database in Supabase, provides personalized recommendations and automatically notifies about ready-to-buy leads on Telegram.
API keys and services:
- WhatsApp Business Cloud API - for receiving and sending messages
- OpenAI API Key - for gpt-4o-mini and gpt-4o models
- Supabase API - for a product database
- Pinecone API - for the store's knowledge base
- Telegram Bot API - for lead notifications
- Google Sheets OAuth2 - for managing newsletters
System architecture by blocks
SECTION 1: RECEIVING MESSAGES

1.1 WhatsApp Trigger — Receiving messages
Purpose: Automatically receives incoming messages from customers on WhatsApp via webhook
WhatsApp Trigger settings:
- Updates: ["messages"] (message updates)
- Webhook ID: 1a933f26-706e-44a9-81ac-ede4b7e5ecdb
- Credentials: whatsappTriggerAPI account 4
What we get:
{
“contacts”: [{"wa_id”: “79001234567", “profile”: {"name”: “Ivan Petrov"}}],
“messages”: [{
“id”: “wamid.xxx”,
“type”: “text”,
“text”: {"body”: “I want to buy a smartphone up to 30,000 rubles"},
“timestamp”: “1672531200"
}]
}
1.2 Edit Fields — Data preparation
Purpose: Retrieves chat_id to personalize the conversation
Set settings:
{
“assignments”: [{
“name”: “chat_id1",
“value”: “= {{$json.contacts [0] .wa_id}}”,
“type”: “string”
}]
}
SECTION 2: HANDLING DIFFERENT TYPES OF MESSAGES
2.1 Switch - Content type definition
Purpose: Analyzes the type of incoming message and sends it to the appropriate stream
Switch conditions:
- Image (Output 0): messages [0] .type === “image” → image processing
- Text (Output 1): messages [0] .type === “text” → straight to AI Agent
- Voice (Output 2): messages [0] .type === “audio” → audio transcription
SECTION 3: IMAGE PROCESSING

3.1 Image analysis flow
WhatsApp Business Cloud5 → HTTP Request3 → OpenAI3
WhatsApp Business Cloud5:
- Resource: media
- Operation: MediaURLGet
- Media Get ID: = {{$ ('WhatsApp Trigger1') .item.json.messages [0] .image.id}}
HTTP Request3:
- URL: = {{$json.url}} (downloads image)
- Authentication: whatsappAPI
OpenAI3:
- Resource: image
- Operation: analyze
- Model: gpt-4o
- Text: “Analyze and describe what you see in the picture”
The result: A detailed description of the image in Russian
SECTION 4: VOICE MESSAGE PROCESSING

4.1 Audio transcription stream
WhatsApp Business Cloud4 → HTTP Request2 → OpenAI2
WhatsApp Business Cloud4:
- Media Get ID: = {{$ ('WhatsApp Trigger1') .item.json.messages [0] .audio.id}}
HTTP Request2:
- Downloads an audio file (OGG Opus format)
OpenAI2:
- Resource: audio
- Operation: transcribe (Whisper API)
- Binary Property Name: data
The result: Text transcription of a voice message
SECTION 5: AI CONSULTANT
5.1 AI Agent1 — Principal Consultant
Purpose: Chief AI consultant for communication with customers
Connected components:
- OpenAI Chat Model1 (gpt-4o-mini) - main language model
- Simple Memory1 - memory of the dialogue with the client
- Supabase Vector Store1 - product database
- Pinecone Vector Store2 - store knowledge base
- GetLead1 - lead notification tool
System prompt):
You're a virtual consultant and salesman in an electronics store.
You are polite, competent, friendly and always strive to help customers choose the right product
You are connected to the Supabase database, which contains current product data:
name, category, specifications (including manufacturer, model, memory capacity, screen size, battery, connection type, etc.), price, availability, rating, product ID, link to photo.
Your task is:
Find out the customer's needs and offer suitable products.
Answer questions about the characteristics and differences between products
Report availability and price.
Offer related products or alternatives when you don't need them.
Always use information from the database (Supabase) — don't make anything up.
Examples of behavior:
If a user writes:
“I want a cheap smartphone with a good camera”
— Check your budget, ask what else is important (for example, brand or autonomy), and select 3 options from the database, briefly describing their advantages.
If it asks:
“How is this laptop different from that one?”
— Compare the characteristics from the database: screen, processor, memory, autonomy, etc.
If the item is out of stock:
— Report this and suggest similar alternatives.
Response format:
Short and clear (1-2 paragraphs).
Show price and availability.
Provide a link to a photo or product card, if it is available in the database.
Communication style:
Respectful but lively (like “you”, with a friendly tone).
Not intrusive, but with easy sales elements: emphasize benefits, offer better options.
If the customer reaches the purchase stage and chooses something for themselves, use the GetLead tool to send a lead alert.
If you see the phrase “In the picture” or “On the picture” in the message and then there is a description of a picture, then don't answer that you can't see the pictures, but just pretend that you saw and analyzed the content of the image without using the phrase “Your description” instead write “Your image...”.
IMPORTANT! Instead of saying “Your description..”, say “Your image...”.
5.2 Simple Memory1 - Dialogue memory
Purpose: Keeps the context of the conversation with each client
Settings:
- Session Key: = {{$ ('WhatsApp Trigger1') .item.json.contacts [0] .wa_id}}
- Context Window Length: 10 (last 10 posts)
How it works: Each phone number = a unique session with a conversation history
SECTION 6: DATABASES
6.1 Supabase Vector Store1 - Product Database
Purpose: The main database with the product catalog
Settings:
- Mode: retrieve-as-tool
- Tool Name: shop_storage
- Table Name: products
- Credentials: Supabase account 5
The structure of these goods:
- Name, category, brand, model
- Technical specifications (processor, memory, screen)
- Price, availability, rating
- Product photos and descriptions
6.2 Pinecone Vector Store2 - Knowledgebase
Purpose: Information about the store, delivery, guarantees
Settings:
- Tool Name: Info
- Pinecone Index: Select the index you created on the Pinecone website
- Credentials: PineconeAPI account 2
Content:
- Delivery and payment
- Guarantee obligations
- Contacts and working hours
- Promotions and special offers
SECTION 7: LEAD SYSTEM
7.1 GetLead1 — Telegram notifications
Purpose: Automatically notifies managers about customers ready to buy
Settings:
- Chat ID: 930460462 (Management Group)
- Credentials: Telegram API
When it works:
- The customer chose the product
- Ready to buy
- Requests checkout
Notification format:
🔥 NEW LEAD!
👤 Client: +79001234567
💬 Request: iPhone 15 Pro, ready to buy
💰 Amount: 120,000 rubles
⏰ Time: 14:30
SECTION 8: SENDING RESPONSES
8.1 WhatsApp Business Cloud6 - Send messages
Purpose: Sends the AI consultant's answers to the client
Settings:
- Operation: send
- Phone Number ID: 642425372281416
- Recipient: = {{$ ('WhatsApp Trigger1') .item.json.contacts [0] .wa_id}}
- Text Body: = {{$json.output}}
SECTION 9: MAILING SYSTEM
9.1 Mass mailings
Schedule Trigger → Google Sheets → WhatsApp Business Cloud
Schedule Trigger:
- Launches scheduled mailings
Google Sheets:
- Document ID: Select the table you need that contains a list of customer phone numbers
WhatsApp Business Cloud:
- Template: create and select an approved template in WhatsApp Manager
- Sends marketing messages
SECTION 10: CONTENT MANAGEMENT
10.1 Uploading documents to the knowledge base
Form Trigger → Document Loader → Text Splitter → Pinecone
On form submission1:
- Web form for uploading documents (disabled)
Default Data Loader1:
- Processes uploaded files
Character Text Splitter1:
- Breaks documents into fragments
Pinecone Vector Store3:
- Saves to the knowledge base
Node connection diagram
Main stream:
- WhatsApp Trigger1 → Edit Fields → Switch1
Content processing:
- Switch1 (Image) → WhatsApp Business Cloud5 → HTTP Request3 → OpenAI3 → AI Agent1
- Switch1 (Text) → AI Agent1
- Switch1 (Voice) → WhatsApp Business Cloud4 → HTTP Request2 → OpenAI2 → AI Agent1
Final shipment:
- AI Agent1 → WhatsApp Business Cloud6
AI connections:
- OpenAI Chat Model1 → AI Agent1
- Simple Memory1 → AI Agent1
- Supabase Vector Store1 → AI Agent1
- Pinecone Vector Store2 → AI Agent1
- GetLead1 → AI Agent1
Required services and their settings
Setting up WhatsApp Business:
- Create a WhatsApp business account
- Get Phone Number ID: 642425372281416
- Настройте webhook для приема сообщений
- Подготовьте шаблоны для рассылок
Настройка Supabase:
- Создайте проект в Supabase
- Настройте таблицу "products" с полями товаров
- Включите векторные расширения (pgvector)
- Получите API ключи
Настройка Pinecone:
- Создайте индекс "ope" для базы знаний
- Настройте векторные размерности (1536 для OpenAI embeddings)
Настройка Telegram:
- Создайте бота через @BotFather
- Создайте группу для уведомлений
- Получите Chat ID: 930460462
Возможности системы
Поддерживаемые типы контента:
- Текстовые сообщения - прямая обработка AI Agent
- Изображения - анализ через GPT-4O Vision
- Голосовые сообщения - транскрипция через Whisper API
AI возможности:
- Консультация по товарам - поиск и рекомендации из базы
- Сравнение товаров - детальное сравнение характеристик
- Обработка изображений - анализ фото товаров от клиентов
- Голосовое общение - поддержка голосовых запросов
- Память диалога - персонализированное общение
- Детекция готовности к покупке - автоматические уведомления
Бизнес-функции:
- База товаров - актуальная информация о наличии и ценах
- База знаний - политики магазина, доставка, гарантии
- Система лидов - автоматические уведомления менеджерам
- Массовые рассылки - маркетинговые кампании
- Аналитика диалогов - полная история общения с клиентами
Применение системы
Для интернет-магазинов:
- 24/7 консультации - клиенты получают помощь в любое время
- Персонализированные рекомендации - AI подбирает товары под запросы
- Автоматическая квалификация лидов - горячие клиенты сразу попадают к менеджерам
- Снижение нагрузки на поддержку - AI решает 80% стандартных вопросов
Для розничных сетей:
- Омниканальность - единая система обслуживания
- Масштабирование - один бот может обслуживать тысячи клиентов
- Стандартизация сервиса - одинаковое качество обслуживания
- Интеграция с системами - подключение к CRM, складу, аналитике
Для малого бизнеса:
- Экономия на персонале - замена нескольких консультантов
- Профессиональный сервис - уровень обслуживания как у крупных компаний
- Простота управления - минимальные технические требования
- Быстрый запуск - готовое решение за несколько дней
Результат работы системы
Что получается:
- Автоматизированные продажи работающие круглосуточно
- Персонализированный AI консультант для каждого клиента
- Система квалификации лидов с мгновенными уведомлениями
- Омниканальное обслуживание (текст, голос, изображения)
- Интеграция с бизнес-процессами через базы данных
Метрики эффективности:
- Время ответа - мгновенные ответы 24/7
- Конверсия в лиды - автоматическая детекция готовности к покупке
- Персонализация - память 10 последних сообщений каждого клиента
- Масштабируемость - обслуживание неограниченного количества клиентов
Преимущества перед живыми консультантами:
- Доступность - работает 24/7 без выходных и перерывов
- Консистентность - одинаково высокое качество для всех клиентов
- Speed - instant search for information in the product database
- Objectivity - recommendations are based only on product characteristics
- memento - remembers all previous conversations with the client
- Scalability - one bot = thousands of consultants
ROI and economic indicators:
- Savings on wages - replacing 5-10 consultants with one bot
- Increase conversions - customers get help instantly
- Reduced lead processing time - hot clients get to managers right away
- Enhancing customer experience - a modern convenient communication channel
This system turns WhatsApp into a powerful sales channel with an AI consultant who works more effectively than a team of live operators!