AutomationFlowsAI & RAG › Ai-powered Email Forwarding to Whatsapp with Gmail, Outlook & Google Gemini

Ai-powered Email Forwarding to Whatsapp with Gmail, Outlook & Google Gemini

ByiTzJok3r @itzjok3r on n8n.io

Intelligent email-to-WhatsApp automation that monitors Gmail and Outlook accounts, uses Google Gemini AI to filter important emails, and forwards them to WhatsApp via Evolution API. Multi-account support (Gmail + 2 Outlook accounts) AI-powered email classification with Google…

Event trigger★★★★☆ complexityAI-powered22 nodesGmailAgentGoogle Gemini ChatN8N Nodes Evolution Api EnGmail TriggerMicrosoft Outlook TriggerHTTP Request
AI & RAG Trigger: Event Nodes: 22 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #10254 — we link there as the canonical source.

This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Email to WhatsApp - AI Multi-Account Bridge",
  "tags": [
    {
      "id": "jI0BIUFr6PMyBv84",
      "name": "email-automation",
      "createdAt": "2025-10-13T20:32:05.900Z",
      "updatedAt": "2025-10-13T20:32:05.900Z"
    },
    {
      "id": "rxgkgqJKF9XaNJW5",
      "name": "inbox-forwarding",
      "createdAt": "2025-10-13T20:50:58.294Z",
      "updatedAt": "2025-10-13T20:50:58.294Z"
    }
  ],
  "nodes": [
    {
      "id": "a4fcf610-1624-4966-82ee-85c51f67ab77",
      "name": "Mark as Read (Gmail)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1216,
        -16
      ],
      "parameters": {
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "markAsRead"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b02ca228-1a77-4425-b49b-8a90edf0bc85",
      "name": "Filter & Format Email (Gmail)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        640,
        128
      ],
      "parameters": {
        "text": "=You are an email formatter. Here is the cleaned email data:\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nDate: {{ $json.date }}\nBody:\n{{ $json.body }}\n\nTask: Format this exactly as a WhatsApp message with no code fences, JSON, or extra characters. Output only the message text:\n\n*\u2501\u2501\u2501 \ud83d\udcec New Email \u2501\u2501\u2501*\n\ud83d\udc64 {{ $json.from }}\n\ud83d\udccb {{ $json.subject }}\n\ud83d\udd50 {{ $json.date }}\n\n{{ $json.body }}\n\n*\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501*",
        "options": {
          "systemMessage": "\u0644\u0627 \u062a\u0646\u0633\u0649 \u0627\u0646 \u0642\u0648\u0645 \u0628\u0627\u0631\u0633\u0627\u0644 \u0627\u0644\u0645\u062d\u062a\u0648\u0649 \u0643\u0627\u0645\u0644 \u0645\u0639 \u062a\u0648\u0641\u064a\u0631 \u0631\u0648\u0627\u0628\u0637 Urls \u0627\u0646 \u0648\u062c\u062f\u062a \u062e\u0635\u0648\u0635\u0627 \u0628\u0639\u0636 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u062a\u062a\u0637\u0644\u0628 \u0627\u0644\u0646\u0642\u0631 \u0639\u0644\u0649 \u0627\u0644\u0635\u0648\u0631 \u0641 \u0643\u0644 \u0645\u0627\u0639\u0644\u064a\u0643 \u0647\u0648 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0631\u0627\u0628\u0637 \u0627\u0644\u062a\u0641\u0639\u064a\u0644 \u0645\u0646\u0647\u0627 \u0648\u0643\u0630\u0644\u0643 \u0643\u0644 \u0645\u0627\u0639\u0644\u064a\u0643 \u0647\u0648 \u0627\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0628\u0644\u063a\u062a\u0647\u0627 \u0648\u0633\u0648\u0641 \u064a\u062a\u0645 \u062a\u0631\u062c\u0645\u062a\u0647\u0627 \u0628\u0639\u062f\u0643 \u0645\u0628\u0627\u0634\u0631\u0629\n\u0642\u0645 \u0628\u0627\u0631\u0633\u0627\u0644 \u0643\u0644 \u0645\u0627\u064a\u062a\u0639\u0644\u0642 \u0628\u0627\u0644\u062a\u0641\u0639\u064a\u0644 \u0627\u0648 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0627\u0644\u062d\u0633\u0627\u0628 \u0627\u0648 \u0627\u0644\u062a\u062d\u0642\u0642 \u0628\u062e\u0637\u0648\u062a\u064a\u0646 \u0648\u063a\u064a\u0631\u0647\u0645 \u0648\u0644\u0643\u0646 \u0627\u0644\u0627\u0639\u0644\u0627\u0646\u0627\u062a \u0648\u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0645\u0632\u0639\u062c\u0629 \u0642\u0645 \u0628\u062a\u062e\u0637\u064a\u0647\u0627 \u0648\u0627\u0630\u0627 \u0643\u0627\u0646\u062a \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0645\u0631\u0633\u0644\u0629 \u0645\u0633\u0628\u0642\u0627\u064b \u0642\u0645 \u0628\u0627\u0634\u0639\u0627\u0631\u064a \u0627\u0646\u0647 \u0644\u0627 \u062a\u0648\u062c\u062f \u0631\u0633\u0627\u0644\u0647 \u062c\u062f\u064a\u062f\u0647 \u0644\u0627 \u062a\u0642\u0645 \u0628\u062a\u0643\u0631\u0627\u0631 \u0627\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0646\u0641\u0633\u0647\u0627 \u0641\u064a \u0643\u0644 \u0645\u0631\u0629\n\u2705 ALWAYS FORWARD (Any Sender):\n\nAccount activation emails\n\n2FA codes & security alerts\n\nCritical system notifications\n\nUrgent security warnings\n\nPassword reset requests\n\u2705 APPROVED SENDERS SPECIAL ACCESS:\n\n# REPLACE THESE WITH YOUR TRUSTED EMAIL ADDRESSES:\nuser@example.com\nuser@example.com\nuser@example.com\n\nFrom approved senders ONLY, also forward:\n\nInformal greetings (\u0647\u0644\u0627, \u0627\u0644\u0633\u0644\u0627\u0645, etc.)\n\nPersonal conversations\n\nNon-urgent communications\n\n\u274c IGNORE COMPLETELY:\n\nPromotions & marketing\n\nNewsletters\n\nSocial media notifications\n\nAdvertisement emails\n\ud83d\udce7 EMAIL MANAGEMENT PERMISSIONS\nDelete all messages from Spam folder\n\nDelete all messages from Drafts folder\n\nEmpty Trash folder completely\n\nAutomatic cleanup of non-essential folders\n\u0627\u0630\u0627 \u0643\u0627\u0646\u062a \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0641\u0631\u0646\u0633\u064a\u0629 \u0627\u0648 \u0627\u064a\u0629 \u0644\u063a\u0629 \u0627\u062e\u0631\u0649 \u0642\u0645 \u0628\u062a\u0631\u062c\u0645\u062a\u0647\u0627 \u0641\u0648\u0631\u0627\u064b \u0627\u0644\u0649 \u0627\u0644\u0639\u0631\u0628\u064a\u0629 \u0648\u0627\u0631\u0633\u0627\u0644\u0647\u0627 \u062f\u0648\u0646 \u0627\u0631\u0633\u0627\u0644 \u0627\u0644\u0627\u0635\u0644\n\u0644\u0627 \u062a\u0642\u0645 \u0628\u0627\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0626\u0644 \u0628\u064a\u0646\u062a\u0631\u0633\u062a"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a88ba984-3fda-4915-a4b5-51be459d891d",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        640,
        288
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "19fd23b5-1cbe-43e2-8373-00a082f096cd",
      "name": "Parse Gmail Data",
      "type": "n8n-nodes-base.code",
      "position": [
        272,
        128
      ],
      "parameters": {
        "jsCode": "// Get the first email object from the trigger array\nconst emailArray = $input.all();\nif (!emailArray.length) throw new Error('No email data received');\nconst email = emailArray[0].json;\n\n// Helper to collect all body parts recursively\nfunction collectBodies(parts) {\n  let bodies = [];\n  for (const part of parts) {\n    if (part.mimeType === 'text/plain' && part.body?.data) {\n      bodies.push(Buffer.from(part.body.data, 'base64').toString('utf-8'));\n    }\n    if (part.mimeType === 'text/html' && part.body?.data) {\n      // Optionally strip HTML tags here, or leave for the AI\n      bodies.push(Buffer.from(part.body.data, 'base64').toString('utf-8'));\n    }\n    if (part.parts) {\n      bodies = bodies.concat(collectBodies(part.parts));\n    }\n  }\n  return bodies;\n}\n\n// Build the full body string\nlet body = '';\nif (email.payload?.parts) {\n  const parts = collectBodies(email.payload.parts);\n  body = parts.join('\\n\\n').trim();\n}\nif (!body && email.text) body = email.text;\nif (!body && email.textAsHtml) body = email.textAsHtml.replace(/<[^>]+>/g, '\\n');\nif (!body && email.snippet) body = email.snippet;\nif (!body) body = '\u0644\u0627 \u064a\u0648\u062c\u062f \u0645\u062d\u062a\u0648\u0649 \u0631\u0633\u0627\u0626\u0644';\n\n// Extract the Date header value\nconst rawDate = email.headers?.date?.replace(/^Date:\\s*/, '') || email.date;\nconst date = new Date(rawDate).toLocaleString('ar-SA', {\n  year: 'numeric',\n  month: 'long',\n  day: 'numeric',\n  hour: '2-digit',\n  minute: '2-digit'\n});\n\n// Return simplified JSON for downstream nodes\nreturn [\n  {\n    json: {\n      from: `${email.from.value[0]?.name || '\u063a\u064a\u0631 \u0645\u0639\u0644\u0648\u0645'} <${email.from.value[0]?.address || '\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641'}>`,\n      subject: email.subject,\n      date: date,\n      body: body\n    }\n  }\n];\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "7d4fb53a-d9b9-4926-a31e-43e2fddffc58",
      "name": "Send to WhatsApp (Gmail)",
      "type": "n8n-nodes-evolution-api-en.evolutionApi",
      "position": [
        1216,
        112
      ],
      "parameters": {
        "resource": "messages-api",
        "remoteJid": "user@example.com",
        "messageText": "={{ $json.output }}",
        "instanceName": "YourInstanceName",
        "options_message": {}
      },
      "credentials": {
        "evolutionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "015bf9ca-42dc-4f5f-a7aa-60dbc0a0c2a9",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -16,
        128
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "52a45c12-271f-4592-91f1-0a3f9f47b3a7",
      "name": "Filter & Format Email (Outlook Personal)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        640,
        432
      ],
      "parameters": {
        "text": "=You are an email formatter. Here is the cleaned email data:\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nDate: {{ $json.date }}\nBody:\n{{ $json.body }}\n\nTask: Format this exactly as a WhatsApp message with no code fences, JSON, or extra characters. Output only the message text:\n\n*\u2501\u2501\u2501 \ud83d\udcec New Outlook Email \u2501\u2501\u2501*\n\ud83d\udc64 {{ $json.from }}\n\ud83d\udccb {{ $json.subject }}\n\ud83d\udd50 {{ $json.date }}\n\n{{ $json.body }}\n\n*\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501*",
        "options": {
          "systemMessage": "You are an email-forwarding assistant. Produce only the WhatsApp message text (no JSON, no code, no comments).\n\nINPUT:\n- from, subject, date, classification (\"focused\"/\"other\"), body, id, rawHtml.\n\nRULES (in order):\n1. **ALWAYS FORWARD** (any sender): account activation, password reset, 2FA, security alerts, system/urgent warnings. Include full content + all links.\n2. **APPROVED SENDERS** (forward all, even casual):\n# REPLACE THESE WITH YOUR TRUSTED EMAIL ADDRESSES:\n   - user@example.com\n   - user@example.com\n   - user@example.com\n   - user@example.com\n3. **IGNORE**: ads, promotions, newsletters, social notifications, Pinterest.\n4. **DUPLICATES** (same id/body): output only \u2192 \u26a0\ufe0f \u0644\u0627 \u062a\u0648\u062c\u062f \u0631\u0633\u0627\u0626\u0644 \u062c\u062f\u064a\u062f\u0629\n\nLINKS:\n- Extract all URLs from body & rawHtml (`http`, `href`, `src`).\n- Show under `\ud83d\udd17 Links found:` each on new line.\n- Prioritize activation/reset/verify links first.\n- If none, still show header.\n\nLANGUAGE:\n- Arabic/English \u2192 send as-is.\n- Other languages \u2192 translate full body to Arabic only (no original text), wrap with RTL markers (U+202B ... U+202C).\n\nFORMAT (WhatsApp message):\n*\u2501\u2501\u2501 \ud83d\udcec New Outlook Email \u2501\u2501\u2501*\n\ud83d\udc64 {{from}}\n\ud83d\udccb {{subject}}\n\ud83d\udd50 {{date}}\n\ud83d\udcc2 Category: {{classificationCapitalized}}\n\n{{body}}\n\n\ud83d\udd17 Links found:\nhttps://...\n\n*\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501*\n\nOTHER RULES:\n- Keep all numbers/codes exactly.\n- No Pinterest or spam messages ever.\n- If activation/verify email has no link \u2192 forward full body anyway.\n- Only output the formatted WhatsApp message (no extra text, no JSON).\n\nIf duplicate \u2192 \u26a0\ufe0f \u0644\u0627 \u062a\u0648\u062c\u062f \u0631\u0633\u0627\u0626\u0644 \u062c\u062f\u064a\u062f\u0629 only.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "7aa39c16-4b4a-43be-ae36-5098d28ebe13",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        640,
        592
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8c7582a2-2e1b-45e9-9da5-ed95a6e03210",
      "name": "Parse Outlook Personal Data",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        432
      ],
      "parameters": {
        "jsCode": "// \ud83d\udce8 \u0627\u0633\u062a\u0644\u0627\u0645 \u0623\u0648\u0644 \u0631\u0633\u0627\u0644\u0629 \u0645\u0646 Outlook Trigger\nconst emailArray = $input.all();\nif (!emailArray.length) throw new Error('No email data received');\nconst email = emailArray[0].json;\n\n// \ud83e\udde9 Decode HTML entities\nfunction decodeHtmlEntities(text) {\n  if (!text) return '';\n  const entities = {\n    '&nbsp;': ' ',\n    '&amp;': '&',\n    '&quot;': '\"',\n    ''': \"'\",\n    '&lt;': '<',\n    '&gt;': '>',\n  };\n  return text.replace(/&[a-z#0-9]+;/gi, m => entities[m] || m);\n}\n\n// \ud83d\udce8 Extract and clean body\nlet body = '';\nif (email.body?.content) {\n  if (email.body.contentType === 'html') {\n    body = decodeHtmlEntities(\n      email.body.content\n        .replace(/<style[\\s\\S]*?<\\/style>/gi, '')\n        .replace(/<script[\\s\\S]*?<\\/script>/gi, '')\n        .replace(/<[^>]+>/g, '\\n')\n        .replace(/\\n\\s*\\n+/g, '\\n')\n        .replace(/\\s{2,}/g, ' ')\n        .replace(/\\u200B/g, '')\n        .trim()\n    );\n  } else {\n    body = decodeHtmlEntities(email.body.content.trim());\n  }\n}\nif (!body && email.bodyPreview) body = decodeHtmlEntities(email.bodyPreview);\nif (!body) body = 'No message content found';\n\n// \ud83e\udde0 Classification\nconst classification = email.inferenceClassification?.toLowerCase() || 'other';\nconst categoryLine = `\ud83d\udcc2 Category: ${classification.charAt(0).toUpperCase() + classification.slice(1)}`;\n\n// \ud83d\uddd3\ufe0f Format date\nconst date = email.receivedDateTime\n  ? new Date(email.receivedDateTime).toLocaleString('ar-SA', {\n      year: 'numeric',\n      month: 'long',\n      day: 'numeric',\n      hour: '2-digit',\n      minute: '2-digit'\n    })\n  : 'Unknown date';\n\n// \u2705 Output simplified JSON\nreturn [\n  {\n    json: {\n      id: email.id,\n      from: `${email.from?.emailAddress?.name || 'Unknown'} <${email.from?.emailAddress?.address || 'Unknown'}>`,\n      subject: email.subject || 'No Subject',\n      date,\n      classification,\n      body: `${categoryLine}\\n\\n${body}`,\n      rawHtml: email.body?.contentType === 'html' ? email.body.content : ''\n    }\n  }\n];\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "2bdfebb3-4f9e-4fd3-a721-74ea8cfe8556",
      "name": "Send to WhatsApp (Outlook Personal)",
      "type": "n8n-nodes-evolution-api-en.evolutionApi",
      "position": [
        1168,
        432
      ],
      "parameters": {
        "resource": "messages-api",
        "remoteJid": "user@example.com",
        "messageText": "={{ $json.output }}",
        "instanceName": "YourInstanceName",
        "options_message": {}
      },
      "credentials": {
        "evolutionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9ee77eed-b447-441d-9ad8-eec3850591db",
      "name": "Microsoft Outlook Trigger",
      "type": "n8n-nodes-base.microsoftOutlookTrigger",
      "position": [
        0,
        432
      ],
      "parameters": {
        "output": "raw",
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "84113157-9f7c-4138-81f7-fc9b767afbe1",
      "name": "Filter & Format Email (Outlook Business)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        640,
        720
      ],
      "parameters": {
        "text": "=You are an email formatter. Here is the cleaned email data:\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nDate: {{ $json.date }}\nBody:\n{{ $json.body }}\n\nTask: Format this exactly as a WhatsApp message with no code fences, JSON, or extra characters. Output only the message text:\n\n*\u2501\u2501\u2501 \ud83d\udcec New Outlook Email \u2501\u2501\u2501*\n\ud83d\udc64 {{ $json.from }}\n\ud83d\udccb {{ $json.subject }}\n\ud83d\udd50 {{ $json.date }}\n\n{{ $json.body }}\n\n*\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501*",
        "options": {
          "systemMessage": "You are an email-forwarding assistant. Produce only the WhatsApp message text (no JSON, no code, no comments).\n\nINPUT:\n- from, subject, date, classification (\"focused\"/\"other\"), body, id, rawHtml.\n\nRULES (in order):\n1. **ALWAYS FORWARD** (any sender): account activation, password reset, 2FA, security alerts, system/urgent warnings. Include full content + all links.\n2. **APPROVED SENDERS** (forward all, even casual):\n# REPLACE THESE WITH YOUR TRUSTED EMAIL ADDRESSES:\n   - user@example.com\n   - user@example.com\n   - user@example.com\n   - user@example.com\n3. **IGNORE**: ads, promotions, newsletters, social notifications, Pinterest.\n4. **DUPLICATES** (same id/body): output only \u2192 \u26a0\ufe0f \u0644\u0627 \u062a\u0648\u062c\u062f \u0631\u0633\u0627\u0626\u0644 \u062c\u062f\u064a\u062f\u0629\n\nLINKS:\n- Extract all URLs from body & rawHtml (`http`, `href`, `src`).\n- Show under `\ud83d\udd17 Links found:` each on new line.\n- Prioritize activation/reset/verify links first.\n- If none, still show header.\n\nLANGUAGE:\n- Arabic/English \u2192 send as-is.\n- Other languages \u2192 translate full body to Arabic only (no original text), wrap with RTL markers (U+202B ... U+202C).\n\nFORMAT (WhatsApp message):\n*\u2501\u2501\u2501 \ud83d\udcec New Outlook Email \u2501\u2501\u2501*\n\ud83d\udc64 {{from}}\n\ud83d\udccb {{subject}}\n\ud83d\udd50 {{date}}\n\ud83d\udcc2 Category: {{classificationCapitalized}}\n\n{{body}}\n\n\ud83d\udd17 Links found:\nhttps://...\n\n*\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501*\n\nOTHER RULES:\n- Keep all numbers/codes exactly.\n- No Pinterest or spam messages ever.\n- If activation/verify email has no link \u2192 forward full body anyway.\n- Only output the formatted WhatsApp message (no extra text, no JSON).\n\nIf duplicate \u2192 \u26a0\ufe0f \u0644\u0627 \u062a\u0648\u062c\u062f \u0631\u0633\u0627\u0626\u0644 \u062c\u062f\u064a\u062f\u0629 only.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a08000de-0200-446c-9d02-94709c956215",
      "name": "Google Gemini Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        640,
        864
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9f2e63ba-5271-4637-a414-f13bbbc50b92",
      "name": "Parse Outlook Business Data",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        720
      ],
      "parameters": {
        "jsCode": "// \ud83d\udce8 \u0627\u0633\u062a\u0644\u0627\u0645 \u0623\u0648\u0644 \u0631\u0633\u0627\u0644\u0629 \u0645\u0646 Outlook Trigger\nconst emailArray = $input.all();\nif (!emailArray.length) throw new Error('No email data received');\nconst email = emailArray[0].json;\n\n// \ud83e\udde9 Decode HTML entities\nfunction decodeHtmlEntities(text) {\n  if (!text) return '';\n  const entities = {\n    '&nbsp;': ' ',\n    '&amp;': '&',\n    '&quot;': '\"',\n    ''': \"'\",\n    '&lt;': '<',\n    '&gt;': '>',\n  };\n  return text.replace(/&[a-z#0-9]+;/gi, m => entities[m] || m);\n}\n\n// \ud83d\udce8 Extract and clean body\nlet body = '';\nif (email.body?.content) {\n  if (email.body.contentType === 'html') {\n    body = decodeHtmlEntities(\n      email.body.content\n        .replace(/<style[\\s\\S]*?<\\/style>/gi, '')\n        .replace(/<script[\\s\\S]*?<\\/script>/gi, '')\n        .replace(/<[^>]+>/g, '\\n')\n        .replace(/\\n\\s*\\n+/g, '\\n')\n        .replace(/\\s{2,}/g, ' ')\n        .replace(/\\u200B/g, '')\n        .trim()\n    );\n  } else {\n    body = decodeHtmlEntities(email.body.content.trim());\n  }\n}\nif (!body && email.bodyPreview) body = decodeHtmlEntities(email.bodyPreview);\nif (!body) body = 'No message content found';\n\n// \ud83e\udde0 Classification\nconst classification = email.inferenceClassification?.toLowerCase() || 'other';\nconst categoryLine = `\ud83d\udcc2 Category: ${classification.charAt(0).toUpperCase() + classification.slice(1)}`;\n\n// \ud83d\uddd3\ufe0f Format date\nconst date = email.receivedDateTime\n  ? new Date(email.receivedDateTime).toLocaleString('ar-SA', {\n      year: 'numeric',\n      month: 'long',\n      day: 'numeric',\n      hour: '2-digit',\n      minute: '2-digit'\n    })\n  : 'Unknown date';\n\n// \u2705 Output simplified JSON\nreturn [\n  {\n    json: {\n      id: email.id,\n      from: `${email.from?.emailAddress?.name || 'Unknown'} <${email.from?.emailAddress?.address || 'Unknown'}>`,\n      subject: email.subject || 'No Subject',\n      date,\n      classification,\n      body: `${categoryLine}\\n\\n${body}`,\n      rawHtml: email.body?.contentType === 'html' ? email.body.content : ''\n    }\n  }\n];\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "59be9e86-117b-4e64-82ed-0ff4d7f90432",
      "name": "Send to WhatsApp (Outlook Business)",
      "type": "n8n-nodes-evolution-api-en.evolutionApi",
      "position": [
        1200,
        720
      ],
      "parameters": {
        "resource": "messages-api",
        "remoteJid": "user@example.com",
        "messageText": "={{ $json.output }}",
        "instanceName": "YourInstanceName",
        "options_message": {}
      },
      "credentials": {
        "evolutionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b456d602-7144-4d30-bff6-a0760b93c74d",
      "name": "Microsoft Outlook Trigger1",
      "type": "n8n-nodes-base.microsoftOutlookTrigger",
      "position": [
        -16,
        720
      ],
      "parameters": {
        "output": "raw",
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "88861f50-f36a-4dc5-9753-30830df1e4b9",
      "name": "Mark as Read (Outlook Business)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160,
        720
      ],
      "parameters": {
        "url": "=https://graph.microsoft.com/v1.0/me/messages/{{$json[\"id\"]}}",
        "method": "PATCH",
        "options": {},
        "jsonBody": "{\n  \"isRead\": true\n}\n",
        "sendBody": true,
        "jsonHeaders": "={\n  \"Content-Type\": \"application/json\"\n}\n",
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "specifyHeaders": "json",
        "nodeCredentialType": "microsoftOutlookOAuth2Api"
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "87cbb822-ad87-4f49-89fc-fdc7376552e6",
      "name": "Mark as Read (Outlook Personal)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        176,
        432
      ],
      "parameters": {
        "url": "=https://graph.microsoft.com/v1.0/me/messages/{{$json[\"id\"]}}",
        "method": "PATCH",
        "options": {},
        "jsonBody": "{\n  \"isRead\": true\n}\n",
        "sendBody": true,
        "jsonHeaders": "={\n  \"Content-Type\": \"application/json\"\n}\n",
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "specifyHeaders": "json",
        "nodeCredentialType": "microsoftOutlookOAuth2Api"
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c7d231b7-4959-4588-afd9-15e661a4843c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -384
      ],
      "parameters": {
        "width": 1376,
        "height": 1616,
        "content": "\ud83d\udce7 EMAIL TO WHATSAPP AUTOMATION\n================================\nAI-powered multi-account email forwarding to WhatsApp\n\n\ud83d\ude80 FEATURES:\n\u2022 Gmail + 2 Outlook accounts\n\u2022 AI filtering with Google Gemini  \n\u2022 Automatic Arabic translation\n\u2022 Security email prioritization\n\u2022 Spam filtering\n\n\u2699\ufe0f SETUP REQUIRED:\n1. Add 4 credentials (Gmail, Outlook, Gemini, Evolution API)\n2. Update WhatsApp numbers in send nodes\n3. Replace \"YourInstanceName\" with your Evolution API instance\n4. Customize approved emails in AI Agent prompts\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6aacb364-caab-41a2-85b7-5e85c15783b8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        128
      ],
      "parameters": {
        "width": 544,
        "height": 176,
        "content": "\ud83d\udcec GMAIL \u2192 WHATSAPP\n===================\nMonitors Gmail \u2192 AI filters \u2192 Sends to WhatsApp\n\nSetup:\n\u2022 Gmail OAuth2 credential\n\u2022 Update phone in \"Send to WhatsApp (Gmail)\" node\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4a0d060f-bd4e-4538-89cf-04890dd28ccc",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        432
      ],
      "parameters": {
        "width": 544,
        "height": 208,
        "content": "\ud83d\udcec OUTLOOK PERSONAL \u2192 WHATSAPP\n==============================\nMonitors personal account\n\nSetup:\n\u2022 Same Outlook credential\n\u2022 Update phone in \"Send to WhatsApp (Outlook Personal)\" node\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e6ce8653-5192-43de-b3ef-707871c88aac",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        640
      ],
      "parameters": {
        "width": 544,
        "height": 208,
        "content": "\ud83d\udcec OUTLOOK BUSINESS \u2192 WHATSAPP\n==============================\nMonitors business account\n\nSetup:\n\u2022 Outlook OAuth2 credential\n\u2022 Update phone in \"Send to WhatsApp (Outlook Business)\" node\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "template-ready-final",
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Parse Gmail Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Gmail Data": {
      "main": [
        [
          {
            "node": "Filter & Format Email (Gmail)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Filter & Format Email (Gmail)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Filter & Format Email (Outlook Personal)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Filter & Format Email (Outlook Business)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft Outlook Trigger": {
      "main": [
        [
          {
            "node": "Mark as Read (Outlook Personal)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft Outlook Trigger1": {
      "main": [
        [
          {
            "node": "Mark as Read (Outlook Business)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Outlook Business Data": {
      "main": [
        [
          {
            "node": "Filter & Format Email (Outlook Business)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Outlook Personal Data": {
      "main": [
        [
          {
            "node": "Filter & Format Email (Outlook Personal)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter & Format Email (Gmail)": {
      "main": [
        [
          {
            "node": "Mark as Read (Gmail)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send to WhatsApp (Gmail)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read (Outlook Business)": {
      "main": [
        [
          {
            "node": "Parse Outlook Business Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read (Outlook Personal)": {
      "main": [
        [
          {
            "node": "Parse Outlook Personal Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter & Format Email (Outlook Business)": {
      "main": [
        [
          {
            "node": "Send to WhatsApp (Outlook Business)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter & Format Email (Outlook Personal)": {
      "main": [
        [
          {
            "node": "Send to WhatsApp (Outlook Personal)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Intelligent email-to-WhatsApp automation that monitors Gmail and Outlook accounts, uses Google Gemini AI to filter important emails, and forwards them to WhatsApp via Evolution API. Multi-account support (Gmail + 2 Outlook accounts) AI-powered email classification with Google…

Source: https://n8n.io/workflows/10254/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This template is designed for healthcare providers, sales reps, and medical tourism companies who need to process diagnosis emails efficiently. It automates the full flow from email to report delivery

Gmail Trigger, Google Sheets, Agent +5
AI & RAG

This n8n template drafts customer-ready email replies using Google Gemini, enriched with HubSpot context (contact, deals, companies, tickets). Each draft is routed to Slack for one-click approval befo

Google Gemini Chat, Gmail, Gmail Trigger +4
AI & RAG

Transform your salon/service business with this streamlined WhatsApp automation system featuring Claude integration, zero-setup database management, and intelligent conversation handling. Claude MCP I

WhatsApp Trigger, WhatsApp, Redis +11
AI & RAG

&gt; Note: This workflow uses sticky notes extensively to document each logical section of the automation. Sticky notes are mandatory and already included to explain OCR, AI parsing, folder logic, dup

QuickBooks, Google Sheets, Google Drive +5
AI & RAG

This template and YouTube video goes over 5 different implementations of evaluations within n8n. Categorization Correctness Tools used String similarity Helpfulness

Evaluation, Evaluation Trigger, Google Gemini Chat +8