Multi-Modal WhatsApp AI Chatbot with Conversational Memory - n8n Workflow

Deploy a powerful n8n workflow for a WhatsApp AI chatbot that processes text, voice, images, and PDFs. This advanced n8n template uses OpenAI for transcription, vision, and chat, featuring full conversational memory.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Businesses looking to automate customer support via WhatsApp.

  • Developers needing robust n8n templates for advanced AI interactions.

  • Technical users who want to deploy a flexible, file-aware chatbot.

  • Anyone seeking to integrate large language models (LLMs) with the WhatsApp Business API using n8n.

Overview

This comprehensive n8n workflow provides a complete solution for building an intelligent, multi-modal chatbot directly on WhatsApp. Unlike basic chatbots, this automation understands and processes four distinct input types: standard text messages, voice notes (transcribed via OpenAI), images (analyzed using GPT-4 Vision capabilities), and PDF documents (with content extracted for analysis).

Key value is delivered by integrating conversational memory using a dedicated n8n node, ensuring the AI Agent remembers previous context within the conversation thread. This versatile n8n workflow is crucial for delivering a high-quality, continuous user experience, making it one of the most powerful n8n templates available for customer engagement.

How it Works

The process begins with the WhatsApp Trigger, which acts as the starting point for this n8n workflow, listening for incoming messages.


  1. Incoming Message: The WhatsApp Trigger receives a message payload when a user interacts with the business number.

  2. Routing: The Switch n8n node, labeled 'Input type', inspects the payload to determine if the message contains Text, Voice, Image, or Document data, routing the execution accordingly.

  3. Media Processing (Voice/Image/PDF): If media is detected, the n8n workflow first uses a WhatsApp n8n node to retrieve the media URL, followed by an HTTP Request n8n node to download the binary data.

For Voice, the audio is transcribed using an OpenAI n8n node.
For Images, the image is analyzed using the powerful vision features of the OpenAI n8n node.
For PDFs, an If n8n node ensures only PDF files are processed before the content is extracted using the 'Extract from File' n8n node.

  1. Data Preparation: The output from the successful media processing path, or the raw text path, is prepared by a Set n8n node, standardizing the input for the AI Agent.

  2. AI Core: All standardized inputs flow into the 'AI Agent1' n8n node, which utilizes the 'OpenAI Chat Model' for its reasoning. Crucially, the 'Simple Memory' n8n node (a Langchain Memory Buffer Window) is connected, ensuring the AI Agent maintains context based on the user's WhatsApp ID.

  3. Response Generation: The AI Agent generates a relevant text response.

  4. Output Routing: An If n8n node ('From audio to audio?') checks if the initial n8n trigger input was a voice note.

If Voice, the response is routed through the 'Generate Audio Response' OpenAI n8n node (Text-to-Speech) and then a Code n8n node fixes the MIME type before sending the audio file back via the 'Send audio' WhatsApp n8n node.
* If Text, Image, or PDF, the response is sent directly as a text message via the 'Send message' WhatsApp n8n node.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it into your n8n instance via the 'New' menu > 'Import from JSON'.

  2. WhatsApp Setup: You require two types of WhatsApp credentials:

WhatsApp Trigger API Credential (OAuth): Set up the webhook configuration within Meta Business Suite, linking the automatically generated webhook URL from the WhatsApp Trigger n8n node.
WhatsApp API Credential (Token): This is used for sending messages and retrieving media URLs. This typically involves an HTTP Header Auth credential where the Header Name is Authorization and the Value is Bearer YOURACCESSTOKEN (referencing the 'Sticky Note5' for detailed Meta API setup).

  1. OpenAI Credentials: Configure an OpenAI API Key credential and attach it to the 'Analyze Image', 'Transcribe Audio', 'Generate Audio Response', and 'OpenAI Chat Model' n8n nodes.

  2. Activate: Ensure all credentials are set up correctly, verify the phone number ID in the WhatsApp sending nodes, and activate the n8n workflow. The WhatsApp trigger will now be live.

Node Details

This n8n template relies on advanced integration nodes for its functionality:

WhatsApp Trigger (n8n trigger): The entry point of the n8n workflow. Configured to listen for incoming messages updates from Meta.
Input type (Switch n8n node): Routes execution based on the existence of text, audio, image, or document fields in the message payload.
Get Audio/Image/File Url (WhatsApp n8n node): Uses the WhatsApp API to convert the media ID received by the n8n trigger into a temporary downloadable URL.
Download Audio/Image/File (HTTP Request n8n node): Downloads the actual binary file content using the retrieved URL, authenticated via the WhatsApp HTTP Header Auth credential.
Transcribe Audio (OpenAI n8n node): Converts the voice note binary data into text, essential for processing voice messages in the n8n workflow.
Analyze Image (OpenAI n8n node): Utilizes GPT-4o-mini's multimodal capability to describe the image based on a detailed instruction prompt, converting visual data into descriptive text for the AI Agent.
Extract from File (n8n node): Specialized utility to extract text content from PDF documents, enabling the AI to analyze file content.
Simple Memory (Langchain Memory Buffer Window n8n node): Stores conversational history, keyed by the user's WhatsApp ID (wa_id), maintaining context across multiple messages. Crucial for any advanced n8n template.
OpenAI Chat Model (Langchain n8n node): The core LLM (GPT-4o-mini) providing reasoning power.
AI Agent1 (Langchain Agent n8n node): Orchestrates the conversation and uses the input text and memory to generate the final response based on a comprehensive system message.
Generate Audio Response (OpenAI n8n node): Converts the final AI text response back into an audio file (TTS), specifically used when the input was a voice message.
Send message / Send audio (WhatsApp n8n node): Handles the final delivery of the AI's answer, either as text or as a synthesized audio file.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at [email protected] or add me on Linkedin.com/in/davideboizza

Featured*