{
  "name": "Contract Signed → Project Kickoff",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "contract-signed",
        "options": {
          "responseMode": "onReceived",
          "responseData": "allEntries"
        }
      },
      "id": "webhook-trigger",
      "name": "PandaDoc/DocuSign Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [220, 300],
      "webhookId": "contract-signed-webhook"
    },
    {
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "clientName",
              "name": "clientName",
              "value": "={{ $json.body.recipient?.name || $json.body.signers?.[0]?.name || $json.body.client_name || 'New Client' }}",
              "type": "string"
            },
            {
              "id": "clientEmail",
              "name": "clientEmail",
              "value": "={{ $json.body.recipient?.email || $json.body.signers?.[0]?.email || $json.body.client_email || '' }}",
              "type": "string"
            },
            {
              "id": "documentName",
              "name": "documentName",
              "value": "={{ $json.body.document?.name || $json.body.envelope?.emailSubject || $json.body.name || 'Signed Contract' }}",
              "type": "string"
            },
            {
              "id": "documentId",
              "name": "documentId",
              "value": "={{ $json.body.document?.id || $json.body.envelopeId || $json.body.id || '' }}",
              "type": "string"
            },
            {
              "id": "signedAt",
              "name": "signedAt",
              "value": "={{ $json.body.completed_at || $json.body.sentDateTime || $now.toISO() }}",
              "type": "string"
            },
            {
              "id": "projectName",
              "name": "projectName",
              "value": "={{ ($json.body.recipient?.name || $json.body.signers?.[0]?.name || $json.body.client_name || 'Client') + ' - ' + $now.format('MMM yyyy') }}",
              "type": "string"
            },
            {
              "id": "startDate",
              "name": "startDate",
              "value": "={{ $now.plus({days: 3}).toFormat('yyyy-MM-dd') }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "normalize-data",
      "name": "Extract Contract Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [440, 300]
    },
    {
      "parameters": {
        "resource": "board",
        "operation": "create",
        "name": "={{ $json.projectName }}",
        "additionalFields": {
          "desc": "Project for {{ $json.clientName }}\nContract signed: {{ $json.signedAt }}\nDocument: {{ $json.documentName }}",
          "idBoardSource": "YOUR_TEMPLATE_BOARD_ID",
          "keepFromSource": "cards"
        }
      },
      "id": "trello-create-board",
      "name": "Create Project Board from Template",
      "type": "n8n-nodes-base.trello",
      "typeVersion": 1,
      "position": [660, 220],
      "credentials": {
        "trelloApi": {
          "id": "YOUR_TRELLO_CREDENTIAL_ID",
          "name": "Trello account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "boardId",
              "name": "boardId",
              "value": "={{ $json.id }}",
              "type": "string"
            },
            {
              "id": "boardUrl",
              "name": "boardUrl",
              "value": "={{ $json.url }}",
              "type": "string"
            },
            {
              "id": "boardName",
              "name": "boardName",
              "value": "={{ $json.name }}",
              "type": "string"
            },
            {
              "id": "clientName",
              "name": "clientName",
              "value": "={{ $('Extract Contract Data').item.json.clientName }}",
              "type": "string"
            },
            {
              "id": "clientEmail",
              "name": "clientEmail",
              "value": "={{ $('Extract Contract Data').item.json.clientEmail }}",
              "type": "string"
            },
            {
              "id": "startDate",
              "name": "startDate",
              "value": "={{ $('Extract Contract Data').item.json.startDate }}",
              "type": "string"
            },
            {
              "id": "documentName",
              "name": "documentName",
              "value": "={{ $('Extract Contract Data').item.json.documentName }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "merge-data",
      "name": "Merge Board & Contract Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [880, 220]
    },
    {
      "parameters": {
        "resource": "message",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "YOUR_SLACK_CHANNEL_ID",
          "mode": "id"
        },
        "messageType": "block",
        "blocksUi": {
          "blocksValues": [
            {
              "type": "header",
              "text": {
                "type": "plain_text",
                "text": "New Project Signed!",
                "emoji": true
              }
            },
            {
              "type": "section",
              "fields": [
                {
                  "type": "mrkdwn",
                  "text": "*Client:*\n{{ $json.clientName }}"
                },
                {
                  "type": "mrkdwn",
                  "text": "*Project:*\n{{ $json.boardName }}"
                }
              ]
            },
            {
              "type": "section",
              "fields": [
                {
                  "type": "mrkdwn",
                  "text": "*Start Date:*\n{{ $json.startDate }}"
                },
                {
                  "type": "mrkdwn",
                  "text": "*Contract:*\n{{ $json.documentName }}"
                }
              ]
            },
            {
              "type": "divider"
            },
            {
              "type": "section",
              "text": {
                "type": "mrkdwn",
                "text": "*Project Board:* <{{ $json.boardUrl }}|Open in Trello>"
              }
            },
            {
              "type": "context",
              "elements": [
                {
                  "type": "mrkdwn",
                  "text": "Contract signed and project board created automatically via n8n"
                }
              ]
            }
          ]
        },
        "otherOptions": {
          "unfurl_links": false,
          "unfurl_media": false
        }
      },
      "id": "slack-notification",
      "name": "Notify Team on Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [1100, 140],
      "credentials": {
        "slackApi": {
          "id": "YOUR_SLACK_CREDENTIAL_ID",
          "name": "Slack account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $json.clientEmail }}",
        "subject": "Welcome! Here's What Happens Next",
        "emailType": "html",
        "message": "=<h2>Welcome aboard, {{ $json.clientName }}!</h2>\n\n<p>Thank you for signing the contract. We're excited to get started on your project.</p>\n\n<h3>What Happens Next</h3>\n<ol>\n  <li><strong>Kickoff Call</strong> - We'll schedule a brief call within the next 2-3 business days to review your project goals and timeline.</li>\n  <li><strong>Project Start</strong> - Your project is scheduled to begin on <strong>{{ $json.startDate }}</strong>.</li>\n  <li><strong>Progress Updates</strong> - You'll receive regular updates as we hit key milestones.</li>\n</ol>\n\n<p>If you have any questions before we connect, just reply to this email.</p>\n\n<p>Talk soon!<br>\nYour Project Team</p>",
        "options": {}
      },
      "id": "gmail-welcome",
      "name": "Send Client Welcome Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [1100, 340],
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CREDENTIAL_ID",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "status",
              "name": "status",
              "value": "success",
              "type": "string"
            },
            {
              "id": "client",
              "name": "client",
              "value": "={{ $('Extract Contract Data').item.json.clientName }}",
              "type": "string"
            },
            {
              "id": "project_board",
              "name": "project_board",
              "value": "={{ $('Merge Board & Contract Data').item.json.boardUrl }}",
              "type": "string"
            },
            {
              "id": "team_notified",
              "name": "team_notified",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "client_emailed",
              "name": "client_emailed",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "processed_at",
              "name": "processed_at",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "set-output",
      "name": "Set Success Output",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1320, 300]
    }
  ],
  "connections": {
    "PandaDoc/DocuSign Webhook": {
      "main": [
        [
          {
            "node": "Extract Contract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contract Data": {
      "main": [
        [
          {
            "node": "Create Project Board from Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Project Board from Template": {
      "main": [
        [
          {
            "node": "Merge Board & Contract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Board & Contract Data": {
      "main": [
        [
          {
            "node": "Notify Team on Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Client Welcome Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Team on Slack": {
      "main": [
        [
          {
            "node": "Set Success Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Client Welcome Email": {
      "main": [
        [
          {
            "node": "Set Success Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "uzunu-automation-templates"
  },
  "pinData": {},
  "versionId": "1",
  "triggerCount": 1,
  "tags": [
    {
      "name": "data-sync",
      "id": "data-sync"
    },
    {
      "name": "notifications",
      "id": "notifications"
    },
    {
      "name": "project-management",
      "id": "project-management"
    },
    {
      "name": "onboarding",
      "id": "onboarding"
    }
  ]
}
