Partage de trackers spéciaux

Avancé

Ceci est unPersonal Productivity, AI Summarizationworkflow d'automatisation du domainecontenant 25 nœuds.Utilise principalement des nœuds comme Set, Merge, Switch, Webhook, Aggregate. Suivi automatique des dépenses à partir des messages LINE, avec GPT-4 et Google Sheets

Prérequis
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Informations d'identification Google Sheets API
  • Clé API OpenAI
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
{
  "id": "lqR2ivTOUP1U8YWq",
  "meta": {
    "instanceId": "970c4d82a1fd6c0dde6e2533d614308b87f56f1529e0c7f88f1092ace0a59b83",
    "templateCredsSetupCompleted": true
  },
  "name": "Special Tracker Share",
  "tags": [],
  "nodes": [
    {
      "id": "a9abe724-ec70-4aa9-9579-39968d9f624c",
      "name": "Déclencheur Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -3000,
        40
      ],
      "webhookId": "cb4a4272-92e8-4061-9d65-3abdbef3ce2e",
      "parameters": {
        "path": "your-webhook-path",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "559432eb-1739-49e7-9fae-9337ef843239",
      "name": "message",
      "type": "n8n-nodes-base.set",
      "position": [
        -2540,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "18602838-3e42-4804-b809-938dea492e38",
              "name": "body.events[0].message.text",
              "type": "string",
              "value": "={{ $json.body.events[0].message.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1161ff82-4ceb-435a-a4ed-c2ca4f618627",
      "name": "image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2540,
        200
      ],
      "parameters": {
        "url": "=https://api-data.line.me/v2/bot/message/{{ $json.body.events[0].message.id }}/content ",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <Line Channel access token>"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "afb32020-22d2-420c-9567-b3b81fda1075",
      "name": "Agent IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2200,
        20
      ],
      "parameters": {
        "text": "=Please analyze {{ $json.body.events[0].message.text }} or the image",
        "options": {
          "systemMessage": "=Check relevance: If the text is not an expense record or invoice, immediately stop all processing. If it is bookkeeping-related, extract the six data fields below.\nExtract these six pieces of information: \n1. Date (If the input only says “today”, use {{ $now.format('YYYY-MM-DD') }}) 2. Channel (Free text from the input) 3. Channel Type (Must be exactly one of: Convenience Store, Personal Care Store, Hypermarket / Supermarket, Traditional Market, Online Shopping, Pharmacy, Hardware Store, Restaurant / Food, Stall, Medical Clinic / Hospital, 3C / Electronics Mall, Airline / Passenger Transport, Software Top-Up, Gas / Transit Top-Up, Online Course, Telecom Company) 4. Expense Description (Free text from the input) 5. Amount 6. Category (Must be exactly one of: Household, Main Meals, Drinks & Desserts, Household Items, Beauty, Clothing & Accessories, Transport, Entertainment, Telecom, Medical, 3C, Software, Learning, Travel)\nOutput format: JSON :{\\\"Date\\\": \\\"...\\\", \\\"Channel\\\": \\\"...\\\", \\\"Channel Type\\\": \\\"...\\\", \\\"Expense Description\\\": \\\"...\\\", \\\"Amount\\\": \\\"...\\\", \\\"Category\\\": \\\"...\\\"}\"\n\n",
          "passthroughBinaryImages": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "a4fe0a3b-40e0-4cf0-9d44-86abadca9fe4",
      "name": "Modèle de chat OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2200,
        340
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "2sWsHFXza8n6eI0h",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "516361f7-21a9-4d9a-9f44-2bab05b9bfcb",
      "name": "reply_to_line",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        60
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"replyToken\": \"{{ $('Webhook').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"✅ Expense recorded successfully: {{ $('Merge_all').item.json['for_duplication'] }}\"\n    }\n  ]\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <Line Channel access token>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ab9fbffc-cd1e-4a2c-8f5e-23ee0f844c77",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1540,
        260
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 372483996,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_JK8t0LdX-RF3oBwDTJ30mpkkw8vs02xR0folLryebk/edit#gid=372483996",
          "cachedResultName": "2025en"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1_JK8t0LdX-RF3oBwDTJ30mpkkw8vs02xR0folLryebk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_JK8t0LdX-RF3oBwDTJ30mpkkw8vs02xR0folLryebk/edit?usp=drivesdk",
          "cachedResultName": "Spending Tracker"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wAHxYOqSVXo0KyWi",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "88bd5d9f-bcaa-4191-bcb6-1e3a0b138879",
      "name": "Fusionner_all",
      "type": "n8n-nodes-base.merge",
      "position": [
        -700,
        40
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2,
      "alwaysOutputData": false
    },
    {
      "id": "5d153710-d3a2-42dc-a090-c4faa3390210",
      "name": "reply_to_line_duplicated",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        280
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"replyToken\": \"{{ $('Webhook').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"⚠️ This entry has already been logged and will not be duplicated\"\n    }\n  ]\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <Line Channel access token>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "570de74c-b410-40ff-b7ac-781625c912a7",
      "name": "reply_to_line_no_spending",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        -120
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"replyToken\": \"{{ $('Webhook').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"Irrelevant details or images will not be logged.\"\n    }\n  ]\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <Line Channel access token>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "05789d97-3ebb-4e9f-951d-ecd54c4da404",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -2000,
        180
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"Date\": \"...\",\n  \"Channel\": \"...\",\n  \"Channel Type\": \"...\",\n  \"Expense Description\": \"...\",\n  \"Amount\": \"...\",\n  \"Category\": \"...\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "cbadff1d-15f5-4282-a62f-b42c25b41661",
      "name": "append_to_sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -200,
        60
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.output.Date }}",
            "Amount": "={{ $json.output.Amount }}",
            "Channel": "={{ $json.output.Channel }}",
            "Category": "={{ $json.output.Category }}",
            "Channel Type": "={{ $json.output['Channel Type'] }}",
            "for_duplication": "={{ $json.for_duplication }}",
            "Expense Description": "={{ $json.output['Expense Description'] }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Channel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Channel Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Channel Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Expense Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Expense Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "for_duplication",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "for_duplication",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "for_duplication"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 372483996,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_JK8t0LdX-RF3oBwDTJ30mpkkw8vs02xR0folLryebk/edit#gid=372483996",
          "cachedResultName": "2025en"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1_JK8t0LdX-RF3oBwDTJ30mpkkw8vs02xR0folLryebk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_JK8t0LdX-RF3oBwDTJ30mpkkw8vs02xR0folLryebk/edit?usp=drivesdk",
          "cachedResultName": "Spending Tracker"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wAHxYOqSVXo0KyWi",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "aee3b5eb-ff29-4847-ab57-8cbb0cdba7a6",
      "name": "Agréger",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -940,
        260
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "dedupeList",
              "fieldToAggregate": "for_duplication"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8da264bd-5b13-4912-ae8e-7ded8fc6af17",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2540,
        -640
      ],
      "parameters": {
        "width": 720,
        "height": 540,
        "content": "## Prompt en\nCheck relevance: If the text is not an expense record or invoice, immediately stop all processing. If it is bookkeeping-related, extract the six data fields below.\nExtract these six pieces of information: \n1. Date (All numbers. If the input only says “today”, use {{ $now.format('YYYY-MM-DD') }}) 2. Channel (Free text from the input) 3. Channel Type (Must be exactly one of: Convenience Store, Personal Care Store, Hypermarket / Supermarket, Traditional Market, Online Shopping, Pharmacy, Hardware Store, Restaurant / Food, Stall, Medical Clinic / Hospital, 3C / Electronics Mall, Airline / Passenger Transport, Software Top-Up, Gas / Transit Top-Up, Online Course, Telecom Company) 4. Expense Description (Free text from the input) 5. Amount 6. Category (Must be exactly one of: Household, Main Meals, Drinks & Desserts, Household Items, Beauty, Clothing & Accessories, Transport, Entertainment, Telecom, Medical, 3C, Software, Learning, Travel)\nOutput format: JSON :{\\\"Date\\\": \\\"...\\\", \\\"Channel\\\": \\\"...\\\", \\\"Channel Type\\\": \\\"...\\\", \\\"Expense Description\\\": \\\"...\\\", \\\"Amount\\\": \\\"...\\\", \\\"Category\\\": \\\"...\\\"}\"\n\n## Prompt zh\n分析出資訊:\n先判斷是否為記帳相關明細、發票,若不是則不需要處理,直接停止所有流程。若是記帳相關,分析出六個資訊:\n1. 日期(如果只提到'今天',用{{ $now.format('YYYY-MM-DD') }} ) 2. 通路 3. 通路類型(只能為:便利商店、個人用品店、量販超市、傳統市場、網路購物、藥局、五金百貨、餐廳小吃店、醫療院所、3C商場、航空客運、軟體儲值、加油交通儲值、線上課程、電信公司)4. 花費明細 5. 金額 6. 類別(只能為:家用、正餐飲食、飲料甜點、生活用品、美妝、衣服飾品、交通、娛樂、電信、醫療、3C、軟體、學習、旅遊)。若通路類型判斷為航空客運,類別一定為旅遊。若無法判斷或沒資訊,請填入'DN',每格都要有資料。請輸出為 JSON 格式,例如:{\\\"日期\\\": \\\"...\\\", \\\"通路\\\": \\\"...\\\", \\\"通路類型\\\": \\\"...\\\", \\\"花費明細\\\": \\\"...\\\", \\\"金額\\\": \\\"...\\\", \\\"類別\\\": \\\"...\\\"}\"\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4f8f3594-5aa1-4279-b25e-502658e8bedc",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2100,
        440
      ],
      "parameters": {
        "width": 280,
        "height": 440,
        "content": "## Structured Output en\n{\n  \"Date\": \"...\",\n  \"Channel\": \"...\",\n  \"Channel Type\": \"...\",\n  \"Expense Description\": \"...\",\n  \"Amount\": \"...\",\n  \"Category\": \"...\"\n}\n\n## Structured Output zh\n{\n  \"日期\": \"...\",\n  \"通路\": \"...\",\n  \"通路類型\": \"...\",\n  \"花費明細\": \"...\",\n  \"金額\": \"...\",\n  \"類別\": \"...\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "efb13bc2-bc7a-4f6a-8ec1-d783ac9c1d41",
      "name": "deduplication",
      "type": "n8n-nodes-base.set",
      "position": [
        -1700,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2f544a6e-2a51-4979-b0fb-ef9c3dcf54c6",
              "name": "for_duplication",
              "type": "string",
              "value": "={{ $json.output.Date }}-{{ $json.output['Channel Type'] }}-{{ $json.output.Amount }}-{{ $json.output.Category }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "f6f35e3c-0424-4e7c-be0f-33e191dca2b4",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1700,
        -420
      ],
      "parameters": {
        "width": 320,
        "height": 300,
        "content": "## deduplication en\nfor_duplication = {{ $json.output.Date }}-{{ $json.output['Channel Type'] }}-{{ $json.output.Amount }}-{{ $json.output.Category }}\n\n## deduplication zh\n去重使用 = {{ $json.output['日期'] }}-{{ $json.output['通路類型'] }}-{{ $json.output['金額'] }}-{{ $json.output['類別'] }}"
      },
      "typeVersion": 1
    },
    {
      "id": "296b9ff9-4819-49a8-b813-37dc507db57d",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        440
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 480,
        "content": "## Google Sheet Fields en\nSet up in advance\n1. Date\n2. Channel\n3. Channel Type\n4. Expense Description\n5. Amount\n6. Category\n7. for_duplication\n\n## Google Sheet Fields zh\n預先設置好\n1. 日期\n2. 通路\n3. 通路類型\n4. 花費明細\n5. 金額\n6. 類別\n7. 去重使用"
      },
      "typeVersion": 1
    },
    {
      "id": "8ff07d6b-6aa1-4a43-ab5a-231a4f668ca3",
      "name": "for_deduplications",
      "type": "n8n-nodes-base.set",
      "position": [
        -1240,
        260
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9b7c37f4-beac-493d-8cec-81d59fe144f7",
              "name": "for_duplication",
              "type": "string",
              "value": "={{ $json.for_duplication }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e1af076e-37f4-4cdf-8a9c-ca5f3cd2e743",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1380,
        440
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "## for_deduplications en\nManual Mapping\nfor_deduplication = {{ $json['for_duplication'] }}\n\n## for_deduplications zh\nManual Mapping\n去重使用 = {{ $json['去重使用'] }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f62cb77b-74e1-4b90-9937-95af55e76497",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -940,
        440
      ],
      "parameters": {
        "width": 220,
        "height": 260,
        "content": "## Aggregrate en\nindividual field\ninput for_deduplication\noutput dedupeList\n\n## Aggregrate zh\nindividual field\ninput 去重使用\noutput dedupeList"
      },
      "typeVersion": 1
    },
    {
      "id": "e2f1f377-4d78-4853-8d4e-037c4db5a483",
      "name": "Note adhésive6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -640
      ],
      "parameters": {
        "width": 540,
        "height": 540,
        "content": "## Switch en\n### empty\n{{ $('Merge_all').item.json['for_duplication'] }} = DN-DN-DN-DN\n{{ $('Merge_all').item.json['for_duplication'] }} matches regrx ^.*-DN-DN-DN$\n{{ $('Merge_all').item.json['for_duplication'] }} = ---\n### add\n{{ !$json.dedupeList.includes($json['for_duplication']) }} is true\n### duplicate\n{{ !$json.dedupeList.includes($json['for_duplication']) }} is false\n\n## Switch zh\n### empty\n{{ $('Merge_all').item.json['去重使用'] }} = DN-DN-DN-DN\n{{ $('Merge_all').item.json['去重使用'] }} matches regrx ^.*-DN-DN-DN$\n{{ $('Merge_all').item.json['去重使用'] }} = ---\n### add\n{{ !$json.dedupeList.includes($json['去重使用']) }} is true\n### duplicate\n{{ !$json.dedupeList.includes($json['去重使用']) }} is false"
      },
      "typeVersion": 1
    },
    {
      "id": "c9ea87a2-0f69-47a7-b409-1ea4ada2a666",
      "name": "Note adhésive7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3240,
        -400
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 300,
        "content": "## Requirements en\n1. Set up GCP OAuth and enable the Google Sheets API\n2. Pre-configure the Google Sheet field names\n3. Obtain the LINE Developer Webhook URL\n4. OpenAI API Key\n\n## 需求 zh\n1. 設置 GCP OAuth & 開啟 google sheet API  \n2. 預先設置好 Google Sheet field name\n3. 取得 Line Developer Webhook URL \n4. Open AI API KEY"
      },
      "typeVersion": 1
    },
    {
      "id": "6a01a146-0b13-4ac5-8429-bf8452157587",
      "name": "Commutateur based on Expense Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        -2780,
        40
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "45419786-9466-49e9-bfe9-a46923cfe56e",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.events[0].message.type }}",
                    "rightValue": "text"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "dba6e722-8432-481b-aa6d-9a3fdff4f022",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.events[0].message.type }}",
                    "rightValue": "image"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "12f21b25-8a50-4224-8f3d-cfcba20510b6",
      "name": "Response Commutateur",
      "type": "n8n-nodes-base.switch",
      "position": [
        -460,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "empty",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8e802d98-e4ed-4e9b-a383-4e44229bce76",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.for_duplication }}",
                    "rightValue": "DN-DN-DN-DN"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "empty",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "07afa184-938a-45fc-aa3f-69d9ea989058",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $json.for_duplication }}",
                    "rightValue": "^.*-DN-DN-DN$"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "empty",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "01611be4-10af-43e2-99a4-00c96ea4f947",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.for_duplication }}",
                    "rightValue": "---"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "add",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "55f50acc-423c-4cf9-844a-a4a0e0c48973",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ !$json.dedupeList.includes($json['for_duplication']) }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "duplicate",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7cdabbfc-6a66-4f28-a2cf-781fe145faca",
                    "operator": {
                      "type": "boolean",
                      "operation": "false",
                      "singleValue": true
                    },
                    "leftValue": "={{ !$json.dedupeList.includes($json['for_duplication']) }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        },
        "looseTypeValidation": true
      },
      "typeVersion": 3.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "99a76ce1-eb41-4cb5-93a9-8bed26cf767d",
  "connections": {
    "1161ff82-4ceb-435a-a4ed-c2ca4f618627": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Switch based on Expense Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "559432eb-1739-49e7-9fae-9337ef843239": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "efb13bc2-bc7a-4f6a-8ec1-d783ac9c1d41",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Merge_all",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge_all": {
      "main": [
        [
          {
            "node": "Response Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "efb13bc2-bc7a-4f6a-8ec1-d783ac9c1d41": {
      "main": [
        [
          {
            "node": "ab9fbffc-cd1e-4a2c-8f5e-23ee0f844c77",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge_all",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Response Switch": {
      "main": [
        [
          {
            "node": "570de74c-b410-40ff-b7ac-781625c912a7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "570de74c-b410-40ff-b7ac-781625c912a7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "570de74c-b410-40ff-b7ac-781625c912a7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "cbadff1d-15f5-4282-a62f-b42c25b41661",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "5d153710-d3a2-42dc-a090-c4faa3390210",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cbadff1d-15f5-4282-a62f-b42c25b41661": {
      "main": [
        [
          {
            "node": "516361f7-21a9-4d9a-9f44-2bab05b9bfcb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "05789d97-3ebb-4e9f-951d-ecd54c4da404",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "8ff07d6b-6aa1-4a43-ab5a-231a4f668ca3": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab9fbffc-cd1e-4a2c-8f5e-23ee0f844c77": {
      "main": [
        [
          {
            "node": "8ff07d6b-6aa1-4a43-ab5a-231a4f668ca3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "05789d97-3ebb-4e9f-951d-ecd54c4da404": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Switch based on Expense Type": {
      "main": [
        [
          {
            "node": "559432eb-1739-49e7-9fae-9337ef843239",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1161ff82-4ceb-435a-a4ed-c2ca4f618627",
            "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é - Productivité personnelle, 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œuds25
Catégorie2
Types de nœuds11
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