{
  "name": "AI-powered WhatsApp chatbot for text, voice, images, and PDF with RAG",
  "nodes": [
    {
      "id": "d1b47f60-5a4d-4629-a18d-b3c6ec0c972c",
      "name": "Knowledge Base Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3720,
        400
      ]
    },
    {
      "id": "c36731ce-5086-4a2f-8c3a-63be150fb8ae",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3720,
        580
      ]
    },
    {
      "id": "53c2496a-0737-452c-b49c-ca0afa9c0073",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        4060,
        740
      ]
    },
    {
      "id": "54697b14-28a0-4572-b17e-328a7b52cc90",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        1380,
        -560
      ]
    },
    {
      "id": "a79b9b58-0211-4570-af84-64db8bef9de3",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        3820,
        580
      ]
    },
    {
      "id": "fda97aec-70be-4611-94a3-7816e384c76b",
      "name": "MongoDB Vector Search",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        3940,
        580
      ]
    },
    {
      "id": "8cf54cb6-7247-4036-b1e4-9a28650d700a",
      "name": "Document Section Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1920,
        -400
      ]
    },
    {
      "id": "4e93e3c3-1847-483a-b6a7-67ff2cff294f",
      "name": "Document Chunker",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1920,
        -260
      ]
    },
    {
      "id": "4f616bfc-4ec7-4c88-8a63-cb2c47655680",
      "name": "MongoDB Vector Store Inserter",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        1820,
        -560
      ]
    },
    {
      "id": "cc9a0766-69a4-4745-97f5-4c4c5e156c91",
      "name": "OpenAI Embeddings Generator",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1820,
        -400
      ]
    },
    {
      "id": "a9368d23-e35f-4986-8060-30a05f3f9c05",
      "name": "Google Docs Importer",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1600,
        -560
      ]
    },
    {
      "id": "1fb0f8a3-9113-4185-a935-0fc327f70881",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -580
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Run this workflow manually to import and index Google Docs product documentation into MongoDB with vector embeddings for fast search."
      }
    },
    {
      "id": "62e13275-6f92-4799-9cbe-e0064ceb5140",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        360
      ],
      "parameters": {
        "width": null,
        "height": 280,
        "content": "This workflow listens for WhatsApp messages (text, audio, image, documents), converts them into embeddings, searches MongoDB, and uses GPT-4o-mini to provide context-aware answers with conversation me"
      }
    },
    {
      "id": "d21fc408-f66d-4b07-972a-811aa420b4ce",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2220,
        -580
      ],
      "parameters": {
        "width": null,
        "height": 540,
        "content": "Search Index Example \n\n{\n  \"mappings\": {\n    \"dynamic\": false,\n    \"fields\": {\n      \"_id\": {\n        \"type\": \"string\"\n      },\n      \"text\": {\n        \"type\": \"string\"\n      },\n      \"embedding\": {\n "
      }
    },
    {
      "id": "ddc0fdb7-bacc-4f41-87bf-48bb714a404d",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        1380,
        400
      ]
    },
    {
      "id": "8842d0c7-082e-4b4e-b350-a8bb8f47c390",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2460,
        160
      ]
    },
    {
      "id": "a342dc14-0ffe-41ba-a3e9-853fe043f4fb",
      "name": "OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2460,
        400
      ]
    },
    {
      "id": "b1220587-fadf-4b5b-944e-b6e60b64c141",
      "name": "Extract from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        3060,
        860
      ]
    },
    {
      "id": "b02474a0-be6a-4591-a10c-abc2f597a3e6",
      "name": "Extract from XLS",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2960,
        1060
      ]
    },
    {
      "id": "1012f8a7-9fcb-4d80-ad5f-bfaa31eddf7d",
      "name": "Extract from XLSX",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2960,
        1220
      ]
    },
    {
      "id": "8891a2eb-16d6-471a-803e-df1789a336f3",
      "name": "Map JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        3200,
        980
      ]
    },
    {
      "id": "a0920bc7-71bd-4803-bbce-4cef14cac5ee",
      "name": "Map file extensions",
      "type": "n8n-nodes-base.code",
      "position": [
        2420,
        740
      ]
    },
    {
      "id": "77302aa3-6e87-4de6-9ec7-387ddb76fc84",
      "name": "Map document prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        3440,
        800
      ]
    },
    {
      "id": "90821e49-c98d-4617-8289-1be6d3aeb087",
      "name": "Map image prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        2680,
        400
      ]
    },
    {
      "id": "cf603f5c-0a6e-4cdd-846b-738ed417daa2",
      "name": "Map text prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        2020,
        -40
      ]
    },
    {
      "id": "7727e89d-cf21-4440-ab7f-85594eb1ec44",
      "name": "Gets WhatsApp Voicemail Source URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2020,
        160
      ]
    },
    {
      "id": "08b938a1-d32e-4aa1-958f-bdabd3dfec13",
      "name": "Gets WhatsApp Image Source URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2020,
        400
      ]
    },
    {
      "id": "d934ce80-cdb0-476d-8896-b8c226086933",
      "name": "Gets WhatsApp Document Source URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2020,
        740
      ]
    },
    {
      "id": "aad1b221-0985-43e7-bc0b-312436171abe",
      "name": "Download Voicemail",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        160
      ]
    },
    {
      "id": "dfd08bec-9d30-4125-b167-7feaeefd7afa",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        400
      ]
    },
    {
      "id": "ba3d221f-ce5c-4105-82cf-fbd11c2c0e2f",
      "name": "Download Document",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        740
      ]
    },
    {
      "id": "87ecc44f-cc1f-47e0-b995-079230be118d",
      "name": "Route Types",
      "type": "n8n-nodes-base.switch",
      "position": [
        1600,
        380
      ]
    },
    {
      "id": "ce3d08ce-4445-4473-90b2-227ba065c4d8",
      "name": "Route Document Types",
      "type": "n8n-nodes-base.switch",
      "position": [
        2680,
        580
      ]
    },
    {
      "id": "18684032-23ec-4e10-88f4-e93363432a67",
      "name": "Send Unsupported Response",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2960,
        1380
      ]
    },
    {
      "id": "acc8e4ae-0610-42fc-a318-b9a23a38919b",
      "name": "Send Response",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        4080,
        400
      ]
    }
  ],
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI1": {
      "main": [
        [
          {
            "node": "Map image prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map JSON": {
      "main": [
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Types": {
      "main": [
        [
          {
            "node": "Map text prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gets WhatsApp Voicemail Source URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gets WhatsApp Image Source URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gets WhatsApp Document Source URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map text prompt": {
      "main": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document Chunker": {
      "ai_textSplitter": [
        [
          {
            "node": "Document Section Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Extract from PDF": {
      "main": [
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from XLS": {
      "main": [
        [
          {
            "node": "Map JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map image prompt": {
      "main": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Route Types",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Document": {
      "main": [
        [
          {
            "node": "Map file extensions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Vector Search",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract from XLSX": {
      "main": [
        [
          {
            "node": "Map JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Download Voicemail": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map document prompt": {
      "main": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map file extensions": {
      "main": [
        [
          {
            "node": "Route Document Types",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Docs Importer": {
      "main": [
        [
          {
            "node": "MongoDB Vector Store Inserter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Knowledge Base Agent": {
      "main": [
        [
          {
            "node": "Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Document Types": {
      "main": [
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map document prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map JSON",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from XLS",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from XLSX",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Unsupported Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Vector Search": {
      "ai_tool": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Document Section Loader": {
      "ai_document": [
        [
          {
            "node": "MongoDB Vector Store Inserter",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Send Unsupported Response": {
      "main": [
        []
      ]
    },
    "OpenAI Embeddings Generator": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Vector Store Inserter",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Gets WhatsApp Image Source URL": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "Google Docs Importer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gets WhatsApp Document Source URL": {
      "main": [
        [
          {
            "node": "Download Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gets WhatsApp Voicemail Source URL": {
      "main": [
        [
          {
            "node": "Download Voicemail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}