{
  "id": "xPNvpWRcBIuAlFNE",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Run a multimodal WhatsApp AI assistant with text, voice, images, PDFs and image generation",
  "tags": [],
  "nodes": [
    {
      "id": "9c82cc24-3a8d-4847-8442-f837d0084294",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        16,
        672
      ],
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "877bf5ff-9f2e-4ba9-9843-36fe2e716ae7",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        672
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-phone",
              "name": "whatsapp_phone_number_id",
              "type": "string",
              "value": ""
            },
            {
              "id": "cfg-imgcmd",
              "name": "image_command",
              "type": "string",
              "value": "/image"
            },
            {
              "id": "cfg-imgsize",
              "name": "image_size",
              "type": "string",
              "value": "1024x1024"
            },
            {
              "id": "cfg-imgqual",
              "name": "image_quality",
              "type": "string",
              "value": "standard"
            },
            {
              "id": "cfg-imgstyle",
              "name": "image_style",
              "type": "string",
              "value": "vivid"
            },
            {
              "id": "cfg-imgcap",
              "name": "image_reply_caption",
              "type": "string",
              "value": "\ud83d\uddbc\ufe0f Here is your image"
            },
            {
              "id": "cfg-analyze",
              "name": "image_analyze_prompt",
              "type": "string",
              "value": "Describe this image in detail, including any visible text."
            },
            {
              "id": "cfg-voice",
              "name": "tts_voice",
              "type": "string",
              "value": "onyx"
            },
            {
              "id": "cfg-v2v",
              "name": "reply_voice_to_voice",
              "type": "boolean",
              "value": true
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "23c5e2b9-1bdc-415f-85cb-dbc85c57c177",
      "name": "Input type",
      "type": "n8n-nodes-base.switch",
      "position": [
        464,
        624
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "r-text",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Voice",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "r-voice",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].audio }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Image",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "r-image",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].image }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Document",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "r-doc",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].document }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Not supported"
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1118fb14-1013-40f5-88a1-e996e2021eed",
      "name": "Is image request?",
      "type": "n8n-nodes-base.if",
      "position": [
        1376,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c-imgreq",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body.trim().toLowerCase() }}",
              "rightValue": "={{ $('Configuration').item.json.image_command.toLowerCase() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e9e29cc2-f724-40e3-b292-851fd8151ebe",
      "name": "Generate image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1712,
        -208
      ],
      "parameters": {
        "prompt": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body.trim().substring($('Configuration').item.json.image_command.length).trim() }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "dall-e-3",
          "cachedResultName": "DALL-E-3"
        },
        "options": {
          "size": "={{ $('Configuration').item.json.image_size }}",
          "style": "={{ $('Configuration').item.json.image_style }}",
          "dalleQuality": "={{ $('Configuration').item.json.image_quality }}",
          "returnImageUrls": false,
          "binaryPropertyOutput": "data"
        },
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "92eb2122-e482-40d6-b8d9-a84a9311fa07",
      "name": "Send image",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1968,
        -272
      ],
      "parameters": {
        "mediaPath": "useMedian8n",
        "operation": "send",
        "messageType": "image",
        "phoneNumberId": "={{ $('Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {
          "mediaCaption": "={{ $('Configuration').item.json.image_reply_caption }}"
        },
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "04304ede-b7f1-4f47-a442-277bce26b610",
      "name": "Text",
      "type": "n8n-nodes-base.set",
      "position": [
        1600,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s-text",
              "name": "text",
              "type": "string",
              "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "20ed195d-4d1a-4c40-8194-194107a5ff2d",
      "name": "AI Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1824,
        544
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are a helpful, friendly multimodal WhatsApp assistant. You receive the user message as text (a plain text message, a transcribed voice note, a description of an image, or extracted PDF content). Always reply in the SAME language as the user. Keep answers concise, accurate and easy to read on a phone: short paragraphs, minimal formatting. If the user asks you to CREATE, DRAW or GENERATE an image, tell them to send a new message starting with \"/image\" followed by a short description (for example: /image a red fox in the snow) \u2014 that command runs the image generator. Never invent facts; if you are unsure, say so.",
          "enableStreaming": false
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "5a437bfd-1a9c-46ea-9d18-4cac195fc64c",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1808,
        704
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b9528408-43c9-4775-b509-6455cca4f050",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1968,
        704
      ],
      "parameters": {
        "sessionKey": "={{ $('WhatsApp Trigger').item.json.messages[\"0\"].from }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.4
    },
    {
      "id": "c9578f27-fe86-4040-a4fa-7201cde53914",
      "name": "Get Audio Url",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        896,
        256
      ],
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $('WhatsApp Trigger').item.json.messages[0].audio.id }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "9a139462-b541-40cc-a71a-54290ebdd807",
      "name": "Download Audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1072,
        256
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "b923fba1-7ab9-4a04-a7ce-91a0519c824c",
      "name": "Transcribe Audio",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1264,
        256
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ddae6e89-32ee-4c86-a76f-87a304342b53",
      "name": "Audio",
      "type": "n8n-nodes-base.set",
      "position": [
        1456,
        256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s-audio",
              "name": "text",
              "type": "string",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e7d3a6f8-6fba-4ac5-8814-eb70d0b0b8ad",
      "name": "Get Image Url",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        928,
        544
      ],
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $('WhatsApp Trigger').item.json.messages[0].image.id }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "7ba82382-6590-41c6-b0cb-570c00d52965",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1104,
        544
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "1a4d0ea9-7830-4a6f-90dd-2c907207942f",
      "name": "Analyze Image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1328,
        544
      ],
      "parameters": {
        "text": "={{ $('Configuration').item.json.image_analyze_prompt }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {
          "detail": "auto"
        },
        "resource": "image",
        "inputType": "base64",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "44e089bf-3a5f-4550-8366-90682eb969bb",
      "name": "Image",
      "type": "n8n-nodes-base.set",
      "position": [
        1552,
        544
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s-image",
              "name": "text",
              "type": "string",
              "value": "=User request on the image:\n{{ $('WhatsApp Trigger').item.json.messages[0].image.caption || 'Describe this image' }}\n\nImage description:\n{{ $json.content || $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3b635465-9edf-4e49-bc29-5ae48e25524a",
      "name": "Only PDF File",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        864
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c-pdf",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].document.mime_type }}",
              "rightValue": "application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "faa4a720-d861-4f11-9eab-5bb3969dd90d",
      "name": "Get File Url",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        896,
        816
      ],
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $('WhatsApp Trigger').item.json.messages[0].document.id }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "f8f29ada-d21d-475a-8084-3a08879b8fa1",
      "name": "Download File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        816
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "61f2fcf0-9b2e-4f55-98ba-750ab1273769",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1344,
        816
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1.1
    },
    {
      "id": "443a07ca-f17e-46d0-ac99-a7f842bf7d86",
      "name": "File",
      "type": "n8n-nodes-base.set",
      "position": [
        1568,
        816
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s-file",
              "name": "text",
              "type": "string",
              "value": "=User request on the file:\n{{ $('WhatsApp Trigger').item.json.messages[0].document.caption || 'Summarize this document' }}\n\nFile content:\n{{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f4b075bf-4c15-45b7-85f3-2bedea6abf7e",
      "name": "Incorrect format",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        960,
        976
      ],
      "parameters": {
        "textBody": "Sorry, I can only read PDF documents. Please send your file as a PDF.",
        "operation": "send",
        "phoneNumberId": "={{ $('Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "b72e32eb-39ff-4c4e-a6d5-2c8a2bb6db61",
      "name": "Not supported",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        704,
        1008
      ],
      "parameters": {
        "textBody": "I can reply to text, voice notes, images and PDF documents. Try one of those, or send \"/image\" followed by a description to generate an image.",
        "operation": "send",
        "phoneNumberId": "={{ $('Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "20fe7a40-292c-40a1-b9cc-13aa6d08827f",
      "name": "From audio to audio?",
      "type": "n8n-nodes-base.if",
      "position": [
        2144,
        544
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c-isaudio",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].audio }}",
              "rightValue": ""
            },
            {
              "id": "c-v2v",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Configuration').item.json.reply_voice_to_voice }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e3c3ec46-6327-4791-958a-9745e62299d1",
      "name": "Generate Audio Response",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2352,
        496
      ],
      "parameters": {
        "input": "={{ $('AI Assistant').item.json.output }}",
        "voice": "={{ $('Configuration').item.json.tts_voice }}",
        "options": {
          "response_format": "mp3",
          "binaryPropertyOutput": "data"
        },
        "resource": "audio"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "482e5a03-98ad-413a-8186-afe5e2c47669",
      "name": "Fix mimeType for Audio",
      "type": "n8n-nodes-base.code",
      "position": [
        2592,
        496
      ],
      "parameters": {
        "jsCode": "for (const item of $input.all()) {\n  if (item.binary) {\n    for (const propName of Object.keys(item.binary)) {\n      if (item.binary[propName].mimeType === 'audio/mp3') {\n        item.binary[propName].mimeType = 'audio/mpeg';\n      }\n    }\n  }\n}\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "af14207c-0321-4071-b3a4-168294b70934",
      "name": "Send audio",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2784,
        496
      ],
      "parameters": {
        "mediaPath": "useMedian8n",
        "operation": "send",
        "messageType": "audio",
        "phoneNumberId": "={{ $('Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "47bff5b9-0eef-4c5e-a489-8b94fabbd65d",
      "name": "Send message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2352,
        688
      ],
      "parameters": {
        "textBody": "={{ $('AI Assistant').item.json.output }}",
        "operation": "send",
        "phoneNumberId": "={{ $('Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ababea52-7096-49fd-ae1a-a658b53deceb",
      "name": "Sticky Main",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -464
      ],
      "parameters": {
        "color": 4,
        "width": 700,
        "height": 2000,
        "content": "# Run a multimodal WhatsApp AI assistant with text, voice, images, PDFs and image generation\n\n# \ud83d\udce5  [Open full documentation on Notion](https://automatisation.notion.site/Course-Run-a-multimodal-WhatsApp-AI-assistant-with-text-voice-images-PDFs-and-image-generation-39d3d6550fd9817fb911fbd4151ebb3c)\n\nThis workflow turns WhatsApp into a full multimodal AI assistant. It understands text, voice notes, images and PDF documents, keeps short-term memory per contact, and can also **generate an AI image on demand** and send it straight back in the chat.\n\n## How it works\n- **WhatsApp Trigger** receives every incoming message.\n- **Configuration** centralises all the settings you can tweak (command word, image size/quality, voice, etc.).\n- **Input type** (Switch) detects whether the message is text, a voice note, an image or a PDF.\n- **Text** \u2192 if it starts with the image command (default `/image`), it is sent to **Generate image** (DALL\u00b7E) and the picture is returned. Otherwise it goes to the **AI Assistant**.\n- **Voice** \u2192 the audio is downloaded and transcribed (Whisper), then answered by the assistant. If enabled, the reply is returned as a voice note (TTS).\n- **Image** \u2192 the picture is downloaded and described by a vision model, then the assistant answers.\n- **PDF** \u2192 the document text is extracted and summarised/answered by the assistant.\n- **Simple Memory** keeps the last 10 exchanges per contact for natural follow-ups.\n\n## Setup\n1. Create WhatsApp Business Cloud credentials (Meta) and connect the **WhatsApp Trigger** + all WhatsApp send/media nodes.\n2. Create a **Header Auth** credential holding `Authorization: Bearer <your Meta token>` and select it on the 3 **Download** (HTTP Request) nodes \u2014 WhatsApp media URLs need this token.\n3. Connect your **OpenAI** credential on every OpenAI node.\n4. Open **Configuration** and set `whatsapp_phone_number_id` (your Meta phone number ID).\n5. Activate the workflow and set the webhook/callback URL in the Meta dashboard.\n\n## Requirements\n- An n8n instance (Cloud or self-hosted).\n- A WhatsApp Business Cloud account (Meta Developer) with a phone number ID and a permanent access token.\n- An OpenAI API key with access to a chat model, Whisper, TTS and DALL\u00b7E.\n\n## Customization\n- Change the trigger word for images in `image_command` (e.g. `/img`, `/draw`).\n- Adjust `image_size`, `image_quality`, `image_style` for the generated pictures.\n- Change the TTS `tts_voice`, or set `reply_voice_to_voice` to `false` to always answer by text.\n- Swap models directly in the OpenAI nodes (chat model, vision model, DALL\u00b7E, TTS).\n- Edit the assistant persona in the **AI Assistant** system prompt.\n\n---\n\nNeed help customizing?\nContact me for consulting and support : [Linkedin](https://www.linkedin.com/in/doctor-firass/)\n\n# MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new YouTube channel](https://www.youtube.com/@DrFiras_AI). Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n.\n\n[![The AI Doctor](https://www.dr-firas.com/the-ai-doctor.png)](https://www.youtube.com/@DrFiras_AI)"
      },
      "typeVersion": 1
    },
    {
      "id": "c593a0cb-4865-462d-bd81-24af9f8e436e",
      "name": "Sticky Route",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 680,
        "height": 396,
        "content": "## 1. Receive & route\nThe WhatsApp Trigger receives the message. **Configuration** holds every setting. **Input type** routes by message type: text, voice, image, PDF, or unsupported."
      },
      "typeVersion": 1
    },
    {
      "id": "4f0c462a-d899-41ee-baa2-edb9a658c11b",
      "name": "Sticky Text",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -400
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 460,
        "content": "## 2. Text & AI image generation\nIf the text starts with the image command (default `/image`), **Generate image** (DALL\u00b7E) creates a picture and **Send image** returns it. Any other text is passed to the AI Assistant."
      },
      "typeVersion": 1
    },
    {
      "id": "1a3d8c72-7dc5-476f-a5e8-03fe18eaf195",
      "name": "Sticky Voice",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 314,
        "content": "## 3. Voice \u2192 transcribe\nGet the media URL, download the audio, transcribe it with Whisper, then hand the text to the AI Assistant."
      },
      "typeVersion": 1
    },
    {
      "id": "fd380370-885c-47d7-9693-57c12a5ef283",
      "name": "Sticky Image",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 250,
        "content": "## 4. Image \u2192 describe\nGet the media URL, download the image, describe it with a vision model, then hand the description to the AI Assistant."
      },
      "typeVersion": 1
    },
    {
      "id": "a79c8408-2e2d-4854-975e-07f72d5db365",
      "name": "Sticky Document",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        688
      ],
      "parameters": {
        "color": 7,
        "width": 1110,
        "height": 470,
        "content": "## 5. Documents (PDF) & unsupported\nOnly PDFs are accepted: extract the text and pass it to the AI Assistant. Non-PDF files and other unsupported content get a friendly guidance message."
      },
      "typeVersion": 1
    },
    {
      "id": "8efa506b-90f2-4ffa-b906-2da6b909e670",
      "name": "Sticky Reply",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        368
      ],
      "parameters": {
        "color": 7,
        "width": 1190,
        "height": 470,
        "content": "## 6. AI assistant & reply\nThe AI Assistant (OpenAI Chat Model + Simple Memory) writes the answer. If the original message was a voice note, the reply is converted to speech and sent as audio; otherwise it is sent as text."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "060570b4-164a-4e05-b3f0-c81550c5ee41",
  "nodeGroups": [],
  "connections": {
    "File": {
      "main": [
        [
          {
            "node": "AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text": {
      "main": [
        [
          {
            "node": "AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio": {
      "main": [
        [
          {
            "node": "AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image": {
      "main": [
        [
          {
            "node": "AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input type": {
      "main": [
        [
          {
            "node": "Is image request?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Audio Url",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Image Url",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Only PDF File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not supported",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Assistant": {
      "main": [
        [
          {
            "node": "From audio to audio?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File Url": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Image": {
      "main": [
        [
          {
            "node": "Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Input type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Audio Url": {
      "main": [
        [
          {
            "node": "Download Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Image Url": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only PDF File": {
      "main": [
        [
          {
            "node": "Get File Url",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Incorrect format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Download Audio": {
      "main": [
        [
          {
            "node": "Transcribe Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Analyze Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate image": {
      "main": [
        [
          {
            "node": "Send image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Audio": {
      "main": [
        [
          {
            "node": "Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is image request?": {
      "main": [
        [
          {
            "node": "Generate image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "From audio to audio?": {
      "main": [
        [
          {
            "node": "Generate Audio Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fix mimeType for Audio": {
      "main": [
        [
          {
            "node": "Send audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Audio Response": {
      "main": [
        [
          {
            "node": "Fix mimeType for Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}