{
  "name": "Digital B - Lead Automation System (Google Sheets)",
  "nodes": [
    {
      "id": "WebhookTrigger",
      "name": "New Lead (Webhook)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "digitalb-newlead",
        "responseMode": "onReceived"
      }
    },
    {
      "id": "AIQualification",
      "name": "AI Lead Qualification",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        600,
        300
      ],
      "parameters": {
        "operation": "chat",
        "model": "gpt-4o-mini",
        "messages": [
          {
            "role": "system",
            "content": "Tu es un assistant qui analyse un lead pour une agence de communication."
          },
          {
            "role": "user",
            "content": "Analyse ce lead et retourne : score (Hot/Warm/Cold), r\u00e9sum\u00e9, urgence, budget. Lead: {{$json}}"
          }
        ]
      }
    },
    {
      "id": "GoogleSheetsCreate",
      "name": "Add Lead to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        950,
        300
      ],
      "parameters": {
        "operation": "append",
        "sheetId": "REPLACE_WITH_YOUR_SHEET_ID",
        "range": "Leads!A1",
        "options": {},
        "valueInputMode": "RAW"
      }
    },
    {
      "id": "AutoReply",
      "name": "Send Auto Reply Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        1250,
        150
      ],
      "parameters": {
        "operation": "send",
        "to": "={{$json[\"email\"]}}",
        "subject": "Merci pour votre demande - Digital B Agency",
        "message": "Bonjour {{$json[\"name\"]}}, merci pour votre int\u00e9r\u00eat pour Digital B Agency. Votre demande est bien re\u00e7ue. Notre \u00e9quipe vous contactera tr\u00e8s bient\u00f4t."
      }
    },
    {
      "id": "InternalNotification",
      "name": "Notify Team (Slack)",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1250,
        450
      ],
      "parameters": {
        "operation": "postMessage",
        "channel": "digitalb-leads",
        "text": "\ud83c\udf89 Nouveau lead re\u00e7u !\nNom: {{$json[\"name\"]}}\nService: {{$json[\"service\"]}}\nBudget: {{$json[\"budget\"]}}\nUrgence: {{$json[\"urgency\"]}}\nScore IA: {{$json[\"ai_score\"]}}"
      }
    },
    {
      "id": "GoogleDriveFolder",
      "name": "Create Client Folder",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 2,
      "position": [
        1550,
        300
      ],
      "parameters": {
        "operation": "createFolder",
        "name": "={{$json[\"name\"]}} - Digital B Client",
        "parentId": "REPLACE_WITH_DRIVE_FOLDER_ID"
      }
    },
    {
      "id": "FollowUp1",
      "name": "Follow-up J+1",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1850,
        150
      ],
      "parameters": {
        "amount": 1,
        "unit": "days"
      }
    },
    {
      "id": "FollowUpEmail1",
      "name": "Send Follow-up Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        2100,
        150
      ],
      "parameters": {
        "operation": "send",
        "to": "={{$json[\"email\"]}}",
        "subject": "Suivi de votre demande - Digital B Agency",
        "message": "Bonjour {{$json[\"name\"]}}, nous revenons vers vous concernant votre demande. N'h\u00e9sitez pas \u00e0 r\u00e9pondre \u00e0 ce message si vous avez des questions."
      }
    },
    {
      "id": "WeeklyReport",
      "name": "Weekly Lead Report",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        650
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "value": 1
            }
          ]
        }
      }
    }
  ],
  "connections": {
    "WebhookTrigger": {
      "main": [
        [
          {
            "node": "AIQualification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AIQualification": {
      "main": [
        [
          {
            "node": "GoogleSheetsCreate",
            "type": "main",
            "index": 0
          },
          {
            "node": "AutoReply",
            "type": "main",
            "index": 0
          },
          {
            "node": "InternalNotification",
            "type": "main",
            "index": 0
          },
          {
            "node": "GoogleDriveFolder",
            "type": "main",
            "index": 0
          },
          {
            "node": "FollowUp1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FollowUp1": {
      "main": [
        [
          {
            "node": "FollowUpEmail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}