{
  "name": "Automated weekly security audit reports with Gmail delivery",
  "nodes": [
    {
      "id": "628f28dc-b550-4501-b3f7-656756a84f0b",
      "name": "Set Config Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        -1552,
        64
      ]
    },
    {
      "id": "29de9117-4e5d-42c0-b2bb-b12b37cd6bf4",
      "name": "Send Gmail (HTML)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        0,
        64
      ]
    },
    {
      "id": "3de2498a-7b6d-4971-aaa5-01c708e9a7a6",
      "name": "Schedule Trigger (Weekly)",
      "type": "n8n-nodes-base.cron",
      "position": [
        -1808,
        64
      ]
    },
    {
      "id": "57015778-7300-4c12-b7f2-c795b7316d59",
      "name": "Generate a security audit",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -1280,
        64
      ]
    },
    {
      "id": "fec96d1e-e966-4fcc-9900-9a8d32211008",
      "name": "Format Audit Report - FR",
      "type": "n8n-nodes-base.code",
      "position": [
        -256,
        -32
      ]
    },
    {
      "id": "2f877b5d-0bcc-43c1-804b-6ab835c98373",
      "name": "Format Audit Report - EN",
      "type": "n8n-nodes-base.code",
      "position": [
        -256,
        112
      ]
    },
    {
      "id": "27bdda1e-fda2-4657-949b-5b231bae8d2a",
      "name": "Filter duplicate WorkflowID",
      "type": "n8n-nodes-base.code",
      "position": [
        -1024,
        64
      ]
    },
    {
      "id": "7c05f33f-787a-4ea8-9dcb-07349e6a1e46",
      "name": "Get last executions",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -768,
        64
      ]
    },
    {
      "id": "f2f6087e-70cc-4d18-988d-01fa1d7f7b79",
      "name": "If Language",
      "type": "n8n-nodes-base.if",
      "position": [
        -528,
        64
      ]
    },
    {
      "id": "7e88ca33-bf1f-4976-9b4d-2e98fc50e698",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 1️⃣ Schedule Trigger (Weekly) \n**⏰ WEEKLY TRIGGER**\nAutomatically runs every Monday at 6 AM\n→ Change schedule in node settings if needed\n→ Can be set to daily, monthly, or custom cron"
      }
    },
    {
      "id": "6eeaba97-94de-4369-b0ce-8e962fa6a198",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1616,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 2️⃣ Set Config Variables \n**⚙️ CONFIGURATION - EDIT THIS FIRST!**\n📧 email_to: your.email@domain.com\n📁 project_name: Your-Project-Name\n🌐 server_url: https://n8n.yourdomain.com\n   ⚠️ NO trailing slas"
      }
    },
    {
      "id": "d1624f02-332d-4b7b-89ef-aceb3d3acd43",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 3️⃣ Generate a security audit \n**🔍 SECURITY AUDIT GENERATOR**\nCalls N8N API to generate security audit\n\n📊 Analyzes:\n- Credentials risks\n- Dangerous nodes (Code, SSH, HTTP, etc.)\n- Instance security"
      }
    },
    {
      "id": "7c1f7a9f-f0eb-4daa-99e2-592ac12036f8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 4️⃣ Filter duplicate WorkflowID \n**🔄 DEDUPLICATION**\nExtracts unique workflows from audit results\n\n→ Removes duplicate workflow entries\n→ Prepares data for execution lookup\n→ Automatic - no configu"
      }
    },
    {
      "id": "78d9ef00-71f9-47c5-b5da-1b6d0db98242",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 5️⃣ Get last executions\n**📊 EXECUTION STATUS FETCHER**\nGets last execution for each workflow\n\n→ Retrieves success/failure status\n→ Shows execution start/stop times\n→ Enriches report with real data\n"
      }
    },
    {
      "id": "ae647e6b-448b-4fde-89f2-63b412822c18",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 6️⃣ If Language\n\n**🌍 LANGUAGE ROUTER**\nRoutes to FR or EN formatter\n\nIf Language = \"FR\" → French report\nOtherwise → English report\n\n→ Based on variable set in node 2\n→ Automatic routing - no config"
      }
    },
    {
      "id": "45a3aaa6-9f14-4aec-80f0-22cca126e6a7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 7️⃣ Format Audit Report\n\n**FRENCH/ENGLISH FORMATTER**\n📝 Creates:\n- Markdown version\n- HTML email version\n- Email subject with risk level\n\n📊 Calculates:\n- Unique credentials count\n- Nodes breakdown "
      }
    },
    {
      "id": "caf87b67-3966-4114-a9ef-24f32ff8d78f",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -432
      ],
      "parameters": {
        "width": null,
        "height": 656,
        "content": "## 8️⃣ Send Gmail (HTML)\n\n\n**📧 EMAIL SENDER**\nSends formatted HTML report via Gmail\n\n✉️ Sends to: Address from node 2 (email_to)\n📨 Format: Rich HTML with links & colors\n🔗 Includes: Direct links to wor"
      }
    },
    {
      "id": "2ad8307a-b770-46b4-b8ea-478b490e80b3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        -960
      ],
      "parameters": {
        "width": 320,
        "height": 496,
        "content": "## 🎯 Quick Setup Checklist\n✅ 1. Create N8N API key (Settings → API)\n✅ 2. Setup Gmail OAuth2 credential\n✅ 3. Edit \"Set Config Variables\" node:\n      - email_to\n      - project_name\n      - server_url ("
      }
    },
    {
      "id": "3b9d3299-d93e-4e5b-9f16-66cc40607402",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        -960
      ],
      "parameters": {
        "width": 304,
        "height": 496,
        "content": "## 💡 Configuration Tips\n**🔧 CUSTOMIZATION OPTIONS:**\n\nSchedule:\n→ Node 1: Change trigger frequency\n\nRisk Thresholds:\n→ Nodes 7: Edit JavaScript conditions\n   if (totalCredentials > 5) { ... }\n\nEmail R"
      }
    },
    {
      "id": "d992360f-2eb3-4f03-9fbb-769ab9f56e52",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -960
      ],
      "parameters": {
        "width": 352,
        "height": 496,
        "content": "## 📊 Report Contents\n**📧 YOU WILL RECEIVE:**\n\n📊 Summary Section:\n- Total & unique credentials\n- Nodes breakdown by type\n- Community nodes count\n- Overall risk: 🟩 Low / 🟧 Moderate / 🟥 High\n\n🔐 Credentia"
      }
    },
    {
      "id": "efcad0e0-a50b-4e0f-95dc-5bc221b8cdd2",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -960
      ],
      "parameters": {
        "width": 272,
        "height": 496,
        "content": "## ⚠️ Important Notes\n**🚨 BEFORE FIRST RUN:**\n\n1. Server URL Format:\n   ✅ https://n8n.domain.com\n   ❌ https://n8n.domain.com/\n\n2. Language Parameter:\n   ✅ \"EN\" or \"FR\" (uppercase)\n   ❌ \"en\" or \"Englis"
      }
    },
    {
      "id": "5d147ec8-9000-41c1-b67f-650666c23f95",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -960
      ],
      "parameters": {
        "width": 288,
        "height": 496,
        "content": "## 🐛 Troubleshooting\n\n❌ Empty report?\n→ Check N8N API key permissions\n\n❌ Workflow links broken?\n→ Verify server_url format (no trailing /)\n\n❌ No execution status?\n→ Workflows must be executed at least"
      }
    },
    {
      "id": "4ca7fc9a-1bd6-4514-b72f-23474abac940",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -960
      ],
      "parameters": {
        "width": 416,
        "height": 496,
        "content": "## 📈 Expected Results\n**✅ WEEKLY EMAIL WITH:**\n\nSubject: \n\"🔒 Audit Report [Project] – Risk 🟧 Moderate\"\n\nContent:\n- Executive summary with metrics\n- Color-coded risk levels\n- Direct links to affected w"
      }
    }
  ],
  "connections": {
    "If Language": {
      "main": [
        [
          {
            "node": "Format Audit Report - FR",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Audit Report - EN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get last executions": {
      "main": [
        [
          {
            "node": "If Language",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Config Variables": {
      "main": [
        [
          {
            "node": "Generate a security audit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Audit Report - EN": {
      "main": [
        [
          {
            "node": "Send Gmail (HTML)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Audit Report - FR": {
      "main": [
        [
          {
            "node": "Send Gmail (HTML)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a security audit": {
      "main": [
        [
          {
            "node": "Filter duplicate WorkflowID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger (Weekly)": {
      "main": [
        [
          {
            "node": "Set Config Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter duplicate WorkflowID": {
      "main": [
        [
          {
            "node": "Get last executions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}