De données non structurées à des données structurées
Ceci est unDocument Extraction, AI Summarizationworkflow d'automatisation du domainecontenant 16 nœuds.Utilise principalement des nœuds comme DataTable, GmailTrigger, DataTableTool, EmailReadImap, Agent. Plan d'action : traitement des sources de messagerie et tableaux de données avec des modèles OpenAI
- •Compte Google et informations d'identification Gmail API
- •Clé API OpenAI
- •Clé API Google Gemini
Nœuds utilisés (16)
Catégorie
{
"id": "zGGBdrGLXA50cO1A",
"meta": {
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
"templateCredsSetupCompleted": true
},
"name": "From Unstructured Data To Structured Data",
"tags": [],
"nodes": [
{
"id": "97cce9f4-cb8e-4ea7-872b-e1f8054afc3a",
"name": "Déclencheur Gmail",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-480,
-224
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "nyuHvSX5HuqfMPlW",
"name": "Gmail account (n3w.it)"
}
},
"typeVersion": 1.3
},
{
"id": "13fffb5b-724c-4adf-8c99-5e16f10a5324",
"name": "Modèle de chat OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-112,
160
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "TefveNaDaMERl1hY",
"name": "OpenAi account (Eure)"
}
},
"typeVersion": 1.2
},
{
"id": "90d9983b-b4a6-427f-970c-388bae72fb1f",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
128,
160
],
"parameters": {
"autoFix": true,
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"from\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"to\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"subject\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"summarize\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
},
"typeVersion": 1.3
},
{
"id": "1165ea37-01f5-4835-b04d-c91395519e04",
"name": "Modèle de chat OpenAI1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
80,
336
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "TefveNaDaMERl1hY",
"name": "OpenAi account (Eure)"
}
},
"typeVersion": 1.2
},
{
"id": "481c0914-84c3-4c5f-9247-ec709bf18e53",
"name": "Insert row",
"type": "n8n-nodes-base.dataTable",
"position": [
288,
-64
],
"parameters": {
"columns": {
"value": {
"To": "={{ $json.output.to }}",
"From": "={{ $json.output.from }}",
"Subject": "={{ $json.output.subject }}",
"Summary": "={{ $json.output.summarize }}"
},
"schema": [
{
"id": "From",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "From",
"defaultMatch": false
},
{
"id": "Subject",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Subject",
"defaultMatch": false
},
{
"id": "Summary",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Summary",
"defaultMatch": false
},
{
"id": "To",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "To",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "LZKeHWCZU60XbKyM",
"cachedResultUrl": "/projects/mfFxBtuhQcXKlWHw/datatables/LZKeHWCZU60XbKyM",
"cachedResultName": "Email output parser"
}
},
"typeVersion": 1
},
{
"id": "ca682a7e-9630-4c8b-b8eb-17f557354eb8",
"name": "Déclencheur d'e-mail (IMAP)",
"type": "n8n-nodes-base.emailReadImap",
"position": [
-480,
-64
],
"parameters": {
"options": {}
},
"credentials": {
"imap": {
"id": "k31W9oGddl9pMDy4",
"name": "IMAP info@n3witalia.com"
}
},
"typeVersion": 2.1
},
{
"id": "15c2dbd5-6e23-4920-843a-7ce7a43fdcf5",
"name": "Microsoft Outlook Trigger",
"type": "n8n-nodes-base.microsoftOutlookTrigger",
"position": [
-480,
80
],
"parameters": {
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "oYlYok8LYOhL04rM",
"name": "Microsoft Outlook account (dave85heat@hotmail.it)"
}
},
"typeVersion": 1
},
{
"id": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"name": "Parsing Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-64,
-64
],
"parameters": {
"text": "={{JSON.stringify($json)}}",
"options": {
"systemMessage": "=**Role:**\nYou are a data extraction and parsing agent integrated in an n8n workflow.\n\n**Goal:**\nGiven a JSON input containing one or more emails , your task is to parse and extract structured information from the email content.\n\n**Instructions:**\n\n1. Carefully read the email content provided in the `body` field of the JSON input.\n2. Identify and extract key entities and data points mentioned in the text \n3. Return the extracted data in a **clean, structured JSON format**.\n4. If specific data cannot be found, return the field as `null` instead of omitting it.\n5. Preserve the original structure of the input email list, so that each parsed result corresponds to the same email in the input array.\n6. Do not include any explanations, reasoning, or text outside of JSON.\n\n**Important:**\n\n* Be consistent with field names and data formats (use ISO 8601 for dates, plain strings for text).\n* Never return unstructured text or commentary — only valid JSON.\n* Output should always be a JSON array of parsed objects."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "b0d03646-57f1-4eb0-8f1c-3c27c3900466",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
-512,
-928
],
"parameters": {
"color": 3,
"width": 976,
"height": 400,
"content": "## How to Transform Unstructured Email Data into Structured Format Using an AI Agent\n\nThis workflow leverages artificial intelligence to automatically transform **unstructured email data** from multiple sources — including **Gmail**, **Outlook**, and **IMAP** — into **structured** and summarized information.\n\nThe workflow retrieves incoming emails and sends their content to an **AI agent** specifically designed to parse and interpret unstructured text. The agent extracts key metadata and insights from each message, including:\n\n* **From** – the sender’s email address\n* **To** – the recipient’s email address\n* **Subject** – the subject line of the email\n* **Summarize** – a concise summary of the email body generated by the AI\n\nOnce processed, the structured output is stored in a **database table**. This allows for easy indexing, reporting, and integration with other business systems.\n\nBy automating this process, the flow ensures consistent, searchable, and easily digestible information from diverse email sources significantly reducing manual review and improving workflow efficiency."
},
"typeVersion": 1
},
{
"id": "17751b90-4db6-45d7-b426-db157e1199db",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-512,
-512
],
"parameters": {
"width": 480,
"height": 176,
"content": "## STEP 1\nCreata a n8n table with the following fields:\n- From\n- To\n- Subject\n- Summary"
},
"typeVersion": 1
},
{
"id": "fc864e0b-f04e-4996-a012-fbe7ad52dc6b",
"name": "Note adhésive2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
-512
],
"parameters": {
"width": 480,
"height": 176,
"content": "## STEP 2\nConnect triggers from different sources:\n- Gmail\n- Outlook\n- Imap"
},
"typeVersion": 1
},
{
"id": "ebabb739-ecb9-450b-abb5-1d27d6a95832",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
96
],
"parameters": {
"width": 272,
"height": 176,
"content": "Set the structured data from json"
},
"typeVersion": 1
},
{
"id": "84b10b19-a1a2-4fac-b791-8ef5aa1160c6",
"name": "À la réception du message",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
576,
-64
],
"webhookId": "cd94eebb-fa9b-4b7e-b4ed-09ddfd80fbf0",
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "e846ffd6-7ee5-4486-9f6d-a73f349814b9",
"name": "E-mail Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
880,
-64
],
"parameters": {
"options": {
"systemMessage": "You are a helpful assistant.\n\nUse always the \"Emails\" tool to search for the request."
}
},
"typeVersion": 2.2
},
{
"id": "c833e8c1-68d5-421c-9f71-0d928b14ad19",
"name": "E-mails",
"type": "n8n-nodes-base.dataTableTool",
"position": [
1056,
160
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "From",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions0_Value', `Search the emails sent from`, 'string') }}",
"condition": "ilike"
},
{
"keyName": "Subject",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions1_Value', `Search the emails with these subject`, 'string') }}",
"condition": "ilike"
},
{
"keyName": "To",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions2_Value', `Search the emails sent to`, 'string') }}",
"condition": "ilike"
},
{
"keyName": "Summary",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions3_Value', `Search the emails with these summaries`, 'string') }}",
"condition": "ilike"
}
]
},
"operation": "get",
"returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "LZKeHWCZU60XbKyM",
"cachedResultUrl": "/projects/mfFxBtuhQcXKlWHw/datatables/LZKeHWCZU60XbKyM",
"cachedResultName": "Email output parser"
}
},
"typeVersion": 1
},
{
"id": "16feafab-fa9e-4acb-85b5-cd04e6b621d0",
"name": "Modèle de chat Google Gemini",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
800,
144
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "0p34rXqIqy8WuoPg",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "7527b0d6-cf52-4bd1-81d5-ad39002dda1f",
"connections": {
"Emails": {
"ai_tool": [
[
{
"node": "Email Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"type": "main",
"index": 0
}
]
]
},
"04dc1bd7-6ecb-457f-835b-e67b910e30ad": {
"main": [
[
{
"node": "481c0914-84c3-4c5f-9247-ec709bf18e53",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "90d9983b-b4a6-427f-970c-388bae72fb1f",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Email Trigger (IMAP)": {
"main": [
[
{
"node": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Email Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"90d9983b-b4a6-427f-970c-388bae72fb1f": {
"ai_outputParser": [
[
{
"node": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"15c2dbd5-6e23-4920-843a-7ce7a43fdcf5": {
"main": [
[
{
"node": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Email Agent",
"type": "main",
"index": 0
}
]
]
}
}
}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é - Extraction de documents, 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.
Workflows recommandés
Davide
@n3witaliaFull-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza
Partager ce workflow