{
  "name": "Welcome email sequence",
  "active": false,
  "isArchived": false,
  "pinData": {},
  "versionId": "00000000-0000-0000-0000-000000000002",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "YOUR_N8N_INSTANCE_ID"
  },
  "settings": {
    "executionOrder": "v1",
    "timezone": "Europe/London",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "tags": [],
  "nodes": [
    {
      "id": "b2e2c002-0002-4000-8000-000000000001",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -300,
        120
      ],
      "parameters": {
        "width": 340,
        "height": 560,
        "color": 7,
        "content": "## Setup (placeholders only)\n\n1. Replace `YOUR_SPREADSHEET_ID`.\n2. Sheet tab `Leads` with headers: `name`, `email`, `signup_date`, `sequence_step`, `last_email_at`, `paused`.\n3. New people start at `sequence_step` 0. Put `yes` in `paused` if they have replied or asked you to stop.\n4. Attach your own Google Sheets and SMTP credentials. Replace `YOUR_FROM_EMAIL@example.com`.\n5. Edit the three note texts in the Code node (`[YOUR NAME / BUSINESS]`).\n6. Set the workflow timezone (default: Europe/London).\n7. Test with your own address, then publish.\n\nDraft template for Kaizen Flourishing. Use tech. Stay human."
      }
    },
    {
      "id": "b2e2c002-0002-4000-8000-000000000002",
      "name": "Every morning",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        120,
        320
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "daysInterval": 1,
              "triggerAtHour": 9,
              "triggerAtMinute": 0
            }
          ]
        }
      }
    },
    {
      "id": "b2e2c002-0002-4000-8000-000000000003",
      "name": "Read Leads sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        360,
        320
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets account (placeholder)"
        }
      },
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "options": {}
      }
    },
    {
      "id": "b2e2c002-0002-4000-8000-000000000004",
      "name": "Which email is due",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        600,
        320
      ],
      "parameters": {
        "jsCode": "const DAY_MS = 24 * 60 * 60 * 1000;\nconst now = Date.now();\n\nfunction paused(value) {\n  const text = String(value || '').trim().toLowerCase();\n  return text === 'yes' || text === 'y' || text === 'true' || text === '1';\n}\n\nreturn $input.all().map((item) => {\n  const row = item.json;\n  const step = Number(row.sequence_step || 0);\n  const last = row.last_email_at ? new Date(row.last_email_at).getTime() : 0;\n  const name = row.name || 'there';\n  const out = {\n    ...row,\n    email_to_send: 0,\n    subject: '',\n    body: '',\n    new_step: step,\n  };\n\n  if (!row.email || paused(row.paused) || step >= 3) {\n    return { json: out };\n  }\n\n  let send = 0;\n  if (step === 0) {\n    send = 1;\n    out.subject = 'Welcome \u2014 a short hello';\n    out.body =\n      'Hello ' + name + ',\\n\\n' +\n      'Thanks for getting in touch. This is the first of three short notes. ' +\n      'No rush, and no hard sell.\\n\\n' +\n      'If you have a question, just reply to this email.\\n\\n' +\n      '\u2014 [YOUR NAME / BUSINESS]';\n  } else if (step === 1 && last && now - last >= 2 * DAY_MS) {\n    send = 2;\n    out.subject = 'A little more, if it is useful';\n    out.body =\n      'Hello ' + name + ',\\n\\n' +\n      'Just checking this reached you. If it would help, tell me what you ' +\n      'were hoping to get done and I will write back myself.\\n\\n' +\n      '\u2014 [YOUR NAME / BUSINESS]';\n  } else if (step === 2 && last && now - last >= 3 * DAY_MS) {\n    send = 3;\n    out.subject = 'Last note from this short sequence';\n    out.body =\n      'Hello ' + name + ',\\n\\n' +\n      'This is the last of the three notes I mentioned. I will not keep ' +\n      'writing unless you want me to. If you would like to talk, reply ' +\n      'any time.\\n\\n' +\n      '\u2014 [YOUR NAME / BUSINESS]';\n  }\n\n  if (send) {\n    out.email_to_send = send;\n    out.new_step = send;\n  }\n  return { json: out };\n});\n"
      }
    },
    {
      "id": "b2e2c002-0002-4000-8000-000000000005",
      "name": "Is a note due",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        840,
        320
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "b2e2c002-0002-4000-8000-0000000000b1",
              "leftValue": "={{ $json.email_to_send }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "b2e2c002-0002-4000-8000-000000000006",
      "name": "Send welcome note",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1080,
        240
      ],
      "credentials": {
        "smtp": {
          "id": "YOUR_SMTP_CREDENTIAL_ID",
          "name": "SMTP account (placeholder)"
        }
      },
      "parameters": {
        "fromEmail": "YOUR_FROM_EMAIL@example.com",
        "toEmail": "={{ $json.email }}",
        "subject": "={{ $json.subject }}",
        "emailFormat": "text",
        "text": "={{ $json.body }}",
        "options": {}
      }
    },
    {
      "id": "b2e2c002-0002-4000-8000-000000000007",
      "name": "Mark note sent",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1320,
        240
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets account (placeholder)"
        }
      },
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $json.row_number }}",
            "sequence_step": "={{ $json.new_step }}",
            "last_email_at": "={{ $now.toISO() }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "sequence_step",
              "displayName": "sequence_step",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "last_email_at",
              "displayName": "last_email_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Every morning": {
      "main": [
        [
          {
            "node": "Read Leads sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Leads sheet": {
      "main": [
        [
          {
            "node": "Which email is due",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Which email is due": {
      "main": [
        [
          {
            "node": "Is a note due",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is a note due": {
      "main": [
        [
          {
            "node": "Send welcome note",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Send welcome note": {
      "main": [
        [
          {
            "node": "Mark note sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
