Classification automatique des e-mails Outlook dans des catégories colorées avec GPT-4o

Intermédiaire

Ceci est unAI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 13 nœuds.Utilise principalement des nœuds comme Set, ManualTrigger, SplitInBatches, Agent, MicrosoftOutlook. Utiliser GPT-4o pour classer automatiquement les e-mails Outlook dans des catégories de couleur

Prérequis
  • 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
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "9ba14748-4bba-47d3-99d1-b9c4107f8a3a",
      "name": "Boucler sur les éléments1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -416,
        4128
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "d3a0b91a-00c7-4a6e-96a7-b82de25ed5fe",
      "name": "Au clic sur 'Exécuter le flux'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1312,
        4000
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f8ec514b-b64c-4bd5-bc86-91b24435cbf0",
      "name": "Obtenir les messages d'Outlook",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        -912,
        4384
      ],
      "webhookId": "b3f46aa6-f55c-420b-a444-7cd48f36f7f6",
      "parameters": {
        "limit": 5,
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "9z1nG9ReKLXU309r",
          "name": "Microsoft Outlook account 4"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e072f4a2-0f5a-44ed-8e78-6f779f70a28b",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -256,
        4528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4670e0fa-82e2-483f-9891-83bc4f04f8be",
      "name": "Analyseur de sortie structurée",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        64,
        4368
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"category\": \"Red Category, Yellow Category, or Green Category\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "3e2d22a2-c1ba-48f7-bdff-855b1106365a",
      "name": "Définir les champs de l'e-mail",
      "type": "n8n-nodes-base.set",
      "position": [
        -592,
        3984
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "83f69529-de2b-4d4e-aac9-cd88e4336c94",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            },
            {
              "id": "af0befe4-5252-4fe4-9c0a-06e207e4c9a9",
              "name": "bodyPreview",
              "type": "string",
              "value": "={{ $json.bodyPreview }}"
            },
            {
              "id": "074a3879-8b0c-4601-a1d0-3284b69fbde2",
              "name": "from",
              "type": "string",
              "value": "={{ $json.from }}"
            },
            {
              "id": "02c201fc-996e-4777-b50e-10290da09262",
              "name": "Message ID",
              "type": "string",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3fd00d0a-fed9-4a36-9146-a826ebcdd633",
      "name": "Agent de catégorisation",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -112,
        4112
      ],
      "parameters": {
        "text": "=body: {{ $json.bodyPreview }} subject: {{ $json.subject }}",
        "options": {
          "systemMessage": "You are a helpful assistant. take in the email message and determine if it is Red Category, Yellow Category, or Green Category. based on random\n\noutput data like this. \n\n{\n\t\"category\": \"Red Category, Yellow Category, or Green Category\"\n}\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "4a794da0-4294-4017-b7c7-59910e8f18d4",
      "name": "Définir la catégorie et l'ID",
      "type": "n8n-nodes-base.set",
      "position": [
        -112,
        3920
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "85cc4512-3af8-400a-8814-2bdb75739321",
              "name": "output.category",
              "type": "string",
              "value": "={{ $json.output.category }}"
            },
            {
              "id": "d3fdc30b-9322-472c-b0ca-decb9cdd29bb",
              "name": "id",
              "type": "string",
              "value": "={{ $('Get Messages from Outlook').item.json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "27d99566-af49-42f3-808f-cafe530f6217",
      "name": "Mettre à jour la catégorie",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        144,
        3904
      ],
      "webhookId": "714959f9-3d6f-42d1-a93a-9b0db0c50950",
      "parameters": {
        "messageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "operation": "update",
        "updateFields": {
          "categories": "={{ [$json.output.category] }}"
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "9z1nG9ReKLXU309r",
          "name": "Microsoft Outlook account 4"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f25951d2-935a-4b7b-b00b-53f08a82513a",
      "name": "Note adhésive54",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        4336
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 304,
        "content": "### 2️⃣ Set Up OpenAI Connection\n1. Go to [OpenAI Platform](https://platform.openai.com/api-keys)  \n2. Navigate to [OpenAI Billing](https://platform.openai.com/settings/organization/billing/overview)  \n3. Add funds to your billing account  \n4. Copy your API key into the **OpenAI credentials** in n8n  "
      },
      "typeVersion": 1
    },
    {
      "id": "4fb6ac63-881f-4740-8abc-404ac65d093a",
      "name": "Note adhésive24",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        4160
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 336,
        "content": "### 2️⃣ Set Up Outlook Connection\n1. In n8n → **Credentials → New → Microsoft Outlook OAuth2 API**  \n2. Log in with your Outlook account & approve access  \n3. Attach this credential to the **Search Outlook** node in the workflow  \n4. (Optional) Change the `limit` parameter in the node if you want more/less than 5 results "
      },
      "typeVersion": 1
    },
    {
      "id": "c4449b1f-301c-4a6a-b7d8-56d65f20911c",
      "name": "Note adhésive21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        3792
      ],
      "parameters": {
        "width": 400,
        "height": 928,
        "content": "\n## ⚙️ Setup Instructions\n\n### 1️⃣ Set Up Outlook Connection\n1. In n8n → **Credentials → New → Microsoft Outlook OAuth2 API**  \n2. Log in with your Outlook account & approve access  \n3. Attach this credential to the **Get Messages from Outlook** and **Update Category** nodes in the workflow  \n4. (Optional) Adjust the **limit** field in **Get Messages from Outlook** if you want more/less than 5 results  \n\n---\n\n### 2️⃣ Set Up OpenAI Connection\n1. Go to the **[OpenAI Platform](https://platform.openai.com/api-keys)**  \n2. Navigate to **[OpenAI Billing](https://platform.openai.com/settings/organization/billing/overview)**  \n3. Add funds to your billing account  \n4. Copy your API key into the **OpenAI** credentials in n8n and select it on the **OpenAI Chat Model** and **Categorizing Agent** nodes  \n\n\n- 📧 **robert@ynteractive.com**  \n- 🔗 **[Robert Breen](https://www.linkedin.com/in/robert-breen-29429625/)**  \n- 🌐 **[ynteractive.com](https://ynteractive.com)**\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1f45d710-c178-48de-baf3-6da87661b64e",
      "name": "Note adhésive22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1456,
        3792
      ],
      "parameters": {
        "color": 7,
        "width": 1936,
        "height": 928,
        "content": "# 📧 Auto-Categorize Outlook Emails with OpenAI (n8n)\n\nThis workflow fetches recent emails from Outlook and uses OpenAI to assign a category (e.g., **Red**, **Yellow**, **Green**). It then updates each message’s category in Outlook.\n\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "9ba14748-4bba-47d3-99d1-b9c4107f8a3a": {
      "main": [
        [
          {
            "node": "4a794da0-4294-4017-b7c7-59910e8f18d4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3fd00d0a-fed9-4a36-9146-a826ebcdd633",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3fd00d0a-fed9-4a36-9146-a826ebcdd633": {
      "main": [
        [
          {
            "node": "9ba14748-4bba-47d3-99d1-b9c4107f8a3a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e072f4a2-0f5a-44ed-8e78-6f779f70a28b": {
      "ai_languageModel": [
        [
          {
            "node": "3fd00d0a-fed9-4a36-9146-a826ebcdd633",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "4a794da0-4294-4017-b7c7-59910e8f18d4": {
      "main": [
        [
          {
            "node": "27d99566-af49-42f3-808f-cafe530f6217",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3e2d22a2-c1ba-48f7-bdff-855b1106365a": {
      "main": [
        [
          {
            "node": "9ba14748-4bba-47d3-99d1-b9c4107f8a3a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4670e0fa-82e2-483f-9891-83bc4f04f8be": {
      "ai_outputParser": [
        [
          {
            "node": "3fd00d0a-fed9-4a36-9146-a826ebcdd633",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "f8ec514b-b64c-4bd5-bc86-91b24435cbf0": {
      "main": [
        [
          {
            "node": "3e2d22a2-c1ba-48f7-bdff-855b1106365a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3a0b91a-00c7-4a6e-96a7-b82de25ed5fe": {
      "main": [
        [
          {
            "node": "f8ec514b-b64c-4bd5-bc86-91b24435cbf0",
            "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é ?

Intermédiaire - Résumé IA, IA Multimodale

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é
Intermédiaire
Nombre de nœuds13
Catégorie2
Types de nœuds8
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34