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

Respond to WhatsApp messages with AI like a pro

WhatsApp message → n8n type-based routing (text/image/audio/video) → Gemini multimodal understanding → AI Agent generates reply → WhatsApp send-back

Some experienceStepsWorkflowPrompt
Who
Users who want to build a WhatsApp AI chatbot in n8n
You get
Auto-receive and understand WhatsApp text, image, voice, and video messages, generate replies via AI Agent, and send them back
You need
n8n · whatsapp · gemini

Constraints

Prerequisites: n8n instance (cloud or self-hosted), WhatsApp Business account with API credentials (whatsAppTriggerApi, whatsAppApi), and Google Gemini API credentials (googlePalmApi). Import the template workflow JSON into n8n, configure credentials per node instructions, and activate the workflow. Large media files may impact performance; pre-processing is recommended.

What they did

Author jimleuk published this template in the n8n official template library, demonstrating how to build a WhatsApp AI chatbot that handles multiple message types (text, image, audio, video). The template uses WhatsApp Trigger to receive messages, Switch node for type-based routing, and calls Gemini for audio transcription, video description, image analysis, and text summarization, before an AI Agent with Wikipedia tool generates and sends back a reply.

How it went

The template has received over 126,000 views on n8n (author_report). The author notes the implementation can be extended to customer support, appointment booking, document verification, and other use cases.

Worth knowing

1. Audio/video processing uses HTTP Request to call Gemini API directly, as n8n's LLM node does not yet support audio/video binary input. 2. Image processing uses Basic LLM Chain (Image Explainer) with Gemini Chat Model. 3. Large media files may slow the workflow; the source recommends pre-processing or detecting file size. 4. The AI Agent uses define prompt mode with a system message set to 'general knowledge assistant'. 5. For self-hosted n8n, ensure WhatsApp can reach your server. 6. This site has not tested the template; test credentials and webhook in an isolated environment before production use.

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.
  • Get Audio URL node: connect whatsAppApi credentials.
  • Get Video URL node: connect whatsAppApi credentials.
  • Get Image URL node: connect whatsAppApi credentials.
  • Download Video node: connect whatsAppApi credentials.
  • Download Audio node: connect whatsAppApi credentials.
  • Download Image node: connect whatsAppApi credentials.
  • Respond to User node: connect whatsAppApi credentials.
  • Google Gemini Chat Model node: connect Google Gemini/PaLM API credentials.
  • Google Gemini Audio node: connect Google Gemini/PaLM API credentials.
  • Google Gemini Video node: connect Google Gemini/PaLM API credentials.
  • Google Gemini Chat Model1 node: connect Google Gemini/PaLM API credentials.
  • Google Gemini Chat Model2 node: connect Google Gemini/PaLM API credentials.

Configuration to replace

  • Source template is n8n public workflow #2466 (~35 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. Configure WhatsApp trigger and message routing

    After importing the template into n8n, configure the WhatsApp Trigger node (subscribe to messages updates) and set the Split Out Message Parts node to split the messages array. Then use the Switch node (Redirect Message Types) to route by type: audio, video, image, and text (fallback).

  2. Transcribe audio messages

    For the audio branch: use the WhatsApp node to get the audio file URL (Get Audio URL), then download the audio via HTTP Request. Call the Google Gemini API (via HTTP Request) to transcribe the audio content.

    Execution prompt · Source text。Google Gemini Audio node JSON Body field

    ={{
    {
      "contents": [{
        "parts":[
          {"text": "Transcribe this audio"},
          {"inlineData": {
            "mimeType": `audio/${$binary.data.fileExtension}`,
            "data": $input.item.binary.data.data }
          }
        ]
      }]
    }
    }}
  3. Describe video messages

    For the video branch: use the WhatsApp node to get the video file URL (Get Video URL), download via HTTP Request. Since n8n's LLM node does not currently support video binary types, call the Google Gemini API directly via HTTP Request to describe the video.

    Execution prompt · Source text。Google Gemini Video node JSON Body field

    ={{
    {
      "contents": [{
        "parts":[
          {"text": "Describe this video"},
          {"inlineData": {
            "mimeType": `video/${$binary.data.fileExtension}`,
            "data": $input.item.binary.data.data }
          }
        ]
      }]
    }
    }}
  4. Analyse image messages

    For the image branch: use the WhatsApp node to get the image URL (Get Image URL), download it, then pass to the Image Explainer (Basic LLM Chain) node where the Gemini model describes the image and transcribes visible text.

    Execution prompt · Source text。Image Explainer node Text field

    Here is an image sent by the user. Describe the image and transcribe any text visible in the image.
  5. Summarize text messages

    For the text branch (fallback): pass through the Wait node (Get Text) to the Text Summarizer (Basic LLM Chain) to succinctly summarize the user's message for the AI Agent.

    Execution prompt · Source text。Text Summarizer node Messages > Message field

    Summarize the user's message succinctly.
  6. Generate response with AI Agent

    Results from all branches converge at the Get User's Message node, extracting message_type, message_text, from, and message_caption. This feeds into the AI Agent node, which uses Window Buffer Memory (session keyed by phone number) and the Wikipedia tool to generate a reply.

    Execution prompt · Source text。AI Agent node Text field

    =The user sent the following message
    message type: {{ $json.message_type }}
    message text or description:
    ```{{ $json.message_text }}```
    {{ $json.message_caption ? `message caption: ${$json.message_caption.trim()}` : '' }}

    Execution prompt · Source text。AI Agent node Options > System Message field

    You are a general knowledge assistant made available to the public via whatsapp. Help answer the user's query succiently and factually.
  7. Respond to WhatsApp user

    The AI Agent output is sent back to the original sender via the WhatsApp node (Respond to User). This node supports text, images, audio, video, documents, and location; this template demonstrates text-only replies.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first

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

You are an n8n workflow setup assistant. The user wants to replicate the 'WhatsApp AI Chatbot' template. Assist in this order: 1) Confirm the user has an n8n instance, WhatsApp Business account, and Google Gemini API credentials; 2) Guide importing workflow.json and configuring the three credentials (whatsAppTriggerApi, whatsAppApi, googlePalmApi); 3) Explain WhatsApp webhook setup before activating the workflow; 4) Warn that large media files may impact performance and suggest pre-processing.

Requires n8n instance, WhatsApp Business API credentials, Google Gemini API credentials

Source

Respond to WhatsApp messages with AI like a pro! · 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