{
  "name": "Handle WhatsApp sales queries with GPT-4, Supabase, and a product catalog",
  "nodes": [
    {
      "id": "546667a2-bbc4-448b-bf5f-453c79b393b2",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2192,
        1424
      ]
    },
    {
      "id": "41140d7a-85c0-4fd5-ba18-ffaea4cec4e0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1984,
        1776
      ],
      "parameters": {
        "width": 864,
        "height": 592,
        "content": "## RAG pipeline\nSet the embedding Dimension to 1536 for openAI or 1024 for cohere\n"
      }
    },
    {
      "id": "7ef686c2-e88a-4946-8f4a-1c40d4bb8bf4",
      "name": "Knowledgebase",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        2176,
        1120
      ]
    },
    {
      "id": "4fe36bc9-c459-4e32-bca4-ce253b8fadf4",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        2384,
        2288
      ]
    },
    {
      "id": "076d68f9-7ae6-4aa6-a848-bdcf1c8e7e1f",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        2304,
        2080
      ]
    },
    {
      "id": "d2a06568-b7d8-4055-8b0c-8af96b3d9295",
      "name": "Supabase Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        2304,
        1856
      ]
    },
    {
      "id": "3e6861ac-651b-47af-ae72-943445a91f85",
      "name": "Route Types",
      "type": "n8n-nodes-base.switch",
      "position": [
        80,
        912
      ]
    },
    {
      "id": "e28e5b40-9c86-4242-a439-4200166a705d",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1088,
        1280
      ]
    },
    {
      "id": "092771f3-177a-477d-92b0-494d4469dd4f",
      "name": "Download Voicemail",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1184,
        928
      ]
    },
    {
      "id": "10e2b196-3e13-4c72-a7f5-b482f0dad11b",
      "name": "Gets WhatsApp Image Source URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        864,
        1280
      ]
    },
    {
      "id": "4e475e15-7da1-4841-be5b-e3a592205ffa",
      "name": "Gets WhatsApp Voicemail Source URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        944,
        928
      ]
    },
    {
      "id": "aeb70664-261b-4737-8938-39fc546d63cc",
      "name": "Map text prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        576
      ]
    },
    {
      "id": "66612dd9-6790-4322-a2cb-da2297290235",
      "name": "Map image prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1536,
        1280
      ]
    },
    {
      "id": "964af1dd-84eb-444c-ad39-5fdd026334bd",
      "name": "OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1312,
        1280
      ]
    },
    {
      "id": "4af1715a-8d6c-4947-a5fd-d7fffe7cb40d",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1408,
        928
      ]
    },
    {
      "id": "ceca7fba-f1c8-4f09-a656-e14182729be6",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -224,
        944
      ]
    },
    {
      "id": "dafd9fc8-7e97-422e-9c75-a8d01f5f668d",
      "name": "Web Search",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        2464,
        1120
      ]
    },
    {
      "id": "2f3a3d0d-498a-468d-b2b1-50ec4d0aa9a9",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        320
      ],
      "parameters": {
        "width": 560,
        "height": 800,
        "content": "### How it works\nAn AI-powered sales agent on WhatsApp that handles product inquiries using your Supabase knowledge base and n8n catalog. Customers can send text, voice notes, or images to ask about p"
      }
    },
    {
      "id": "fb01e422-f886-47a4-a7ad-82a5cee9368c",
      "name": "search_products_inventory",
      "type": "n8n-nodes-base.dataTableTool",
      "position": [
        2624,
        1120
      ]
    },
    {
      "id": "00e4b472-9565-4d55-b2c3-6909a2483764",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        3072,
        896
      ]
    },
    {
      "id": "d46ff732-a7a5-4f03-98f7-4df50d6005a4",
      "name": "Send message1",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1120,
        1648
      ]
    },
    {
      "id": "67e0577d-1724-4454-88f8-bddede9eefe9",
      "name": "On form submission1",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        1712,
        1856
      ]
    },
    {
      "id": "eb5249d4-a837-4998-86d8-231d3fde1e82",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        848
      ],
      "parameters": {
        "width": 592,
        "height": 256,
        "content": "## Upload Audio files\nFor processing audio"
      }
    },
    {
      "id": "bd742123-4bd3-4ec9-bb3c-20424835a94d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        1184
      ],
      "parameters": {
        "width": 784,
        "height": 272,
        "content": "## Upload image files\nFor processing images"
      }
    },
    {
      "id": "4692e05b-87be-41ad-91cd-a5e953ed7996",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        1536
      ],
      "parameters": {
        "width": 224,
        "height": 256,
        "content": "## fall back response"
      }
    },
    {
      "id": "ee835434-3d7d-4212-888f-c24bc08a7a91",
      "name": "the brain",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1888,
        1120
      ]
    },
    {
      "id": "c220cf2a-dc93-4614-9271-b0d8eeb19829",
      "name": "System Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2048,
        1120
      ]
    },
    {
      "id": "da9e4a63-55f4-493e-829d-29117c60c0d0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        672
      ],
      "parameters": {
        "width": 640,
        "height": 368,
        "content": "### Logic\n**Code node** \nIdentifies if output has image urls and then cleans them fto be sent to whatsapp as part of response\n\nThe code also validates the urls\n\n**If node** routes the  responses with "
      }
    },
    {
      "id": "e92cae00-9599-4d38-aebb-0c8fdbff8f7e",
      "name": "Response_validation",
      "type": "n8n-nodes-base.code",
      "position": [
        2800,
        896
      ]
    },
    {
      "id": "61761fb7-4e69-4abd-b00d-34b115b72086",
      "name": "Send text message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        3440,
        688
      ]
    },
    {
      "id": "3b4c3708-1392-4d71-b7ca-28c22c7e8f12",
      "name": "Send media&caption message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        3504,
        1120
      ]
    },
    {
      "id": "043f02cc-4dcc-4f5d-bc57-58decf10062b",
      "name": "Sales AI agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2192,
        896
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Send text message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send media&caption message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Sales AI agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI1": {
      "main": [
        [
          {
            "node": "Map image prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "the brain": {
      "ai_languageModel": [
        [
          {
            "node": "Sales AI agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Web Search": {
      "ai_tool": [
        [
          {
            "node": "Sales AI agent",
            "type": "ai_tool",
            "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": "Send message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Knowledgebase": {
      "ai_tool": [
        [
          {
            "node": "Sales AI agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "System Memory": {
      "ai_memory": [
        [
          {
            "node": "Sales AI agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sales AI agent": {
      "main": [
        [
          {
            "node": "Response_validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map text prompt": {
      "main": [
        [
          {
            "node": "Sales AI agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map image prompt": {
      "main": [
        [
          {
            "node": "Sales AI agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Route Types",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send text message": {
      "main": [
        []
      ]
    },
    "Download Voicemail": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Knowledgebase",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "On form submission1": {
      "main": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Response_validation": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "search_products_inventory": {
      "ai_tool": [
        [
          {
            "node": "Sales AI agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gets WhatsApp Image Source URL": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Gets WhatsApp Voicemail Source URL": {
      "main": [
        [
          {
            "node": "Download Voicemail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}