{
  "name": "AI customer assistant",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "1vK71sax3TV20yppYzT_1PqkGJmwAISKz",
          "mode": "list",
          "cachedResultName": "Car retailer",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1vK71sax3TV20yppYzT_1PqkGJmwAISKz"
        },
        "event": "fileCreated",
        "options": {}
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "03b65228-39d7-423c-8725-3a6951f7adca",
      "name": "Google Drive Trigger",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "uFyvU64laFLAhwzS",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        208,
        0
      ],
      "id": "2fd62926-bd4f-43bf-b3c6-e32103f47bdd",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "uFyvU64laFLAhwzS",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "pineconeIndex": {
          "__rl": true,
          "value": "car-retailer",
          "mode": "list",
          "cachedResultName": "car-retailer"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        416,
        0
      ],
      "id": "c9a172d1-6003-4a1e-a923-fc70457a70f5",
      "name": "Pinecone Vector Store",
      "credentials": {
        "pineconeApi": {
          "id": "SCcWBq98tbDSONVl",
          "name": "VectorDB"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        352,
        240
      ],
      "id": "db444032-2f73-4c3b-b610-ed65a55f7249",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "4NTTN0Q0oTqvf4DB",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "textSplittingMode": "custom",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        560,
        240
      ],
      "id": "9c6f20bc-3a05-46af-8d30-8bb395f1570b",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        560,
        448
      ],
      "id": "b35ebc45-3db1-4084-bc9f-d221edc7786b",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        528,
        688
      ],
      "id": "d692bd0c-c08d-4664-9253-f07e418ad0f7",
      "name": "Telegram Trigger",
      "webhookId": "55bae9df-d77b-470d-af64-7fbfa4d1a891",
      "credentials": {
        "telegramApi": {
          "id": "Tciv6jKT3Pwo3c7L",
          "name": "Telegram account 2"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "id": "44530b22-99d3-4051-bb57-2adb69d6b302"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Voice"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "df21dc6b-abe8-4b41-814b-3e8a9d05f9a8",
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Text"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        736,
        688
      ],
      "id": "1911361a-d601-44ae-8acd-d9831679bfeb",
      "name": "Voice or text switch"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $('Telegram Trigger').item.json.message.voice.file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1040,
        592
      ],
      "id": "07f1206f-7a4a-4fdb-9a3e-7299be3972d5",
      "name": "Get a file",
      "webhookId": "66edc4a1-dd98-419e-8531-6aef4567da84",
      "credentials": {
        "telegramApi": {
          "id": "Tciv6jKT3Pwo3c7L",
          "name": "Telegram account 2"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3956ef6c-057a-4b70-89f9-c2b0923ffae3",
              "name": "text",
              "value": "={{ $json.message.text }}",
              "type": "string"
            },
            {
              "id": "0451e78c-9276-4285-b385-dec50bdd131e",
              "name": "chat_id",
              "value": "={{ $json.message.chat.id }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1184,
        832
      ],
      "id": "d6407bbe-5f26-4923-8da5-eec2c06b78ef",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.1,
      "position": [
        1312,
        592
      ],
      "id": "6d7d8d17-b2c8-4720-a7cc-4e5db7788265",
      "name": "Transcribe a recording",
      "credentials": {
        "openAiApi": {
          "id": "4NTTN0Q0oTqvf4DB",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "Role & Behavior\nYou are a friendly, professional customer support agent for a car retailer and vehicle sales company.\nYou understand English and must not provide support outside the automotive domain.\n\nAlways reply in the same language the customer is speaking or writing in.\n\nAlways respond with empathy, clarity, patience, and professionalism.\n\nDo not make up information.\nOnly answer based on the retrieved knowledge base (RAG) and the user’s question.\n\nResponsibilities\n\nCustomer Support\nUse the RAG tool to retrieve the most accurate and up-to-date information.\n\nProvide vehicle-related information based on customer requests, including:\n\nVehicle brand and model\n\nPrice (including VAT if applicable)\n\nVehicle condition (new, used, certified pre-owned)\n\nMileage\n\nYear of manufacture\n\nFuel type (petrol, diesel, hybrid, electric)\n\nKey features and equipment\n\nWarranty and guarantee details\n\nAvailability\n\nAnswer questions related to:\n\nFinancing options\n\nLeasing options\n\nTrade-in offers\n\nTest drives\n\nVehicle delivery and pickup\n\nAfter-sales service and maintenance\n\nIf an exact answer cannot be found:\n\nBe honest and say the information is unavailable\n\nDo not guess or speculate\n\nSuggest clear next steps (contact sales team, book a consultation, or request availability check)\n\nTone & Communication\n\nAlways acknowledge customer questions and concerns politely.\n\nKeep explanations simple, clear, and easy to understand.\n\nAvoid technical jargon unless the customer uses it first.\n\nMaintain a supportive, professional, and trustworthy tone at all times.\n\nOrder & Lead Handling (Vehicle Purchase Requests)\n\nYou are responsible for collecting customer vehicle purchase requests and sales leads.\n\nTo record a request, you must collect all four required details:\n\nFull Name\n\nPhone Number\n\nAddress\n\nVehicle category or specific vehicle (for example: new car, used car, electric vehicle, SUV, or a specific model)\n\nRules:\n\nDo not record the request until all four details are provided\n\nIf any detail is missing, politely ask for it\n\nDo not assume or autofill missing information\n\nOnce all four details are collected and confirmed:\n\nRecord the request using the Google Sheet tool\n\nBoundaries\n\nDo not provide legal, financial, or non-automotive advice.\n\nDo not answer questions unrelated to car sales or automotive services.\n\nDo not confirm availability unless verified through the RAG tool.\n\nDo not hallucinate vehicle data, prices, or specifications."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1680,
        688
      ],
      "id": "d8cef66d-f35d-4144-b1a9-8cf4c2a76cce",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1552,
        896
      ],
      "id": "19bdad59-eb21-41af-84d8-839ab7ddc062",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "4NTTN0Q0oTqvf4DB",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "contextWindowLength": 8
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1696,
        896
      ],
      "id": "586a510b-8219-496c-842a-dd1c7fd142d7",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "description": "Use this tool to answer every questions by the user regarding car retailer store.",
        "topK": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}"
      },
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1.1,
      "position": [
        1840,
        896
      ],
      "id": "eb1d1e00-0c2c-4bfb-9acb-42d991051aa3",
      "name": "Answer questions with a vector store"
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "car-retailer",
          "mode": "list",
          "cachedResultName": "car-retailer"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        1680,
        1136
      ],
      "id": "9fb9e3f2-2ac9-4a2b-a245-69d8ae5d244e",
      "name": "Pinecone Vector Store1",
      "credentials": {
        "pineconeApi": {
          "id": "SCcWBq98tbDSONVl",
          "name": "VectorDB"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "batchSize": 512
        }
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        1664,
        1344
      ],
      "id": "7a3d7f92-0a4d-41a9-b147-f2ce5a78638a",
      "name": "Embeddings OpenAI1",
      "credentials": {
        "openAiApi": {
          "id": "4NTTN0Q0oTqvf4DB",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        2000,
        1168
      ],
      "id": "774c1c14-ad0b-4599-9c23-3fdd8ae5b79a",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "id": "4NTTN0Q0oTqvf4DB",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        2064,
        688
      ],
      "id": "8da4e306-e1ac-4c7a-89d3-fa2c0903451f",
      "name": "Send a text message",
      "webhookId": "236fb002-3710-4b77-9dd4-3311d996ad17",
      "credentials": {
        "telegramApi": {
          "id": "Tciv6jKT3Pwo3c7L",
          "name": "Telegram account 2"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Use this tool to record name, phone number, address and category of products of buyers of car retailer company",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1pa7HcIhWZU13DAwV8Z-D7A0D7zkerrC3Ea-ZsXgkJFQ",
          "mode": "list",
          "cachedResultName": "Car buyers",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pa7HcIhWZU13DAwV8Z-D7A0D7zkerrC3Ea-ZsXgkJFQ/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pa7HcIhWZU13DAwV8Z-D7A0D7zkerrC3Ea-ZsXgkJFQ/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Name', ``, 'string') }}",
            "Phone number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone_number', ``, 'string') }}",
            "Address": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Address', ``, 'string') }}",
            "Category": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Category', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone number",
              "displayName": "Phone number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "displayName": "Address",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "displayName": "Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        2288,
        1056
      ],
      "id": "722bf267-30bf-4ee8-9fc3-213afd416186",
      "name": "Append row in sheet in Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GwXXyPXzeYL1Nv7u",
          "name": "Google Sheets account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "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
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Voice or text switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice or text switch": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "7a184bbd-7e1e-4170-ae35-25868957b085",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "244b66a010bf6ac4dd906ce63c71f65c9d451f87dc983b0f29056780b69a2a8e"
  },
  "id": "GvoE5CYbkV9uIBmk",
  "tags": []
}