{
  "name": "Multichannel RAG Agent",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Create knowledge base",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Knowledge file",
              "fieldType": "file"
            }
          ]
        },
        "options": {}
      },
      "id": "76b3eca7-e3a0-4a4a-ab4d-860b90622a16",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        640,
        260
      ],
      "webhookId": "aa82509b-1e5f-4216-ac01-ff57047304d4"
    },
    {
      "parameters": {
        "model": "text-embedding-3-large",
        "options": {}
      },
      "id": "651e48de-a9f5-45c5-885f-7be3eecfd6f0",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.1,
      "position": [
        1040,
        480
      ],
      "credentials": {
        "openAiApi": {
          "id": "LSihAOI8NTU3m5ce",
          "name": "OpenAi account 3"
        }
      }
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $('Extract from File').item.json.text }}",
        "options": {}
      },
      "id": "912f0e81-4f1c-4aac-902c-42da63add481",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        1180,
        480
      ]
    },
    {
      "parameters": {
        "chunkOverlap": 100,
        "options": {}
      },
      "id": "fd44827e-2406-45ff-857c-d734ee06740e",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        1180,
        640
      ]
    },
    {
      "parameters": {
        "operation": "pdf",
        "binaryPropertyName": "Knowledge_file",
        "options": {}
      },
      "id": "2eb4ab38-dd3a-4445-849c-62c5526edd13",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {
        "model": "text-embedding-3-large",
        "options": {}
      },
      "id": "c3621f48-eb71-4e1e-9902-39867955ea69",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.1,
      "position": [
        980,
        1480
      ],
      "credentials": {
        "openAiApi": {
          "id": "LSihAOI8NTU3m5ce",
          "name": "OpenAi account 3"
        }
      }
    },
    {
      "parameters": {
        "name": "company_knowledge_base",
        "description": "this node connect to our company knowledge base",
        "topK": 10
      },
      "id": "79a62d65-d623-46b9-bb70-b107f5e3ae23",
      "name": "Vector Store Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1,
      "position": [
        960,
        1140
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "6744b83c-7625-47f3-a7a2-8739726a2c52",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        1140,
        1300
      ],
      "credentials": {
        "openAiApi": {
          "id": "LSihAOI8NTU3m5ce",
          "name": "OpenAi account 3"
        }
      }
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "open",
          "mode": "list",
          "cachedResultName": "open"
        },
        "options": {}
      },
      "id": "9305c3bc-8f7c-4067-adb8-9cb3aced554c",
      "name": "Pinecone Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1,
      "position": [
        860,
        1300
      ],
      "credentials": {
        "pineconeApi": {
          "id": "1RqqUi11YryAD4hR",
          "name": "PineconeApi account 2"
        }
      }
    },
    {
      "parameters": {
        "trigger": [
          "any_event"
        ],
        "channelId": {
          "__rl": true,
          "value": "C088MPJKX2R",
          "mode": "list",
          "cachedResultName": "n8n-message"
        },
        "options": {}
      },
      "id": "133a0718-7018-485b-942e-2b57f5ff0a34",
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        60,
        1000
      ],
      "webhookId": "e9131214-3a32-4a7a-8fc1-9772a5c288e0"
    },
    {
      "parameters": {
        "model": "=deepseek-chat",
        "options": {
          "baseURL": "https://api.deepseek.com"
        }
      },
      "id": "1670815d-9228-4406-9096-166d3425e39c",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        800,
        1140
      ],
      "credentials": {
        "openAiApi": {
          "id": "LSihAOI8NTU3m5ce",
          "name": "OpenAi account 3"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "messages"
        ]
      },
      "id": "ea2c978b-b7ad-494b-899d-5680dab85552",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "typeVersion": 1,
      "position": [
        220,
        800
      ],
      "webhookId": "fb46ee53-2b0b-4263-abec-72a870c104c8",
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "ttltDLDma7IMvQIA",
          "name": "WhatsApp OAuth account"
        }
      }
    },
    {
      "parameters": {
        "operation": "send",
        "phoneNumberId": "={{ $('WhatsApp Trigger').first().json.metadata.phone_number_id }}",
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').first().json.messages[0].from }}",
        "textBody": "={{ $json.output }}",
        "additionalFields": {},
        "requestOptions": {}
      },
      "id": "44e8f387-7f4f-4370-895e-dcb6ba78ff7e",
      "name": "WhatsApp Business Cloud",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        1580,
        800
      ],
      "credentials": {
        "whatsAppApi": {
          "id": "V1f8gxDTkk7tdasW",
          "name": "WhatsApp account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "343847f5-e87e-441d-945a-26efdbf4c17e",
              "leftValue": "={{ $json.text }}",
              "rightValue": "@U088QMASK34",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "ff66f14a-b7e9-4f2b-983e-970a32ee5783",
              "leftValue": "={{ $json.type }}",
              "rightValue": "app_mention",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "eb9886ca-8a77-49b8-9edc-b52ce33c7aa7",
      "name": "If is message1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        220,
        1000
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "={{ $('Slack Trigger').first().json.channel }}",
          "mode": "id"
        },
        "text": "={{ $('AI Agent').item.json.output }}",
        "otherOptions": {}
      },
      "id": "355c4786-9d9e-4544-b905-3a9befbca8fd",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1580,
        1000
      ],
      "webhookId": "7194f06a-73b6-446b-a937-10e77b6258fb",
      "credentials": {
        "slackOAuth2Api": {
          "id": "YogdEA0xU7zt2nIg",
          "name": "Slack account"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "id": "82e7ec99-3c21-4482-86aa-f2c116150f34",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [
        220,
        1200
      ],
      "webhookId": "2221c31f-62ba-49d7-9b33-0555b2dc4939",
      "credentials": {
        "telegramApi": {
          "id": "uO0lVtfdNYsEA99Q",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "13c7f9b0-0dd2-4273-8015-458ceadfd0bc",
                    "leftValue": "={{ $('Channel').item.json.channel }}",
                    "rightValue": "whatsapp",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "whatsapp"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('Channel').item.json.channel}}",
                    "rightValue": "slack",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "0530925f-e19a-4479-908e-2330effc16a9"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "slack"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "b333793d-e787-493c-800d-ece001fb3930",
                    "leftValue": "={{ $('Channel').item.json.channel }}",
                    "rightValue": "telegram",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "telegram"
            }
          ]
        },
        "options": {}
      },
      "id": "92d2609a-57d1-4258-9668-5e451d3d2da3",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1180,
        900
      ]
    },
    {
      "parameters": {
        "mode": "insert",
        "pineconeIndex": {
          "__rl": true,
          "value": "open",
          "mode": "list",
          "cachedResultName": "open"
        },
        "options": {}
      },
      "id": "72f7d330-fc74-442d-8b9e-f42363b84da3",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1,
      "position": [
        1040,
        260
      ],
      "credentials": {
        "pineconeApi": {
          "id": "1RqqUi11YryAD4hR",
          "name": "PineconeApi account 2"
        }
      }
    },
    {
      "parameters": {
        "agent": "conversationalAgent",
        "promptType": "define",
        "text": "={{ $json.message }}",
        "options": {}
      },
      "id": "33f12bcf-7eef-4ebf-8d52-e0a6c79b3284",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        800,
        900
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "88fe8e52-2aa8-444e-a4fa-50c458f3ff36",
              "name": "message",
              "value": "={{ $json.messages[0].text.body }}",
              "type": "string"
            },
            {
              "id": "59a991b6-e266-440e-8eaf-df68bfdba64d",
              "name": "channel",
              "value": "whatsapp",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "55f66a1e-a93e-4de2-9a82-d400e45cf5a7",
      "name": "Whatsapp",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        380,
        800
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b7e70825-797f-4a88-b32c-616e484cd086",
              "name": "message",
              "value": "={{ $json.text }}",
              "type": "string"
            },
            {
              "id": "329151ff-c365-4bd5-a43e-328a2a6ef6bd",
              "name": "channel",
              "value": "slack",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "4c4b5114-8ffa-487b-9ea7-f23fcb9d2a1f",
      "name": "Slack1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        380,
        1000
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b7e70825-797f-4a88-b32c-616e484cd086",
              "name": "message",
              "value": "={{ $json.message.text }}",
              "type": "string"
            },
            {
              "id": "329151ff-c365-4bd5-a43e-328a2a6ef6bd",
              "name": "channel",
              "value": "telegram",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "c6c24cd1-5804-4d78-bf8a-9b905f0fbbd7",
      "name": "Telegram",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        380,
        1200
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {}
      },
      "id": "75c022d5-90a0-4c80-bd90-c1bf0e46a6a7",
      "name": "Telegram1",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        1580,
        1200
      ],
      "webhookId": "c8c69c26-453e-4c52-a26c-928ea36a504e",
      "credentials": {
        "telegramApi": {
          "id": "uO0lVtfdNYsEA99Q",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "fe633b89-17d3-45e2-a296-67514075607f",
              "name": "channel",
              "value": "={{ $json.channel }}",
              "type": "string"
            },
            {
              "id": "22ac00c2-bd12-41bf-bb44-53971f733ef0",
              "name": "message",
              "value": "={{ $json.message }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "769f73ff-2472-4069-a13a-ffe988a452de",
      "name": "Channel",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        600,
        920
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "If is message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Whatsapp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If is message1": {
      "main": [
        [
          {
            "node": "Slack1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "WhatsApp Business Cloud",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Whatsapp": {
      "main": [
        [
          {
            "node": "Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack1": {
      "main": [
        [
          {
            "node": "Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram": {
      "main": [
        [
          {
            "node": "Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Channel": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4837e7d2-3ab3-41f1-b968-50c3c6fec87f",
  "meta": {
    "instanceId": "ae59e6b831344dba624c99cbe778a4bc47150f8e64de86a8011d15bac8e58c21"
  },
  "id": "xcXODYVCtk5QncYk",
  "tags": []
}