Problem: Support teams answer the same WhatsApp questions over and over, and harder questions need a person without losing the conversation.
What I built: A WhatsApp bot answers customer questions from a Notion knowledge base using Supabase vector search and Gemini. Questions it can't answer become HubSpot tickets with a Slack alert; when an agent closes the ticket, the answer is sent back on WhatsApp and can be saved to the knowledge base, which re-indexes itself automatically.
Full sizeIncoming WhatsApp messages are filtered, matched to a contact, de-duplicated, and logged. Text questions are searched against the Supabase vector store with Gemini embeddings, and Gemini drafts an answer from the knowledge-base excerpts only. A router replies directly to small talk and confident answers; anything else opens a HubSpot ticket (or adds a note to the customer's open ticket), alerts the support team in Slack, and sends a handoff message.
WhatsApp Conversation
Full sizeThe customer's view. Small talk is answered instantly by AI. Questions the knowledge base doesn't cover get a handoff message, and once the team answers the ticket, the reply arrives in the same chat a few minutes later.
HubSpot Support Tickets
Full sizeEach escalated question becomes a ticket in the HubSpot Support Pipeline with the customer's question attached. The agent writes the answer in the KB answer property, chooses whether to add it to the knowledge base, and closes the ticket.
Support Ticket Writeback
Full sizeEvery 15 minutes, a HubSpot search finds closed WhatsApp tickets that haven't been processed. For each one with an agent answer, the workflow optionally creates a Notion knowledge-base page, sends the answer as a WhatsApp text (or a template when outside the 24-hour window), marks the ticket processed, and clears the customer's open ticket.
Support KB Ingest
Full sizeWhen a knowledge-base page changes in Notion (or on a manual full reindex), its old chunks are deleted from Supabase. Published pages are converted to Markdown, split into chunks, embedded with Gemini, and inserted into the pgvector store, while draft and archived pages stay out of the bot's answers.
Notion Support Knowledge Base
Full sizeThe Notion knowledge base the bot answers from. Each page holds a question and answer with a status and category, and answers added from tickets link back to their source HubSpot ticket.
Support Error Alert
Full sizeThe shared error workflow for Support KB Ingest, WhatsApp Support Bot, and Support Ticket Writeback. An Error Trigger posts an alert to Slack whenever any of the three workflows fails, so problems are caught before customers notice.