How one can Automate WhatsApp Enterprise Queries Utilizing n8n?

Consider a world the place your organization is at all times awake, prospects get their questions answered immediately, precisely, and 24/7. This isn’t an outlandish future; it is a robust actuality that you could construct in the present day, automating your gross sales course of with WhatsApp utilizing AI. Think about a buyer messaging you about your product, and almost immediately receiving correct solutions from an AI that has absolutely “learn” your precise product brochure. We’re going to stroll you thru how you can construct this clever WhatsApp chatbot utilizing n8n and OpenAI fashions, remodeling your customer support and gross sales expertise.

What’s n8n?

n8n is an open-source agent-building and workflow automation instrument that simplifies the mixing of assorted purposes and automates agent workflows with ease. Not like different automation instruments, n8n provides flexibility with self-hosting, eliminating vendor lock-in. As a no-code/low-code platform, it empowers even non-developers to construct highly effective automation pipelines effortlessly.

You may learn my full information to n8n right here, or watch my full video explaining it right here.


Pre-Requisites for n8n Automation on WhatsApp Enterprise

The next necessities have to be met for a 24/7 response automation on WhatsApp Enterprise utilizing n8n.

n8n Platform: A working occasion of the n8n workflow automation instrument, the answer will make the most of this platform with actions to create workflow automations.

n8n home page

OpenAI account + Credential: Entry to OpenAI is required by means of the usage of an OpenAI account. The answer makes use of OpenAI fashions to generate textual content embeddings and to satisfy the conversational features of the AI agent capabilities. You’ll have to use legitimate API credentials to authenticate with and work together with the OpenAI fashions.

openAI developer platform

WhatsApp Enterprise account + Credential: To trade messages in real-time, a verified WhatsApp Enterprise Cloud account is important. You will want to accumulate the API keys to combine elements successfully.

WhatsApp Business home page

Constructing Your Agent: A Step-by-Step Information

The workflow for creating this automated WhatsApp gross sales assistant has two key elements: first, creating your product catalog vector retailer, and second, creating the WhatsApp AI agent itself, all of this utilizing fundamental n8n no/zero-code automation. Right here is how:

WhatsApp + n8n + OpenAI

Half 1: Creating the Product Catalog Vector Retailer

This preliminary part focuses on making ready your product info so your AI can perceive and retrieve it effectively:

1. Begin with a Guide Set off

Start your workflow by including a handbook set off.

n8n manual trigger

2. Fetch Your Brochure with an HTTP Node

Subsequent, add an HTTP node to retrieve your product brochure from the net. Set the tactic to “get” and authentication to “none.” You’ll present the URL the place your catalog is hosted; for instance, a hyperlink to a PDF containing loudspeaker info.

HTTP node for n8n WhatsApp automation

As soon as the PDF is fetched, it is advisable to extract the knowledge from it. Use an extract file node, particularly selecting “extract from PDF node” in case your catalog hyperlink consists of a PDF.

extract from file

4. Create Your Vector Retailer

With the knowledge extracted, you’ll begin making a vector retailer utilizing a easy vector retailer node.

  • Choose the operation “add doc to vector retailer,” selecting “insert doc”.
  • Crucially, create your personal reminiscence key by deciding on “by ID” and giving it a singular identify, like “knowledge retailer one.” This key will hyperlink your AI agent to this particular knowledge later.

5. Generate Embeddings with OpenAI

Add an OpenAI embeddings node to create numerical representations (embeddings) of your brochure’s content material.

  • Present your OpenAI credentials.
  • Within the doc part, use the default knowledge loader. Set the kind of knowledge to “JSON” and the mode to “load particular knowledge,” utilizing an expression to extract info from the earlier PDF extraction step.
  • Change the textual content splitting to “customized” and add a recursive character textual content splitter.
part 1 of n8n WhatsApp automation

