How I Built a WhatsApp Chatbot Workflow in n8n

I recently created a WhatsApp chatbot workflow in n8n to handle multiple types of incoming messages text, audio, and images and respond intelligently using AI. The workflow demonstrates how you can combine automation, AI, and messaging in a single, efficient flow.

Workflow Overview

  1. WhatsApp Trigger
    The workflow begins with a WhatsApp Trigger node that captures incoming messages in real-time. This allows the bot to respond immediately to users.
  2. Message Type Routing
    A Switch node evaluates the incoming message type text, audio, or image and routes it accordingly. This ensures the proper processing for each content type.
  3. Audio Handling
    • Audio messages are downloaded via the Download Media node.
    • They are then sent through an HTTP request for transcription.
    • The transcribed text is edited and prepared for AI analysis.
  4. Image Handling
    • Images are downloaded and analyzed using AI via an Analyze Image node.
    • The results are edited and structured for further use.
  5. AI Agent Integration
    Both audio and text messages converge into an AI Agent node powered by OpenAI Chat Model.
    A Simple Memory node is used to maintain context, enabling more natural, coherent responses.
  6. Sending Responses
    After processing, the chatbot sends the response back to the user using the Send Message node, completing the interaction.

Why This Workflow is Powerful

  • Handles multiple media types in a single workflow.
  • Uses AI transcription and image analysis for smarter responses.
  • Maintains contextual memory, so conversations feel natural.
  • Fully automated, enabling real-time WhatsApp interactions without manual effort.

This workflow showcases the versatility of n8n for creating intelligent chatbots and highlights how automation and AI can work together to improve user engagement.

4 Likes

lovely… I would try to replicate this

The multi-type routing (text/audio/image via Switch node) is the right structure for production WhatsApp bots. Two things worth adding as you scale:

  1. Send a “typing indicator” or “seen” status via the WhatsApp Business API before the AI starts processing - this prevents users from resending when the response takes 3-5s for audio or image processing.
  2. If users are expected to have multi-turn conversations, adding memory persistence (Window Buffer Memory node linked to a chat ID key) will keep context across messages without relying on the user repeating themselves.

Yes, I agree with that approach. The Switch node is the right structure for handling text, audio, and image inputs separately in a production WhatsApp bot.

I can add both improvements as well: first, sending a typing/seen status through the WhatsApp Business API before AI processing starts, so users don’t resend while audio or image processing is running.

Second, I can add memory persistence using the chat ID as the key, so the bot can maintain context across multi-turn conversations instead of treating every message separately.

These two additions would make the workflow much smoother and more production-ready.

1 Like