{
  "name": "Agent Alternance - Email Outlook",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "cronExpression": "*/15 * * * *"
            }
          ]
        }
      },
      "id": "cron-trigger-outlook",
      "name": "D\u00e9clencheur Test (15min)",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        240,
        240
      ]
    },
    {
      "parameters": {
        "functionCode": "// G\u00e9n\u00e9rateur de donn\u00e9es test\nconst offers = [\n  {\n    title: \"Alternance Cybers\u00e9curit\u00e9 - SOC Analyst\",\n    company: \"CyberTech Solutions\",\n    location: \"Paris (75)\",\n    duration: \"24 mois\",\n    start_date: \"septembre 2025\",\n    description: \"Poste d'alternant SOC analyst. Formation Master cybers\u00e9curit\u00e9. Missions: surveillance, incidents, rapports.\",\n    url: \"https://pole-emploi.fr/offre/123456\",\n    scraper_source: \"pole_emploi\",\n    ai_response: \"VALIDE\",\n    is_valid: true,\n    status: \"\u2705 VALID\u00c9E\",\n    processed_at: new Date().toISOString()\n  },\n  {\n    title: \"Alternance DevSecOps Junior\",\n    company: \"SecureIT Corp\",\n    location: \"Lyon (69)\",\n    duration: \"18 mois\",\n    start_date: \"octobre 2025\",\n    description: \"Alternance DevSecOps. Automatisation s\u00e9curit\u00e9, CI/CD s\u00e9curis\u00e9, infrastructure.\",\n    url: \"https://apec.fr/offre/789012\",\n    scraper_source: \"apec\",\n    ai_response: \"VALIDE\",\n    is_valid: true,\n    status: \"\u2705 VALID\u00c9E\",\n    processed_at: new Date().toISOString()\n  }\n];\n\nconsole.log(`\ud83d\udccb G\u00e9n\u00e9ration de ${offers.length} offres pour test email`);\n\nreturn offers.map(offer => ({ json: offer }));"
      },
      "id": "data-simple",
      "name": "Donn\u00e9es Test",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        460,
        240
      ]
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "offres_validees",
        "options": {}
      },
      "id": "aggregate-simple",
      "name": "Agr\u00e9ger",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        680,
        240
      ]
    },
    {
      "parameters": {
        "functionCode": "// Rapport simple pour email\nconst offers = $json.offres_validees || [];\nconst timestamp = new Date().toLocaleDateString('fr-FR');\n\nconst emailContent = `Bonjour,\n\nRapport alternance cybers\u00e9curit\u00e9 du ${timestamp}\n\n\u2705 ${offers.length} offres valid\u00e9es:\n\n${offers.map((offer, i) => `${i+1}. ${offer.title}\n   \ud83c\udfe2 ${offer.company}\n   \ud83d\udccd ${offer.location}\n   \ud83d\udd17 ${offer.url}\n   \u23f1\ufe0f ${offer.duration}\n`).join('\\n')}\n\nCordialement,\nAgent IA Alternance`;\n\nconst result = {\n  email_subject: `\ud83c\udfaf ${offers.length} Offres Alternance - ${timestamp}`,\n  email_text: emailContent,\n  total_offres: offers.length\n};\n\nconsole.log('\ud83d\udce7 Email pr\u00e9par\u00e9:', result.email_subject);\n\nreturn [{ json: result }];"
      },
      "id": "prepare-email",
      "name": "Pr\u00e9parer Email",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        900,
        240
      ]
    },
    {
      "parameters": {
        "fromEmail": "test@outlook.com",
        "toEmail": "bigmoletos@yopmail.com",
        "subject": "={{ $json.email_subject }}",
        "text": "={{ $json.email_text }}",
        "options": {}
      },
      "id": "send-email-outlook",
      "name": "Envoyer Email (Outlook)",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "position": [
        1120,
        240
      ],
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "D\u00e9clencheur Test (15min)": {
      "main": [
        [
          {
            "node": "Donn\u00e9es Test",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Donn\u00e9es Test": {
      "main": [
        [
          {
            "node": "Agr\u00e9ger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agr\u00e9ger": {
      "main": [
        [
          {
            "node": "Pr\u00e9parer Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pr\u00e9parer Email": {
      "main": [
        [
          {
            "node": "Envoyer Email (Outlook)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "id": "outlook-email",
      "name": "Outlook Email"
    }
  ],
  "triggerCount": 1
}