At this level, the primary a part of the workflow is full. When triggered, it fetches your PDF, extracts its info, creates embeddings utilizing OpenAI, and shops them in your easy vector retailer.

Half 2: Creating the WhatsApp AI Agent

Now, let’s construct the interactive half: your AI agent for WhatsApp queries, utilizing n8n automation:

1. Add a WhatsApp Set off Node

To provoke your agent when a message is acquired, add a WhatsApp Enterprise Cloud set off node. Choose “on message” and enter your WhatsApp credentials.

whatsapp node

2. Filter Messages with a Change Node

Since this workflow focuses on text-based questions, use a swap node to distinguish between textual content and non-text messages.

  • Change the mode to “guidelines”.
  • Set the primary rule to verify if the message worth is “textual content,” renaming its output to “supported”.
  • Add one other rule to verify if the message string expression is “not equal” to “textual content,” renaming its output to “not supported”. This may create two distinct routes
Switch module

3. Deal with Unsupported Questions

For the “not supported” route, merely reply to the person.

  • Add a WhatsApp Enterprise Cloud ship message node.
  • Present your credentials, set the operation to “ship,” and use an expression for the recipient cellphone quantity.
  • For the textual content physique, enter a message like: “Sorry, we’re unable to course of your question”.
Send message node

4. Construct the AI Agent for Textual content Questions

That is the place the magic occurs for supported (textual content) questions.

  • Add an AI agent node: This agent is designed not solely to make use of a Massive Language Mannequin (LLM) but additionally to leverage the vector retailer you created in Half 1.
  • Hook up with an OpenAI Mannequin: Join the AI agent to an OpenAI mannequin, selecting your required mannequin and offering credentials. For reminiscence, use “easy reminiscence”. We opted for gpt-oss-20b.
  • Combine the Vector Retailer Instrument: Join a vector retailer search query answering instrument to your AI agent.
    – Crucially, use the very same reminiscence key (e.g., “knowledge retailer one”) that you just outlined within the first a part of the workflow. This ensures the agent accesses the right product catalog knowledge.
    – Add your OpenAI embedding mannequin credentials for this instrument.
  • Set the Chat Mannequin: For the principle chat interplay, use the OpenAI chat mannequin, including your credentials and deciding on the mannequin.
AI Agent in n8n

5. Ship the Agent’s Reply by way of WhatsApp

Lastly, as soon as your Agentic RAG (Retrieval-Augmented Era) is prepared with a solution, ship it on to the person.

  • Add one other WhatsApp Enterprise Cloud ship message node.
  • Add your credentials, set the operation to “ship,” and use expressions for each the recipient cellphone quantity and the textual content physique (which can comprise the agent’s reply).

With these steps, your workflow is full! You now have a robust, automated WhatsApp gross sales assistant, totally educated in your product brochure and absolutely able to dealing with actual buyer questions with prompt, correct responses, all made by means of n8n, OpenAI, and WhatsApp integration.

Complete WhatsApp business automation on n8n

Conclusion

This agentic RAG WhatsApp chatbot naturally combines your particular product info from a vector retailer with the generative capabilities of an AI agent, such that each buyer interplay is actionable, correct, and efficient. You are actually ready to deal with actual buyer inquiries at any time of day, making your gross sales course of and buyer expertise extra sturdy.

Knowledge Scientist | AWS Licensed Options Architect | AI & ML Innovator

As a Knowledge Scientist at Analytics Vidhya, I concentrate on Machine Studying, Deep Studying, and AI-driven options, leveraging NLP, pc imaginative and prescient, and cloud applied sciences to construct scalable purposes.

With a B.Tech in Laptop Science (Knowledge Science) from VIT and certifications like AWS Licensed Options Architect and TensorFlow, my work spans Generative AI, Anomaly Detection, Pretend Information Detection, and Emotion Recognition. Obsessed with innovation, I try to develop clever techniques that form the way forward for AI.

Login to proceed studying and luxuriate in expert-curated content material.