{
  "nodes": [
    {
      "id": "a0532408-40ba-47c7-a5aa-8234399070f8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -64
      ],
      "parameters": {
        "width": 420,
        "height": 744,
        "content": "## \ud83c\udfaf Project Onboarding Automation\n\n**Automate your entire client onboarding workflow when a new contract PDF is uploaded to Google Drive.**\n\nThis template automatically:\n1. Creates a project folder structure in Google Drive\n2. Creates a dedicated Slack channel for the project\n3. Sets up a Notion project page with tasks\n4. Logs everything to a master Google Sheet\n5. Drafts a personalized welcome email using AI\n6. Notifies your team via Slack when ready\n\n### \ud83d\udccb Requirements\n- Google Drive, Gmail, Sheets OAuth credentials\n- Slack OAuth credentials (with channel creation permissions)\n- Notion API integration\n- OpenAI API key\n\n### \ud83d\udcc1 File Naming Convention\nUpload PDFs with this format:\n`ClientName_ProjectName_email@example.com.pdf`\n\n### \u2699\ufe0f Setup Steps\n1. Configure all OAuth credentials\n2. Update the **Set Config Variables** node with your IDs\n3. Create the trigger folder in Google Drive\n4. Test with a sample PDF file"
      },
      "typeVersion": 1
    },
    {
      "id": "9e4c4d93-1c16-4b2f-8e1b-aee8e3005dc1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "content": "### 1\ufe0f\u20e3 Trigger & Parse\nMonitors a specific Google Drive folder for new/updated PDF files.\n\nExtracts client name, project name, and email from the filename."
      },
      "typeVersion": 1
    },
    {
      "id": "2e0463b8-781b-4ef4-acb9-0dfe902e6eeb",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 280,
        "height": 176,
        "content": "### 2\ufe0f\u20e3 Configuration\nCentralized config node.\n\n**Update these values:**\n- Google Drive parent folder ID\n- Notion database ID\n- Google Sheet ID"
      },
      "typeVersion": 1
    },
    {
      "id": "a279bc7e-32f3-41c2-81c1-0c82555e0ca9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "content": "### 3\ufe0f\u20e3 Create Project Infrastructure\nAutomatically creates:\n- Root project folder\n- Deliverables subfolder\n- Slack channel for communication"
      },
      "typeVersion": 1
    },
    {
      "id": "5df62c2d-e53d-4b71-82d1-5b8114ed35fc",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 176,
        "content": "### 4\ufe0f\u20e3 Project Management\nCreates a Notion page with:\n- Project details\n- Initial kickoff task\n\nLogs to master Google Sheet for tracking."
      },
      "typeVersion": 1
    },
    {
      "id": "af719f76-76b8-496f-a744-36a1416f923e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 176,
        "content": "### 5\ufe0f\u20e3 AI Email Draft & Notification\nUses OpenAI to draft a personalized welcome email.\n\nSaves as Gmail draft for human review.\n\nNotifies team on Slack when complete."
      },
      "typeVersion": 1
    },
    {
      "id": "89bef8d3-619c-43d6-9ced-900c9816aa60",
      "name": "Watch Contract Folder",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        48,
        160
      ],
      "parameters": {
        "event": "fileUpdated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_FOLDER_ID_HERE"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f20b7709-5329-49e6-b5c6-f02b0c7831a6",
      "name": "Parse Filename",
      "type": "n8n-nodes-base.code",
      "position": [
        288,
        160
      ],
      "parameters": {
        "jsCode": "// \ud83e\uddf9 FILENAME PARSER\n// Naming convention: \"user@example.com\"\n\n// 1. Get filename\nconst inputName = $input.first().json.name;\nconst filename = inputName ? inputName.replace(/\\.pdf$/i, '') : 'user@example.com';\n\n// 2. Split by underscore\nconst parts = filename.split('_');\n\n// 3. Assign variables\nconst clientName = parts[0] || 'UnknownClient';\nconst projectName = parts[1] || 'NewProject';\nconst contactEmail = parts[2] || 'admin@example.com';\nconst startDate = new Date().toISOString().split('T')[0];\n\n// 4. Generate Slack channel name (alphanumeric + hyphens only)\nlet safeName = clientName.toLowerCase()\n    .replace(/\\s+/g, '-')\n    .replace(/[^a-z0-9\\-]/g, '')\n    .replace(/-+/g, '-')\n    .replace(/^-|-$/g, '');\n\n// Fallback for non-ASCII names\nif (!safeName || safeName.length < 2) {\n    const randomId = Math.floor(1000 + Math.random() * 9000);\n    safeName = `contract-${startDate.replace(/-/g, '')}-${randomId}`;\n}\n\nconst slackChannelName = `proj-${safeName}`;\nconst projectCode = (clientName.substring(0, 3) || 'PRJ').toUpperCase() + '-' + Date.now().toString().slice(-4);\n\nreturn {\n  json: {\n    'Client Name': clientName,\n    'Project Name': projectName,\n    'Contact Email': contactEmail,\n    'Start Date': startDate,\n    slackChannelName,\n    projectCode,\n    originalFileUrl: $input.first().json.webViewLink || ''\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "bec51f42-95bf-48bd-ab7a-884756afb258",
      "name": "Set Config Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        512,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "drive-parent",
              "name": "googleDriveParentFolderId",
              "type": "string",
              "value": "YOUR_PARENT_FOLDER_ID"
            },
            {
              "id": "notion-db",
              "name": "notionDatabaseId",
              "type": "string",
              "value": "YOUR_NOTION_DATABASE_ID"
            },
            {
              "id": "sheet-id",
              "name": "googleSheetId",
              "type": "string",
              "value": "YOUR_GOOGLE_SHEET_ID"
            },
            {
              "id": "slack-notify",
              "name": "slackNotificationChannel",
              "type": "string",
              "value": "YOUR_SLACK_CHANNEL_ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "527b805b-cfbb-460f-b255-0fd417afbcec",
      "name": "Create Project Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        752,
        160
      ],
      "parameters": {
        "name": "={{ $('Parse Filename').first().json['Client Name'] }} - {{ $('Parse Filename').first().json['Project Name'] }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Config Variables').first().json.googleDriveParentFolderId }}"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "95508054-d052-4b42-85b0-602636db371b",
      "name": "Create Deliverables Subfolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        960,
        160
      ],
      "parameters": {
        "name": "01_Deliverables",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create Project Folder').first().json.id }}"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "b67c0083-1acb-46c5-b4ce-d8c38ecffb01",
      "name": "Create Slack Channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        1152,
        160
      ],
      "parameters": {
        "resource": "channel",
        "channelId": "={{ $('Parse Filename').first().json.slackChannelName }}",
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "f89079ae-270c-4576-b0fd-f163d7d93e77",
      "name": "Create Notion Project Page",
      "type": "n8n-nodes-base.notion",
      "position": [
        1408,
        160
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Config Variables').first().json.notionDatabaseId }}"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "title|title",
              "title": "={{ $('Parse Filename').first().json['Client Name'] }} - {{ $('Parse Filename').first().json['Project Name'] }}"
            },
            {
              "key": "status|status",
              "statusValue": "Not Started"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "43939ce1-56a6-4e0b-9bc5-6da6a3a5d1f0",
      "name": "Add Kickoff Task",
      "type": "n8n-nodes-base.notion",
      "position": [
        1632,
        160
      ],
      "parameters": {
        "blockId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "blockUi": {
          "blockValues": [
            {
              "type": "to_do",
              "textContent": "Schedule kickoff meeting"
            }
          ]
        },
        "resource": "block"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "009bcb76-18e2-43c6-8a01-218ada2c0536",
      "name": "Log to Master Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1856,
        160
      ],
      "parameters": {
        "columns": {
          "value": {
            "Client": "={{ $('Parse Filename').first().json['Client Name'] }}",
            "Notion Link": "={{ $('Create Notion Project Page').first().json.url }}",
            "Drive Folder": "={{ $('Create Project Folder').first().json.webViewLink }}",
            "Project Code": "={{ $('Parse Filename').first().json.projectCode }}",
            "Slack Channel": "={{ $('Parse Filename').first().json.slackChannelName }}"
          },
          "schema": [
            {
              "id": "Client",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Client",
              "defaultMatch": false
            },
            {
              "id": "Project Code",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Project Code",
              "defaultMatch": false
            },
            {
              "id": "Notion Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Notion Link",
              "defaultMatch": false
            },
            {
              "id": "Slack Channel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Slack Channel",
              "defaultMatch": false
            },
            {
              "id": "Drive Folder",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Drive Folder",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Config Variables').first().json.googleSheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "2ea1cb6d-5de5-41be-9105-7ac6f16bde8a",
      "name": "AI Draft Welcome Email",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2080,
        160
      ],
      "parameters": {
        "text": "You are a professional project manager.\nWrite a project kickoff welcome email based on the following information:\n\n## Client Information\n- Client: {{ $('Parse Filename').first().json['Client Name'] }}\n- Project: {{ $('Parse Filename').first().json['Project Name'] }}\n\n## Shared Resources\n- Slack Channel: #{{ $('Parse Filename').first().json.slackChannelName }}\n\n## Instructions\n- Write a professional yet friendly business email\n- Do not include subject line (body only)\n- End with \"Best regards, [Your Company] Project Team\"\n- Mention that kickoff meeting details will follow",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "7509d7a5-ba0e-482c-9680-9bc5efd72ac2",
      "name": "Create Gmail Draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2400,
        160
      ],
      "parameters": {
        "message": "={{ $json.output }}",
        "options": {},
        "subject": "=Welcome to {{ $('Parse Filename').first().json['Project Name'] }} - Project Kickoff",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "54ae8020-8e8f-4ae2-a7b0-b40fdf460c12",
      "name": "Notify Team on Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        2624,
        160
      ],
      "parameters": {
        "text": "=\ud83c\udf89 *New Project Onboarded!*\n\n*Client:* {{ $('Parse Filename').first().json['Client Name'] }}\n*Project:* {{ $('Parse Filename').first().json['Project Name'] }}\n*Project Code:* {{ $('Parse Filename').first().json.projectCode }}\n\n\ud83d\udcc1 <{{ $('Create Project Folder').first().json.webViewLink }}|Drive Folder>\n\ud83d\udcdd <{{ $('Create Notion Project Page').first().json.url }}|Notion Page>\n\ud83d\udcac <#{{ $('Parse Filename').first().json.slackChannelName }}>\n\n\u2709\ufe0f *AI email draft created* - Check Gmail drafts to review and send.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Config Variables').first().json.slackNotificationChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "e529c2c0-7b80-4144-b037-bc1ac4a06202",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2080,
        368
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    }
  ],
  "connections": {
    "Parse Filename": {
      "main": [
        [
          {
            "node": "Set Config Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Kickoff Task": {
      "main": [
        [
          {
            "node": "Log to Master Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Draft Welcome Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Gmail Draft": {
      "main": [
        [
          {
            "node": "Notify Team on Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Master Sheet": {
      "main": [
        [
          {
            "node": "AI Draft Welcome Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Slack Channel": {
      "main": [
        [
          {
            "node": "Create Notion Project Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Config Variables": {
      "main": [
        [
          {
            "node": "Create Project Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Project Folder": {
      "main": [
        [
          {
            "node": "Create Deliverables Subfolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch Contract Folder": {
      "main": [
        [
          {
            "node": "Parse Filename",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Draft Welcome Email": {
      "main": [
        [
          {
            "node": "Create Gmail Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Notion Project Page": {
      "main": [
        [
          {
            "node": "Add Kickoff Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Deliverables Subfolder": {
      "main": [
        [
          {
            "node": "Create Slack Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}