Bot de résumé et de synthèse quotidienne des e-mails

Intermédiaire

Ceci est uncontenant 14 nœuds.Utilise principalement des nœuds comme If, Code, Gmail, Slack, Aggregate. Résumé automatisé des e-mails de Gmail vers Slack avec un résumé GPT-4o

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Token Bot Slack ou URL Webhook

Catégorie

-
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": "pjLIqJYyE8diFDeq",
  "meta": {
    "instanceId": "7036f994fcf077f382ea0edc134b49e1ce0556fa914b12051651961e7fbc3600",
    "templateCredsSetupCompleted": true
  },
  "name": "Daily Email Digest and Summary Bot",
  "tags": [],
  "nodes": [
    {
      "id": "b098a164-6c8a-4d51-9876-cfbde2e5da76",
      "name": "Déclencheur Planifié",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        272
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 0 8 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2aa30690-0b1b-49eb-bae4-eb3c48bc840c",
      "name": "Note Adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -80
      ],
      "parameters": {
        "height": 304,
        "content": "## Daily Email Digest Workflow\nThis workflow runs daily at 8 AM to analyze yesterday's emails and send a summary to Slack.\n\n**Setup Required:**\n- Configure Gmail credentials\n- Configure Slack credentials\n- Adjust schedule time if needed"
      },
      "typeVersion": 1
    },
    {
      "id": "90dcdae6-5d2b-496f-8774-ee8d377bbd5a",
      "name": "Gmail - Obtenir les Emails d'Hier",
      "type": "n8n-nodes-base.gmail",
      "position": [
        192,
        272
      ],
      "webhookId": "98420742-a7f3-4dde-8070-95c939a516a2",
      "parameters": {
        "filters": {
          "receivedAfter": "={{ $now.minus({days: 1}).startOf('day').toISO() }}",
          "receivedBefore": "={{ $now.startOf('day').toISO() }}"
        },
        "operation": "getAll"
      },
      "typeVersion": 2.1
    },
    {
      "id": "96501595-c231-4d53-b028-cbe0915b0a5c",
      "name": "Note Adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        464
      ],
      "parameters": {
        "color": 7,
        "height": 256,
        "content": "## Gmail Configuration\nRetrieves all emails from the previous day (midnight to midnight).\n\n**Credentials needed:**\n- Gmail OAuth2 connection\n- Grant necessary permissions for reading emails"
      },
      "typeVersion": 1
    },
    {
      "id": "5fa53f71-b724-489b-8492-767fdd972a26",
      "name": "Agent IA - Analyser les Emails",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        864,
        176
      ],
      "parameters": {
        "text": "=Analyze these emails from yesterday and create a concise daily digest summary:\n\nEmails to analyze:\n{{ JSON.stringify($json) }}\n\nCreate a structured summary that includes:\n1. Total number of emails received\n2. Important/urgent emails (if any)\n3. Key messages grouped by sender or topic\n4. Action items or requests that need attention\n5. Brief overview of main topics discussed\n\nFormat the output as a clean, readable summary suitable for Slack.",
        "options": {
          "systemMessage": "You are an intelligent email assistant that analyzes emails and creates concise, well-organized daily digest summaries. Focus on extracting the most important information, action items, and key messages. Group related emails together and highlight urgent matters. Keep the summary concise but comprehensive."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "888291d6-3791-4a85-bfba-39d00acced61",
      "name": "Modèle de Chat OpenRouter",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        864,
        400
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {
          "maxTokens": 2000,
          "temperature": 0.3
        }
      },
      "typeVersion": 1
    },
    {
      "id": "23577fe9-3338-4167-9edf-0acc4a77c5a0",
      "name": "Analyseur de Sortie Structurée",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1008,
        400
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"summary\": {\n      \"type\": \"string\",\n      \"description\": \"The complete daily email digest summary formatted for Slack\"\n    },\n    \"emailCount\": {\n      \"type\": \"number\",\n      \"description\": \"Total number of emails analyzed\"\n    },\n    \"urgentItems\": {\n      \"type\": \"array\",\n      \"description\": \"List of urgent or important items\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"actionItems\": {\n      \"type\": \"array\",\n      \"description\": \"List of action items or tasks\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  },\n  \"required\": [\"summary\", \"emailCount\"]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "d0ad860d-14d4-47f2-afef-4922e3bdf53e",
      "name": "Note Adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        560
      ],
      "parameters": {
        "color": 7,
        "height": 240,
        "content": "## AI Processing\nThe AI Agent analyzes all emails from yesterday and creates a structured summary.\n\n**OpenRouter Credentials needed:**\n- API key from OpenRouter\n- Model: GPT-4o-mini for cost efficiency"
      },
      "typeVersion": 1
    },
    {
      "id": "ec852ebf-1b9a-43a5-90c1-9f972bc101ad",
      "name": "Formater pour Slack",
      "type": "n8n-nodes-base.code",
      "position": [
        1216,
        176
      ],
      "parameters": {
        "jsCode": "// Format the AI summary for Slack\nconst output = $input.first().json.output;\nconst today = new Date().toLocaleDateString('en-US', { \n  weekday: 'long', \n  year: 'numeric', \n  month: 'long', \n  day: 'numeric' \n});\n\nlet slackMessage = `:email: *Daily Email Digest for ${today}*\\n\\n`;\nslackMessage += `*Total Emails Analyzed:* ${output.emailCount}\\n\\n`;\n\nif (output.urgentItems && output.urgentItems.length > 0) {\n  slackMessage += `:warning: *Urgent Items:*\\n`;\n  output.urgentItems.forEach(item => {\n    slackMessage += `• ${item}\\n`;\n  });\n  slackMessage += `\\n`;\n}\n\nif (output.actionItems && output.actionItems.length > 0) {\n  slackMessage += `:clipboard: *Action Items:*\\n`;\n  output.actionItems.forEach(item => {\n    slackMessage += `• ${item}\\n`;\n  });\n  slackMessage += `\\n`;\n}\n\nslackMessage += `:memo: *Summary:*\\n${output.summary}`;\n\nreturn {\n  message: slackMessage,\n  emailCount: output.emailCount\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "1e20a30b-a265-47ac-850a-1b4ff962e271",
      "name": "Slack - Envoyer le Résumé",
      "type": "n8n-nodes-base.slack",
      "position": [
        1440,
        176
      ],
      "webhookId": "970ab742-56bc-451d-9e29-85971c4d5328",
      "parameters": {
        "text": "={{ $json.message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09L12N8F45",
          "cachedResultName": "test"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.2
    },
    {
      "id": "4f1132de-0ac8-49e1-a0c5-a4dbff364a08",
      "name": "Note Adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        336
      ],
      "parameters": {
        "color": 7,
        "height": 352,
        "content": "## Slack Configuration\nSends the formatted daily digest to your Slack channel.\n\n**Setup Required:**\n1. Configure Slack OAuth2 credentials\n2. Select the target channel (default: #general)\n3. Grant bot permissions to post messages\n\n**Note:** Adjust the channel name to your preference"
      },
      "typeVersion": 1
    },
    {
      "id": "b116a4a7-eb4d-43c7-99ef-f0f55d985273",
      "name": "Listes d'Éléments",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        640,
        176
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "ccf5813b-4e0c-476c-99df-fae172256d3c",
      "name": "Si",
      "type": "n8n-nodes-base.if",
      "position": [
        416,
        272
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ee3a0b33-70b2-482a-9d3b-3dfe751952e8",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $items().length }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "eb88744e-7214-4c49-975e-525d0bf3614b",
      "name": "Slack - Aucun Email",
      "type": "n8n-nodes-base.slack",
      "position": [
        640,
        368
      ],
      "webhookId": "4f76c067-fbbd-4527-956c-72778225a4a7",
      "parameters": {
        "text": "=*:email: Daily Email Digest — No emails*\nTarget date (JST): {{$now.setZone('Asia/Tokyo').minus({days:1}).toFormat('yyyy-LL-dd (ccc)')}}\nNo emails were found for yesterday. The next digest will run as scheduled.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09L12N8F45",
          "cachedResultName": "test"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "E2fdCmZVIRZ1HURh",
    "executionOrder": "v1"
  },
  "versionId": "3509e277-92f9-4748-8272-2ff915f900c6",
  "connections": {
    "ccf5813b-4e0c-476c-99df-fae172256d3c": {
      "main": [
        [
          {
            "node": "b116a4a7-eb4d-43c7-99ef-f0f55d985273",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "eb88744e-7214-4c49-975e-525d0bf3614b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b116a4a7-eb4d-43c7-99ef-f0f55d985273": {
      "main": [
        [
          {
            "node": "5fa53f71-b724-489b-8492-767fdd972a26",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec852ebf-1b9a-43a5-90c1-9f972bc101ad": {
      "main": [
        [
          {
            "node": "1e20a30b-a265-47ac-850a-1b4ff962e271",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b098a164-6c8a-4d51-9876-cfbde2e5da76": {
      "main": [
        [
          {
            "node": "90dcdae6-5d2b-496f-8774-ee8d377bbd5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "888291d6-3791-4a85-bfba-39d00acced61": {
      "ai_languageModel": [
        [
          {
            "node": "5fa53f71-b724-489b-8492-767fdd972a26",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "23577fe9-3338-4167-9edf-0acc4a77c5a0": {
      "ai_outputParser": [
        [
          {
            "node": "5fa53f71-b724-489b-8492-767fdd972a26",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "5fa53f71-b724-489b-8492-767fdd972a26": {
      "main": [
        [
          {
            "node": "ec852ebf-1b9a-43a5-90c1-9f972bc101ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "90dcdae6-5d2b-496f-8774-ee8d377bbd5a": {
      "main": [
        [
          {
            "node": "ccf5813b-4e0c-476c-99df-fae172256d3c",
            "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

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œuds14
Catégorie-
Types de nœuds10
Description de la difficulté

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

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34