ChatGPTSalesRevenue growthAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Building your first WhatsApp chatbot

Product brochure PDF → vector knowledge base → WhatsApp trigger → AI sales agent → auto-reply

Some experienceStepsWorkflowPrompt
Who
n8n users who want to build a WhatsApp chatbot
You get
An AI sales assistant that answers product questions by retrieving from a vector store knowledge base
You need
n8n · WhatsApp Business

Constraints

Prerequisites: n8n instance, WhatsApp Business account with credentials (whatsAppTriggerApi, whatsAppApi), and OpenAI API key (openAiApi). The template has two parts: first build a product catalog vector knowledge base once, then enable the WhatsApp trigger and AI Agent for conversations. For production, replace the in-memory vector store with Qdrant or Pinecone.

What they did

Author jimleuk published this template in the n8n official template library, demonstrating how to combine WhatsApp, OpenAI, and a vector store to build a sales Q&A bot. The template uses a Yamaha 2024 loudspeakers brochure as the example knowledge base, fetching the PDF via HTTP Request, extracting text, generating vector embeddings, and using an AI Agent with Tool Calling to answer customer inquiries.

How it went

The template has 541,842 views on n8n.io (author report, api.json), positioned as an introductory template for WhatsApp newcomers.

Worth knowing

1. The in-memory vector store is not persistent; the author recommends Qdrant or Pinecone for production. 2. Only text messages are handled; images/audio/video are rejected with a prompt to send text. 3. The System Message is hardcoded to the Yamaha 2024 product catalog; replace it for your own business. 4. The example URL and phoneNumberId in workflow.json are placeholders and must be replaced before running. 5. Self-hosted n8n requires the WhatsApp webhook to reach your server's public address.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • WhatsApp Trigger node: connect whatsAppTriggerApi credentials.
  • OpenAI Chat Model node: connect OpenAI API credentials.
  • Embeddings OpenAI node: connect OpenAI API credentials.
  • OpenAI Chat Model1 node: connect OpenAI API credentials.
  • Embeddings OpenAI1 node: connect OpenAI API credentials.
  • Reply To User node: connect whatsAppApi credentials.
  • Reply To User1 node: connect whatsAppApi credentials.

Configuration to replace

  • Source template is n8n public workflow #2465 (~28 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-25

Steps

  1. Import product brochure and build vector knowledge base

    Use the HTTP Request node to fetch a product brochure PDF (the template example uses the Yamaha 2024 powered loudspeakers brochure), then extract text with the Extract from File node. Load the text with Default Data Loader, split into chunks of 2000 characters with Recursive Character Text Splitter, generate embeddings via OpenAI Embeddings (text-embedding-3-small), and store in the In-Memory Vector Store (memoryKey: whatsapp-75, mode: insert, clearStore: true). This step only needs to run once; re-run when updating the brochure.

  2. Configure WhatsApp trigger and message filtering

    Add a WhatsApp Trigger node (listen for messages updates), connect to a Switch node named Handle Message Types to filter by message type: only text messages flow to the Supported branch, others go to Not Supported. Non-text messages receive a fixed reply: I'm unable to process non-text messages. Please send only text messages. Thanks! After configuration, activate the workflow; for self-hosted n8n ensure WhatsApp can reach your server.

  3. Set up the Sales AI Agent

    Add an AI Agent node after the Supported branch, configured as Agent with Tools. Connect an OpenAI Chat Model (gpt-4o-2024-08-06) as the language model; attach a Window Buffer Memory sub-node (sessionIdType: customKey, sessionKey: =whatsapp-75-{{ $json.messages[0].from }}) to isolate sessions per user; attach a Vector Store Tool sub-node (name: query_product_brochure, description: Call this tool to query the product brochure. Valid for the year 2024.) linked to the Product Catalogue vector store.

    Execution prompt · Source text。AI Sales Agent node System Message field (promptType: define)

    You are an assistant working for a company who sells Yamaha Powered Loudspeakers and helping the user navigate the product catalog for the year 2024. Your goal is not to facilitate a sale but if the user enquires, direct them to the appropriate website, url or contact information.
    
    Do your best to answer any questions factually. If you don't know the answer or unable to obtain the information from the datastore, then tell the user so.
  4. Reply to users and activate the workflow

    Connect the AI Agent output to a WhatsApp node's textBody field (expression: ={{ $json.output }}), with recipientPhoneNumber dynamically set from the trigger message sender. After configuration, click Test Workflow once to populate the vector store, then activate the workflow. Send a text message to the bound WhatsApp number to receive replies from the AI sales agent. Replace the PDF source, adjust the systemMessage, or switch the vector store backend as needed.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant to confirm inputs and permissions before step-by-step reproduction

This block is the prompt. Ads are never placed here.

You are assisting with reproducing n8n template #2465 "Building your first WhatsApp chatbot". Please proceed in this order:
1. Confirm you have an n8n instance, WhatsApp Business credentials (whatsAppTriggerApi + whatsAppApi), and an OpenAI API key (openAiApi).
2. Import workflow.json or copy the template from the n8n template library.
3. Replace the URL in the get Product Brochure node with an actual product brochure PDF URL (the original template contains a placeholder YOUR_AWS_SECRET_KEY_HERE).
4. Replace the phoneNumberId in the WhatsApp nodes with your real WhatsApp Business phone number ID.
5. First click Test Workflow to run the vector store build part (once only).
6. Activate the workflow and test by sending a text message to the bound WhatsApp number.
7. If you need persistent storage, replace the In-Memory Vector Store with Qdrant/Pinecone and update the corresponding credentials.

This prompt is an editorial setup starter, not a node execution instruction. The actual system prompt is provided as source in step 3.

Source

Building your first WhatsApp chatbot · jimleuk · n8n.io · 2024-10-17

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related