Système automatisé de classification et de réponse aux e-mails avec Groq AI et Pinecone

Avancé

Ceci est unTicket Management, AI Summarizationworkflow d'automatisation du domainecontenant 38 nœuds.Utilise principalement des nœuds comme Code, Switch, Twitter, EmailSend, HttpRequest. Système automatisé de classification et de réponse aux e-mails avec Groq AI et Pinecone

Prérequis
  • Informations d'identification Twitter API
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Clé API Pinecone
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "4ec72f345837e652f6ec393f7f7457d09446df2a23a7c6ffddff8265d46e2be9"
  },
  "nodes": [
    {
      "id": "8befe960-178d-4983-b962-7487817baed4",
      "name": "Déclencheur Email (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -1900,
        1100
      ],
      "parameters": {
        "options": {},
        "downloadAttachments": true
      },
      "typeVersion": 2
    },
    {
      "id": "29a32c21-8f26-4d64-9a43-875ddd566c72",
      "name": "Commutateur1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1460,
        1016
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "hr",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bb988e36-c702-4b83-8ec1-f4f585f3b411",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "hr"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "billing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "06afe4de-1542-46e9-9d57-7775b3b2d185",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "billing"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "complaint",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "069fdd96-983f-46a7-a709-863cdbc6384d",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "complaint"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "feedback",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f3e821fa-8b78-427e-abe4-38ae628624e1",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "feedback"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "inquiry",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4a46eaa4-e960-4f3b-b23c-b04d9dbb61e0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "inquiry"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "sales",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f4a3c28e-ca9f-4c7c-aa04-010832d7dab5",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json[\"subject\"] }}",
                    "rightValue": "sales"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "unknown",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "263fd3c7-1e12-4b2e-96b2-0b99e713632d",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "unknown"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "054ce674-7ec3-472c-aece-239291db890c",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        -1680,
        1100
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const subject = $json.subject ? $json.subject.toLowerCase() : \"\";\n\nlet category = \"unknown\";\n\nif (/resume|cv|job/.test(subject)) {\n  category = \"hr\";\n} else if (/invoice|bill/.test(subject)) {\n  category = \"billing\";\n} else if (/complaint|problem|issue/.test(subject)) {\n  category = \"complaint\";\n} else if (/feedback|suggestion/.test(subject)) {\n  category = \"feedback\";\n} else if (/inquiry|open|working|tomorrow|holiday/.test(subject)) {\n  category = \"inquiry\";\n} else if (/sales|offer|quotation/.test(subject)) {\n  category = \"sales\";\n\n}\n\nreturn {\n  json: {\n    ...$json,\n    category\n  }\n};\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "2d3a2fa0-db9c-44e1-89da-0b7a98626bd8",
      "name": "Chaîne LLM de base",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -860,
        1400
      ],
      "parameters": {
        "text": "=##role\nYou are an email classifier. Given an email's subject and body, return one of these exact categories: [\"hr\", \"billing\", \"complaint\", \"feedback\", \"inquiry\", \"sales\", \"client\"].\n\nOnly return one word from this list. If the email is a bill or invoice, return \"billing\". If it's a job application, return \"hr\". If unsure, return \"inquiry\".\n\nSubject: {{ $json[\"subject\"] }}\nBody: {{ $json[\"body\"] }}\n",
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "2b0efec2-3508-4a37-945c-2085439d05fd",
      "name": "Modèle de chat Groq",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -760,
        1620
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "700feb4d-f5f7-4a64-80cc-e95db99716fc",
      "name": "Modèle de chat Groq1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -660,
        1040
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "ce29423e-ea17-4cdd-81cc-16172776bdb9",
      "name": "X",
      "type": "n8n-nodes-base.twitter",
      "position": [
        -140,
        760
      ],
      "parameters": {
        "text": "=Another happy customer said: \" {{ $json.textPlain }}\"\n",
        "additionalFields": {}
      },
      "typeVersion": 2
    },
    {
      "id": "ff416773-6aa0-468a-895b-5970caaf371c",
      "name": "Modèle de chat Groq2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        340,
        1280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "cbe51847-bddb-4169-a9b2-545005416936",
      "name": "Chaîne LLM de base1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -980,
        180
      ],
      "parameters": {
        "text": "=You are an HR assistant.\n\nHere is the job description for the role:\n\n[Insert role details here, e.g., \"Looking for a Python Developer with experience in Django, REST APIs, and SQL.\"]\n\nNow, read the following candidate's email/resume and evaluate if they are a good fit for this role.\n\nIf suitable, respond with:\nACCEPT - and a brief explanation why.\n\nIf not suitable, respond with:\nREJECT - and a brief explanation why.\n\nCandidate's email/resume:\n{{ $json[\"emailText\"] }}\n",
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "be7d4f6d-64a0-4be0-b70c-e60abfa610f7",
      "name": "Modèle de chat Groq3",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -900,
        400
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "d69d1118-5fd7-4e7f-a2c2-8e66d8d40c19",
      "name": "Code2",
      "type": "n8n-nodes-base.code",
      "position": [
        -540,
        280
      ],
      "parameters": {
        "jsCode": "const aiResponse = $json[\"text\"] || \"\";  // Adjust key if different\nconst isAccepted = aiResponse.toLowerCase().startsWith(\"accept\");\n\nreturn [{\n  json: {\n    decision: isAccepted ? \"accept\" : \"reject\",\n    aiResponse: aiResponse,\n    candidateEmail: $json[\"candidateEmail\"] || \"\", // get candidate email from previous nodes\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "ecd67230-4807-48bf-acf7-70092f4476fd",
      "name": "Commutateur",
      "type": "n8n-nodes-base.switch",
      "position": [
        -320,
        280
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "accept",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "366a42b8-a4eb-4488-9872-6f1aa097fc48",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json[decision] }}",
                    "rightValue": "accept"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "reject",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6146a9fb-3988-4078-af40-4c87840816a9",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json[decision] }}",
                    "rightValue": "reject"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "ff741958-dfd7-4c46-945d-10cfe521bd7d",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        460,
        1240
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "toolName": "knowlagebase",
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "demokb",
          "cachedResultName": "demokb"
        },
        "toolDescription": "company dock"
      },
      "typeVersion": 1.1
    },
    {
      "id": "97811059-7058-4b93-b62b-d65ac30da74e",
      "name": "Embeddings Cohere",
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "position": [
        600,
        1400
      ],
      "parameters": {
        "modelName": "embed-english-v3.0"
      },
      "typeVersion": 1
    },
    {
      "id": "8fd67212-0a9d-4783-acc1-93c7d86c820b",
      "name": "Lors du clic sur 'Exécuter le workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1580,
        2060
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d4b781d1-fe8b-414c-b374-c42d97549763",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1360,
        2060
      ],
      "parameters": {
        "url": "https://www.dropbox.com/scl/fo/p05bb9t8o6ech9d1joj7s/AKJmlI3mlt3O8qSjGbroMLc?rlkey=m1h852ks0y2o1gmdmbk3uda1d&st=pk0pq820&dl=1",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0341b254-3ece-450b-aa3b-de531cbfb1f1",
      "name": "Extraire du fichier",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1140,
        2060
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "ffbc75c1-b3ed-4fa6-8cd5-3bbed81c60d1",
      "name": "Code3",
      "type": "n8n-nodes-base.code",
      "position": [
        -920,
        2060
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "\nconst text = $json.extractedText || $json.text || '';\n\n\nconst cleanedText = text.replace(/\\s+/g, ' ').trim();\n\nreturn {\n  json: {\n    original: text,\n    cleaned: cleanedText\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "1c00d468-87ec-433c-939e-48049c133130",
      "name": "Pinecone Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -700,
        2060
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "demokb",
          "cachedResultName": "demokb"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "404e80ef-fb17-4cbd-9198-23b951b36edf",
      "name": "Embeddings Cohere1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "position": [
        -700,
        2280
      ],
      "parameters": {
        "modelName": "embed-multilingual-v3.0"
      },
      "typeVersion": 1
    },
    {
      "id": "761ca395-d8d9-4ad4-a8de-b741dc8ddef0",
      "name": "Chargeur de données par défaut",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -580,
        2300
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "41b8a97b-7350-4b87-8586-8f558394df54",
      "name": "Séparateur de texte récursif",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        -500,
        2480
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "05cfdbad-4dc1-45de-8a25-22762dbf07b7",
      "name": "envoyer l'email à l'équipe",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        80,
        860
      ],
      "webhookId": "408004d1-ebdb-4776-a9f8-6a470db658a0",
      "parameters": {
        "text": "=New feedback received:\n\nSubject: {{$json[\"subject\"]}}\n\nContent: {{$json[\"emailContent\"]}}\n\nSentiment: {{$json[\"sentiment\"]}}\n",
        "options": {},
        "subject": "negative feedback",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "{{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "42abb326-e9b3-41eb-9840-704b83d3821c",
      "name": "envoyer la réponse au client",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        620,
        980
      ],
      "webhookId": "bf79c357-f57f-4851-a8bc-c95602e4c069",
      "parameters": {
        "text": "={{ $json.output }}",
        "options": {},
        "subject": "inqury reply",
        "toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
        "fromEmail": "={{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7cc49a03-c131-4064-a603-1264b9602060",
      "name": "envoyer à l'équipe support",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -400,
        600
      ],
      "webhookId": "211a9ca3-9768-486e-aad6-fbb52f6d3b2b",
      "parameters": {
        "text": "=\nA new complaint has been received from {{ $json[\"userName\"] || \"a customer\" }}:\n\n\"{{ $json[\"complaintText\"] }}\"\n\nPlease investigate and resolve this\n",
        "options": {},
        "subject": "New Customer Complaint Received",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "9b4d7b7e-6a0d-4ba3-bd02-fa86422f7a56",
      "name": "Envoyer au client",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -640,
        600
      ],
      "webhookId": "1ef34921-41bc-4a94-ab3e-2553e5c1758c",
      "parameters": {
        "text": "=We Received Your Complaint\n\nThank you for reaching out to us. We have received your complaint:\n\n\"{{ $json[\"complaintText\"] }}\"\n\nOur team is currently reviewing it and will get back to you as soon as possible.\n\nWe apologize for any inconvenience caused.\n\nFrom , \nCustomer Support Team\n",
        "options": {},
        "subject": "Complaint Received",
        "toEmail": "={{ $json.from }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "9a536c97-b395-4466-8181-c1569e340a3c",
      "name": "email de rejet",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -100,
        380
      ],
      "webhookId": "ea634c6c-305a-499e-8773-d539e8489310",
      "parameters": {
        "text": "=Dear Candidate,\n\nThank you for applying. After review, we regret to inform you that you do not fit the requirements at this time.\n\nDetails: {{$json[\"aiResponse\"]}}\n\nBest regards,\nHR Team",
        "options": {},
        "subject": "Job Application Status: Not selected",
        "toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b782474f-4abe-43e5-8e8b-6f9a4c8bc223",
      "name": "vers RH",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        120,
        180
      ],
      "webhookId": "1794df4d-7feb-47d6-a8a0-910197e6df62",
      "parameters": {
        "text": "=Hello HR Team,\n\nCandidate {{$json[\"candidate\"]}} has been accepted with a score of {{$json[\"score\"]}}.\n\nPlease proceed with the next steps.",
        "options": {},
        "subject": "=New Candidate Accepted:",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "{{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "150f211e-d5f5-4bd3-bc96-fcf662a00f2f",
      "name": "confirmation d'acceptation au candidat",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -100,
        180
      ],
      "webhookId": "bc4ad05b-966f-4bf2-bb80-23f996862711",
      "parameters": {
        "text": "=Dear Candidate,\n\nCongratulations! You have been accepted for the role.\n\nDetails: {{$json[\"aiResponse\"]}}\n\nBest regards,\nHR Team\n",
        "options": {},
        "subject": "Job Application Status: Accepted",
        "toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "fd02b064-4431-486f-bea3-cb0fd161d7d5",
      "name": "facture envoyée à l'équipe",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -960,
        540
      ],
      "webhookId": "91eaac98-671d-4e51-9a36-70a567908385",
      "parameters": {
        "text": "=\n\nA new billing email has been received.\n\nFrom: {{$json[\"from\"]}}\nSubject: {{$json[\"subject\"]}}\n\nEmail content:\n{{$json[\"body\"]}}\n\n",
        "options": {},
        "subject": "NEW BILL",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "{{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "88d4ca68-2a8f-4fac-a327-5d34d4cffaf7",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        724
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 620,
        "content": "EMAIL CLASSIFIER USING SWITCH"
      },
      "typeVersion": 1
    },
    {
      "id": "cf112be5-e068-4186-b087-8b8c5f684022",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1020,
        1360
      ],
      "parameters": {
        "width": 600,
        "height": 200,
        "content": "USE FOR AI AGENT WHEN SWITCH FAILS"
      },
      "typeVersion": 1
    },
    {
      "id": "51599770-8db8-48d9-aea1-a8866118277b",
      "name": "VERS L'ÉQUIPE COMMERCIALE",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -500,
        1140
      ],
      "webhookId": "d0fbd1fe-eafc-4915-a9d0-699a5676f218",
      "parameters": {
        "text": "= Sales Team\n\nFrom: {{$json[\"from\"]}}\nSubject: {{$json[\"subject\"]}}\n\nEmail content:\n{{$json[\"body\"]}}\n\n",
        "options": {},
        "subject": "sales",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "eb7bf4f3-b4c1-4a00-99ce-4da22a607f28",
      "name": "NETTOYAGE SORTIE AGENT IA",
      "type": "n8n-nodes-base.code",
      "position": [
        -420,
        1520
      ],
      "parameters": {
        "jsCode": "const knownCategories = [\n  \"hr\",\n  \"billing\",\n  \"complaint\",\n  \"feedback\",\n  \"inquiry\",\n  \"sales\",\n  \"client\"\n];\n\nconst response = $json[\"category\"] || $json[\"output\"] || $json[\"text\"] || \"\";  // adapt this based on how your LLM responds\n\nconst normalized = response.trim().toLowerCase();\n\nif (knownCategories.includes(normalized)) {\n  return [{ json: { category: normalized } }];\n} else {\n  return [{ json: { category: \"unknown\" } }];\n}\n\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "7686a043-a6a1-4766-b44c-68cd17dd19e4",
      "name": "RÉPONSE REQUÊTE RAG",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        300,
        980
      ],
      "parameters": {
        "text": "=You are a helpful assistant replying to a customer inquiry via email.\n\nUse the following information retrieved from our documents to generate a clear, professional response.\n\nContext:\n{{ $json[\"vectors\"].map(v => v.metadata.text).join(\"\\n\\n\") || \"No context available.\" }}\n\nCustomer's Question:\n{{ $json[\"emailText\"] }}\n\nRespond with a structured and informative email. Summarize any important points about products, services, or team details. Keep the tone polite and helpful.\n\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "52d15753-d3bd-40bf-b003-17d55ddb5769",
      "name": "Analyse de sentiment des retours",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "position": [
        -720,
        860
      ],
      "parameters": {
        "options": {
          "categories": "Positive, Neutral, Negative"
        },
        "inputText": "=\n {{ $json.textPlain }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "a35ed1ad-bbce-4b6d-82e9-a745a54f90e8",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        820
      ],
      "parameters": {
        "width": 500,
        "height": 200,
        "content": "check if feedback is postive or nrgative"
      },
      "typeVersion": 1
    },
    {
      "id": "fada6c17-587e-4b4c-8ff4-6df0e51f747c",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        1960
      ],
      "parameters": {
        "width": 1500,
        "height": 460,
        "content": "details of business in pdf form to vector db"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "054ce674-7ec3-472c-aece-239291db890c": {
      "main": [
        [
          {
            "node": "29a32c21-8f26-4d64-9a43-875ddd566c72",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d69d1118-5fd7-4e7f-a2c2-8e66d8d40c19": {
      "main": [
        [
          {
            "node": "ecd67230-4807-48bf-acf7-70092f4476fd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ffbc75c1-b3ed-4fa6-8cd5-3bbed81c60d1": {
      "main": [
        [
          {
            "node": "1c00d468-87ec-433c-939e-48049c133130",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ecd67230-4807-48bf-acf7-70092f4476fd": {
      "main": [
        [
          {
            "node": "150f211e-d5f5-4bd3-bc96-fcf662a00f2f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "9a536c97-b395-4466-8181-c1569e340a3c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "29a32c21-8f26-4d64-9a43-875ddd566c72": {
      "main": [
        [
          {
            "node": "cbe51847-bddb-4169-a9b2-545005416936",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "fd02b064-4431-486f-bea3-cb0fd161d7d5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "9b4d7b7e-6a0d-4ba3-bd02-fa86422f7a56",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "52d15753-d3bd-40bf-b003-17d55ddb5769",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "7686a043-a6a1-4766-b44c-68cd17dd19e4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "51599770-8db8-48d9-aea1-a8866118277b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2d3a2fa0-db9c-44e1-89da-0b7a98626bd8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d4b781d1-fe8b-414c-b374-c42d97549763": {
      "main": [
        [
          {
            "node": "0341b254-3ece-450b-aa3b-de531cbfb1f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2d3a2fa0-db9c-44e1-89da-0b7a98626bd8": {
      "main": [
        [
          {
            "node": "eb7bf4f3-b4c1-4a00-99ce-4da22a607f28",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2b0efec2-3508-4a37-945c-2085439d05fd": {
      "ai_languageModel": [
        [
          {
            "node": "2d3a2fa0-db9c-44e1-89da-0b7a98626bd8",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "cbe51847-bddb-4169-a9b2-545005416936": {
      "main": [
        [
          {
            "node": "d69d1118-5fd7-4e7f-a2c2-8e66d8d40c19",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "700feb4d-f5f7-4a64-80cc-e95db99716fc": {
      "ai_languageModel": [
        [
          {
            "node": "52d15753-d3bd-40bf-b003-17d55ddb5769",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "ff416773-6aa0-468a-895b-5970caaf371c": {
      "ai_languageModel": [
        [
          {
            "node": "7686a043-a6a1-4766-b44c-68cd17dd19e4",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "be7d4f6d-64a0-4be0-b70c-e60abfa610f7": {
      "ai_languageModel": [
        [
          {
            "node": "cbe51847-bddb-4169-a9b2-545005416936",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "7686a043-a6a1-4766-b44c-68cd17dd19e4": {
      "main": [
        [
          {
            "node": "42abb326-e9b3-41eb-9840-704b83d3821c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9b4d7b7e-6a0d-4ba3-bd02-fa86422f7a56": {
      "main": [
        [
          {
            "node": "7cc49a03-c131-4064-a603-1264b9602060",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "97811059-7058-4b93-b62b-d65ac30da74e": {
      "ai_embedding": [
        [
          {
            "node": "ff741958-dfd7-4c46-945d-10cfe521bd7d",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "0341b254-3ece-450b-aa3b-de531cbfb1f1": {
      "main": [
        [
          {
            "node": "ffbc75c1-b3ed-4fa6-8cd5-3bbed81c60d1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "404e80ef-fb17-4cbd-9198-23b951b36edf": {
      "ai_embedding": [
        [
          {
            "node": "1c00d468-87ec-433c-939e-48049c133130",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "761ca395-d8d9-4ad4-a8de-b741dc8ddef0": {
      "ai_document": [
        [
          {
            "node": "1c00d468-87ec-433c-939e-48049c133130",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "8befe960-178d-4983-b962-7487817baed4": {
      "main": [
        [
          {
            "node": "054ce674-7ec3-472c-aece-239291db890c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eb7bf4f3-b4c1-4a00-99ce-4da22a607f28": {
      "main": [
        [
          {
            "node": "29a32c21-8f26-4d64-9a43-875ddd566c72",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ff741958-dfd7-4c46-945d-10cfe521bd7d": {
      "ai_tool": [
        [
          {
            "node": "7686a043-a6a1-4766-b44c-68cd17dd19e4",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "150f211e-d5f5-4bd3-bc96-fcf662a00f2f": {
      "main": [
        [
          {
            "node": "b782474f-4abe-43e5-8e8b-6f9a4c8bc223",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "52d15753-d3bd-40bf-b003-17d55ddb5769": {
      "main": [
        [
          {
            "node": "ce29423e-ea17-4cdd-81cc-16172776bdb9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "05cfdbad-4dc1-45de-8a25-22762dbf07b7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "05cfdbad-4dc1-45de-8a25-22762dbf07b7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "41b8a97b-7350-4b87-8586-8f558394df54": {
      "ai_textSplitter": [
        [
          {
            "node": "761ca395-d8d9-4ad4-a8de-b741dc8ddef0",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "8fd67212-0a9d-4783-acc1-93c7d86c820b": {
      "main": [
        [
          {
            "node": "d4b781d1-fe8b-414c-b374-c42d97549763",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Gestion des tickets, Résumé IA

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds38
Catégorie2
Types de nœuds17
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34