Résumé quotidien d'actualités positives avec OpenAI et Gmail

Intermédiaire

Ceci est unPersonal Productivity, AI Summarizationworkflow d'automatisation du domainecontenant 9 nœuds.Utilise principalement des nœuds comme If, Cron, Gmail, OpenAi, RssFeed. Résumé quotidien de bonnes nouvelles avec OpenAI et Gmail

Prérequis
  • Compte Google et informations d'identification Gmail 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
{
  "nodes": [
    {
      "name": "Déclencheur Quotidien Matinal (7h)",
      "type": "n8n-nodes-base.cron",
      "notes": {
        "text": "### 1. Daily Morning Trigger (7 AM)\n\nThis `Cron` node triggers the workflow automatically every **day at 7:00 AM** (based on your n8n server's local time zone).\n\n**To change the schedule:** Adjust the 'Hour' and 'Minute' fields to your preferred time for receiving the news digest.",
        "position": "right"
      },
      "position": [
        240,
        300
      ],
      "parameters": {
        "mode": "everyDay",
        "value": {
          "hour": [
            7
          ],
          "minute": [
            0
          ]
        },
        "options": {}
      },
      "typeVersion": 1,
      "id": "D-clencheur-Quotidien-Matinal-7h--0"
    },
    {
      "name": "Récupérer les Actualités Positives (RSS)",
      "type": "n8n-nodes-base.rssFeed",
      "notes": {
        "text": "### 2. Fetch Positive News (RSS)\n\nThis `RSS Feed` node fetches the latest articles from the Good News Network, a reliable source for positive stories.\n\n**Setup:**\n1.  **URL:** Pre-filled with `https://www.goodnewsnetwork.org/feed/`.\n2.  **To add more sources:** You can add more `RSS Feed` nodes in parallel and then use an `Item Lists` node set to 'Merge Items' to combine their outputs before the 'Prepare for AI' node.",
        "position": "right"
      },
      "position": [
        480,
        300
      ],
      "parameters": {
        "url": "https://www.goodnewsnetwork.org/feed/",
        "options": {}
      },
      "typeVersion": 1,
      "id": "R-cup-rer-les-Actualit-s-Positives-RSS--1"
    },
    {
      "name": "Préparation pour l'IA",
      "type": "n8n-nodes-base.function",
      "notes": {
        "text": "### 3. Prepare for AI\n\nThis `Function` node formats the news articles' titles and descriptions into a single `articleText` field, which is easier for the AI to process.\n\nIt also preserves the original title, description, and link for the final summary.\n\n**No configuration needed**; it automatically processes the RSS feed items.",
        "position": "right"
      },
      "position": [
        720,
        300
      ],
      "parameters": {
        "options": {},
        "function": "const preparedItems = [];\n\nfor (const item of items) {\n  const title = item.json.title || 'No Title';\n  const description = item.json.contentSnippet || item.json.description || 'No Description';\n  const link = item.json.link || '#';\n\n  preparedItems.push({\n    json: {\n      originalTitle: title,\n      originalDescription: description,\n      originalLink: link,\n      articleText: `Title: ${title}\\nDescription: ${description}`\n    }\n  });\n}\n\nreturn preparedItems;"
      },
      "typeVersion": 1,
      "id": "Pr-paration-pour-l-IA-2"
    },
    {
      "name": "IA : Résumer les Actualités Positives",
      "type": "n8n-nodes-base.openAi",
      "notes": {
        "text": "### 4. AI: Summarize Positive News\n\nThis `OpenAI` node is the core of the 'positive news' filtering and summarization.\n\n**Setup:**\n1.  **OpenAI Credential:** Click 'Credentials' and select 'New Credential'. Provide your OpenAI API Key (starts with `sk-`). Save it.\n2.  **Model:** `gpt-3.5-turbo` is pre-selected. For higher quality summaries and better sentiment discernment, consider `gpt-4o` (may incur higher costs).\n3.  **Prompts:** The 'System' prompt guides the AI to only summarize positive/neutral-to-positive articles and output 'SKIP' otherwise.\n\n**Output:** The AI's summary or the word 'SKIP'.",
        "position": "right"
      },
      "position": [
        960,
        300
      ],
      "parameters": {
        "model": "gpt-3.5-turbo",
        "options": {},
        "messages": [
          {
            "role": "system",
            "content": "You are a news summarizer focused only on positive and uplifting news. Read the provided article text. If it is clearly positive or neutral-to-positive, summarize its core message in 2-3 concise sentences, focusing on the positive aspects. If it is negative, neutral, or not news (e.g., ads), output the single word 'SKIP'."
          },
          {
            "role": "user",
            "content": "Article:\n{{ $json.articleText }}"
          }
        ]
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "resolve": false
        }
      },
      "typeVersion": 1,
      "id": "IA-R-sumer-les-Actualit-s-Positives-3"
    },
    {
      "name": "Filtrer et Préparer les Résumés Positifs",
      "type": "n8n-nodes-base.function",
      "notes": {
        "text": "### 5. Filter & Prepare Positive Summaries\n\nThis `Function` node filters out any items where the AI responded with 'SKIP' (meaning the news was not positive enough).\n\nFor the remaining items, it prepares a clean object containing the original title, link, and the AI-generated positive summary.\n\n**No configuration needed**; it automatically processes the AI output.",
        "position": "right"
      },
      "position": [
        1200,
        300
      ],
      "parameters": {
        "options": {},
        "function": "const positiveSummaries = [];\n\nfor (const item of items) {\n  const aiResponse = item.json.choices[0].message.content.trim();\n\n  if (aiResponse.toUpperCase() !== 'SKIP') {\n    positiveSummaries.push({\n      json: {\n        originalTitle: item.json.originalTitle,\n        originalLink: item.json.originalLink,\n        summary: aiResponse\n      }\n    });\n  }\n}\n\nreturn positiveSummaries;"
      },
      "typeVersion": 1,
      "id": "Filtrer-et-Pr-parer-les-R-sum-s-Positifs-4"
    },
    {
      "name": "Si Actualités Positives Trouvées",
      "type": "n8n-nodes-base.if",
      "notes": {
        "text": "### 6. If Positive News Found\n\nThis `If` node checks if any positive news articles were actually found and summarized after filtering.\n\n* **'True' branch:** If positive news exists, the workflow proceeds to format and send the email.\n* **'False' branch:** If no positive news was found for the day, the workflow will still send an email, but with a message indicating no positive news was found (handled by the 'Format No Positive News Message' node).\n\n**No configuration needed**; it checks if the array of items is not empty.",
        "position": "right"
      },
      "position": [
        1440,
        300
      ],
      "parameters": {
        "conditions": [
          {
            "value1": "={{ $json.length }}",
            "value2": "0",
            "operation": "notEqual"
          }
        ]
      },
      "typeVersion": 1,
      "id": "Si-Actualit-s-Positives-Trouv-es-5"
    },
    {
      "name": "Formater l'E-mail d'Actualités Positives",
      "type": "n8n-nodes-base.function",
      "notes": {
        "text": "### 7. Format Positive News Email\n\nThis `Function` node compiles all the positive news summaries into a single, formatted email body.\n\n**Customization:**\n* You can customize the greeting, closing, and the way each news item is presented.\n* The email body is formatted using Markdown for bolding and line breaks, which Gmail supports.\n\n**No configuration needed** if your previous node's output matches expectations.",
        "position": "right"
      },
      "position": [
        1680,
        220
      ],
      "parameters": {
        "options": {},
        "function": "let emailBody = \"\";\n\nemailBody += \"Good morning! Here's your daily dose of positive news:\\n\\n\";\n\nfor (const item of items) {\n  emailBody += `**${item.json.originalTitle}**\\n` +\n               `${item.json.summary}\\n` +\n               `Read more: ${item.json.originalLink}\\n\\n---\\n\\n`;\n}\n\nemailBody += \"Have a wonderful day!\\n\\nThis digest was brought to you by n8n.\";\n\nreturn [{ json: { emailSubject: \"☀️ Your Daily Positive News Digest!\", emailBody: emailBody } }];"
      },
      "typeVersion": 1,
      "id": "Formater-l-E-mail-d-Actualit-s-Positives-6"
    },
    {
      "name": "Formater le Message d'Aucune Actualité Positive",
      "type": "n8n-nodes-base.function",
      "notes": {
        "text": "### 7. Format No Positive News Message\n\nThis `Function` node creates a fallback message for your email if the workflow doesn't find any positive news articles after filtering.\n\n**No configuration needed**; it provides a default message when there's no positive news.",
        "position": "right"
      },
      "position": [
        1680,
        380
      ],
      "parameters": {
        "options": {},
        "function": "return [{ json: { emailSubject: \"☁️ Daily Positive News Digest: No Positive News Today\", emailBody: \"Good morning!\\n\\nUnfortunately, I couldn't find any predominantly positive news articles for your digest today.\\n\\nStay positive, and check back tomorrow!\\n\\nThis digest was brought to you by n8n.\" } }];"
      },
      "typeVersion": 1,
      "id": "Formater-le-Message-d-Aucune-Actualit-Positive-7"
    },
    {
      "name": "Envoyer l'E-mail de Synthèse Quotidienne",
      "type": "n8n-nodes-base.gmail",
      "notes": {
        "text": "### 8. Send Daily Digest Email\n\nThis `Gmail` node sends the final email digest (either with positive news or the 'no news found' message) to your mailbox.\n\n**Setup:**\n1.  **Gmail Credential:** Select your Gmail API credential.\n2.  **From Email:** Enter your Gmail address (must match the authenticated account).\n3.  **To Email:** **IMPORTANT: Change `YOUR_RECIPIENT_EMAIL@example.com` to your actual email address!**\n4.  **Subject & Text:** These fields pull the formatted subject and body from the previous 'Format' nodes.\n\n**Test this node by running the workflow** to ensure you receive the email.",
        "position": "right"
      },
      "position": [
        1920,
        300
      ],
      "parameters": {
        "text": "={{ $json.emailBody }}",
        "options": {},
        "subject": "={{ $json.emailSubject }}",
        "toEmail": "YOUR_RECIPIENT_EMAIL@example.com",
        "fromEmail": "YOUR_GMAIL_EMAIL@gmail.com"
      },
      "credentials": {
        "gmailApi": {
          "id": "YOUR_GMAIL_CREDENTIAL_ID",
          "resolve": false
        }
      },
      "typeVersion": 2,
      "id": "Envoyer-l-E-mail-de-Synth-se-Quotidienne-8"
    }
  ],
  "pinData": {},
  "version": 1,
  "connections": {
    "Pr-paration-pour-l-IA-2": {
      "main": [
        [
          {
            "node": "IA-R-sumer-les-Actualit-s-Positives-3",
            "type": "main"
          }
        ]
      ]
    },
    "Si-Actualit-s-Positives-Trouv-es-5": {
      "main": [
        [
          {
            "node": "Formater-l-E-mail-d-Actualit-s-Positives-6",
            "type": "main"
          }
        ],
        [
          {
            "node": "Formater-le-Message-d-Aucune-Actualit-Positive-7",
            "type": "main"
          }
        ]
      ]
    },
    "R-cup-rer-les-Actualit-s-Positives-RSS--1": {
      "main": [
        [
          {
            "node": "Pr-paration-pour-l-IA-2",
            "type": "main"
          }
        ]
      ]
    },
    "Formater-l-E-mail-d-Actualit-s-Positives-6": {
      "main": [
        [
          {
            "node": "Envoyer-l-E-mail-de-Synth-se-Quotidienne-8",
            "type": "main"
          }
        ]
      ]
    },
    "IA-R-sumer-les-Actualit-s-Positives-3": {
      "main": [
        [
          {
            "node": "Filtrer-et-Pr-parer-les-R-sum-s-Positifs-4",
            "type": "main"
          }
        ]
      ]
    },
    "D-clencheur-Quotidien-Matinal-7h--0": {
      "main": [
        [
          {
            "node": "R-cup-rer-les-Actualit-s-Positives-RSS--1",
            "type": "main"
          }
        ]
      ]
    },
    "Formater-le-Message-d-Aucune-Actualit-Positive-7": {
      "main": [
        [
          {
            "node": "Envoyer-l-E-mail-de-Synth-se-Quotidienne-8",
            "type": "main"
          }
        ]
      ]
    },
    "Filtrer-et-Pr-parer-les-R-sum-s-Positifs-4": {
      "main": [
        [
          {
            "node": "Si-Actualit-s-Positives-Trouv-es-5",
            "type": "main"
          }
        ]
      ]
    }
  }
}
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 - 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é
Intermédiaire
Nombre de nœuds9
Catégorie2
Types de nœuds6
Description de la difficulté

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

Auteur
Piotr Sobolewski

Piotr Sobolewski

@piotrsobolewski

AI PhD with 7 years experience as a game dev CEO, currently teaching, helping others and building something new.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34