{
  "updatedAt": "2026-03-31T00:36:47.155Z",
  "createdAt": "2026-03-30T03:34:06.218Z",
  "id": "b5tXV70CaejAwvv6",
  "name": "NC 5-Day Text Challenge (SMS via GHL)",
  "description": null,
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "nc-challenge-signup",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Challenge Signup Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        220,
        300
      ],
      "webhookId": "nc-challenge-signup"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "phone",
              "name": "phone",
              "value": "={{ $json.body?.phone || $json.phone || \"\" }}",
              "type": "string"
            },
            {
              "id": "firstName",
              "name": "firstName",
              "value": "={{ $json.body?.firstName || $json.body?.first_name || $json.firstName || $json.first_name || \"there\" }}",
              "type": "string"
            },
            {
              "id": "email",
              "name": "email",
              "value": "={{ $json.body?.email || $json.email || \"\" }}",
              "type": "string"
            },
            {
              "id": "contactId",
              "name": "contactId",
              "value": "={{ $json.body?.contactId || $json.body?.contact_id || $json.contactId || $json.contact_id || \"\" }}",
              "type": "string"
            },
            {
              "id": "locationId",
              "name": "locationId",
              "value": "VMK8SyHTd8uCMgcJ7I2A",
              "type": "string"
            },
            {
              "id": "signupTime",
              "name": "signupTime",
              "value": "={{ new Date().toISOString() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "extract-data",
      "name": "Extract Contact Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        440,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const GHL_KEY = \"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\";\nconst phone = $input.first().json.phone;\nconst firstName = $input.first().json.firstName;\nconst email = $input.first().json.email;\nconst locationId = $input.first().json.locationId;\nlet contactId = $input.first().json.contactId;\nconst rawInput = $input.first().json;\nconst source = (rawInput.contactId || rawInput.contact_id || (rawInput.body && (rawInput.body.contactId || rawInput.body.contact_id))) ? 'Text (SMS)' : 'Landing Page';\n\n// If GHL already sent us the contactId, use it\nif (!contactId) {\n  // Search by phone\n  try {\n    const search = await this.helpers.httpRequest({\n      method: \"GET\",\n      url: \"https://services.leadconnectorhq.com/contacts/search/duplicate\",\n      qs: { locationId, number: phone },\n      headers: { \"Authorization\": \"Bearer \" + GHL_KEY, \"Version\": \"2021-07-28\" },\n      json: true\n    });\n    if (search.contact && search.contact.id) {\n      contactId = search.contact.id;\n    }\n  } catch(e) {}\n}\n\nif (!contactId) {\n  // Create new contact\n  try {\n    const create = await this.helpers.httpRequest({\n      method: \"POST\",\n      url: \"https://services.leadconnectorhq.com/contacts/\",\n      headers: { \"Authorization\": \"Bearer \" + GHL_KEY, \"Version\": \"2021-07-28\", \"Content-Type\": \"application/json\" },\n      body: { locationId, firstName, phone, email: email || undefined, tags: [\"challenge-active\"] },\n      json: true\n    });\n    contactId = create.contact.id;\n  } catch(e) {}\n}\n\n// CRITICAL: Disable DND for SMS -- they just opted in by signing up\nif (contactId) {\n  try {\n    await this.helpers.httpRequest({\n      method: \"PUT\",\n      url: \"https://services.leadconnectorhq.com/contacts/\" + contactId,\n      headers: { \"Authorization\": \"Bearer \" + GHL_KEY, \"Version\": \"2021-07-28\", \"Content-Type\": \"application/json\" },\n      body: {\n        dnd: false,\n        dndSettings: {\n          SMS: { status: \"inactive\", message: \"\" },\n          Email: { status: \"inactive\", message: \"\" }\n        },\n        tags: [\"challenge-active\"]\n      },\n      json: true\n    });\n  } catch(e) {}\n}\n\nreturn [{ json: { contactId, phone, firstName, email, locationId, signupTime: new Date().toISOString(), source } }];"
      },
      "id": "lookup-contact",
      "name": "Lookup/Create GHL Contact",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Send Day 0 confirmation SMS via GHL\nconst contactId = $input.first().json.contactId;\nconst locationId = $input.first().json.locationId;\n\nconst message = `Nurse Charles here. You're in.\\n\\nFor the next 5 days I'm going to text you a short video plus one thing to do that day. Same protocol I walk my patients through after 37 years in the ER.\\n\\nFirst question -- what are you working to quit?\\n\\nReply:\\n1 - Electronic (pods, pens)\\n2 - Cigarettes\\n3 - Chewing / Dip\\n4 - Other\\n\\nReply STOP at any time to opt out.`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: {\n    type: 'SMS',\n    contactId,\n    message\n  },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day0-sent'] },\n  json: true\n});\n\nconst items = $input.all();\nitems[0].json.signupTime = new Date().toISOString();\nreturn items;"
      },
      "id": "sms-day0",
      "name": "SMS Day 0: Confirmation",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 1); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day1",
      "name": "Wait until Day 1 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1100,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\nconst locationId = $input.first().json.locationId;\n\nconst message = `Day 1/5 -- Nurse Charles.\\n\\nA 21-year-old came into my ER turning gray. Not pale. Gray. His friends thought it was an asthma attack. It wasn't.\\n\\nWatch today's video (3 min): https://youtu.be/hjaIXk8RQiA\\n\\nYour lungs start healing within 20 minutes of stopping. The clock starts when you decide.\\n\\nKnow someone who could use this? Have them text READY to 470-672-7008`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day1-sent'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day1",
      "name": "SMS Day 1: ER Story",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1320,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 2); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day2",
      "name": "Wait until Day 2 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1540,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\n\nconst message = `Day 2/5 -- Nurse Charles.\\n\\nWhen you use, it feels like it calms you down. That's not calm -- you're just fixing a problem the habit CREATED.\\n\\nWatch today's video (4 min): https://youtu.be/tozCo5sl0A0\\n\\nWhich layer hits you hardest?\\n\\nReply: CHEMICAL, HABIT, or EMOTIONAL\\n\\nReply STOP to opt out.`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day2-sent'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day2",
      "name": "SMS Day 2: Brain Science",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1760,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 3); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day3",
      "name": "Wait until Day 3 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1980,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\n\nconst message = `Day 3/5 -- Nurse Charles.\\n\\nYou can't beat something you don't see coming. Today we map your triggers -- the moments your brain reaches for the habit before you even decide to.\\n\\nWatch today's video (4 min): https://youtu.be/OX2xhkQswkU\\n\\nWhat's your #1 trigger?\\n\\nReply: STRESS, PARTIES, BOREDOM, MORNINGS, or DRINKING\\n\\nReply STOP to opt out.`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day3-sent'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day3",
      "name": "SMS Day 3: Triggers",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2200,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 4); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day4",
      "name": "Wait until Day 4 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2420,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\n\nconst message = `Day 4/5 -- Nurse Charles.\\n\\nIn 37 years, thousands of patients told me they wanted to stop. The ones who actually did it all followed the same 5 steps. I've never shared all 5 publicly until now.\\n\\nWhen's your target date? Pick a day 3-7 days from now.\\n\\nReply with your date (example: APRIL 10)\\n\\nReply STOP to opt out.`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day4-sent'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day4",
      "name": "SMS Day 4: The Protocol",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2640,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 5); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day5",
      "name": "Wait until Day 5 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2860,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Day 5: Build personalized quit plan from GHL contact custom fields\nconst contactId = $input.first().json.contactId;\nconst firstName = $input.first().json.firstName;\n\n// Fetch contact to get custom fields and tags\nconst contact = await this.helpers.httpRequest({\n  method: 'GET',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}`,\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-07-28'\n  },\n  json: true\n});\n\nconst tags = contact.contact?.tags || [];\nconst customFields = contact.contact?.customFields || [];\n\n// Extract answers from tags (fallbacks if custom fields not set)\nlet nicotineType = 'your habit';\nif (tags.includes('nicotine-vape')) nicotineType = 'electronic devices';\nelse if (tags.includes('nicotine-cigarette')) nicotineType = 'cigarettes';\nelse if (tags.includes('nicotine-dip')) nicotineType = 'chewing tobacco';\n\nlet layer = 'habit';\nif (tags.includes('layer-chemical')) layer = 'Chemical';\nelse if (tags.includes('layer-habit')) layer = 'Habit';\nelse if (tags.includes('layer-emotional')) layer = 'Emotional';\n\nlet trigger = 'stress';\nif (tags.includes('trigger-stress')) trigger = 'Stress';\nelse if (tags.includes('trigger-parties')) trigger = 'Parties';\nelse if (tags.includes('trigger-boredom')) trigger = 'Boredom';\nelse if (tags.includes('trigger-mornings')) trigger = 'Mornings';\nelse if (tags.includes('trigger-drinking')) trigger = 'Drinking';\n\nlet quitDate = 'soon';\nif (tags.includes('quit-date-set')) {\n  // Try to find it in custom fields\n  const qdf = customFields.find(f => f.id === 'quit_date' || f.key === 'quit_date');\n  if (qdf) quitDate = qdf.value;\n}\n\n// Build nicotine-specific advice\nlet nicotineAdvice = '';\nswitch(nicotineType) {\n  case 'electronic devices': nicotineAdvice = 'Remove every device and pod from your house and car today. Replace with gum, mints, or a stress ball.'; break;\n  case 'cigarettes': nicotineAdvice = 'Throw out every pack, lighter, and ashtray today. Stock up on cinnamon toothpicks or gum.'; break;\n  case 'chewing tobacco': nicotineAdvice = 'Clear out every tin and replace with sunflower seeds or gum. Change your post-meal routine.'; break;\n  default: nicotineAdvice = 'Remove all products from your house and car today. Replace with gum or mints.'; break;\n}\n\n// Build layer-specific advice\nlet layerAdvice = '';\nswitch(layer) {\n  case 'Habit': layerAdvice = 'Your hands and mouth need a replacement. Keep something in your hands at all times -- water bottle, pen, stress ball.'; break;\n  case 'Chemical': layerAdvice = 'Physical withdrawal peaks at Day 3. Drink 80oz water daily, walk 20 min, sleep 8 hrs. Set a timer when cravings hit -- they last 3-5 minutes.'; break;\n  case 'Emotional': layerAdvice = 'You need new coping tools. When stress hits: 4-7-8 breathing (4 in, 7 hold, 8 out, 3 times). Call someone for 2 minutes. Journal for 5.'; break;\n}\n\n// Build trigger-specific advice\nlet triggerAdvice = '';\nswitch(trigger) {\n  case 'Parties': triggerAdvice = 'Hold your drink in your smoking hand. Tell one person at every event that you quit. Avoid parties for the first 2 weeks if possible.'; break;\n  case 'Stress': triggerAdvice = 'When stress hits, do 4-7-8 breathing before reaching for anything. A 2-minute phone call fires the same dopamine as nicotine.'; break;\n  case 'Boredom': triggerAdvice = 'Have something loaded on your phone -- podcast, playlist, game. Fill the gap before your hands fill it for you.'; break;\n  case 'Mornings': triggerAdvice = 'Move your body in the first 10 minutes of waking up. Pushups, walk, anything. Replace the morning nicotine with movement.'; break;\n  case 'Drinking': triggerAdvice = 'Cut alcohol for the first 2 weeks. Drinking reactivates cravings and lowers your defenses. This is the #1 relapse scenario.'; break;\n}\n\nconst planMessage = `Day 5/5 -- Your personalized quit plan, ${firstName}.\\n\\nBased on what you told me this week:\\n\\nYou use: ${nicotineType}\\nYour biggest layer: ${layer}\\nYour #1 trigger: ${trigger}\\nYour quit date: ${quitDate}\\n\\nYOUR PLAN:\\n\\n${nicotineAdvice}\\n\\n${layerAdvice}\\n\\n${triggerAdvice}\\n\\nYou've got the plan. Watch today's final video below.`;\n\n// Send the personalized plan\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message: planMessage },\n  json: true\n});\n\nreturn [{ json: { ...($input.first().json), nicotineType, layer, trigger, quitDate } }];"
      },
      "id": "sms-day5-plan",
      "name": "SMS Day 5: Personalized Plan",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        3080,
        300
      ]
    },
    {
      "parameters": {
        "amount": 5,
        "unit": "minutes"
      },
      "id": "wait-5min",
      "name": "Wait 5 Min",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        3300,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\n\nconst message = `Your Day 5 video -- what happens to your body when you quit:\\n\\nhttps://youtu.be/eqESi-9Hc9o\\n\\n20 min: heart rate normalizes\\n48 hrs: all nicotine gone\\n72 hrs: breathing gets easier\\n2 weeks: lung function up 30%\\n6 months: anxiety LOWER than when you were using\\n\\nThe clock starts when you decide. -NC`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day5-video",
      "name": "SMS Day 5: Video",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        3520,
        300
      ]
    },
    {
      "parameters": {
        "amount": 3,
        "unit": "hours"
      },
      "id": "wait-3hr",
      "name": "Wait 3 Hours",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        3740,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\nconst firstName = $input.first().json.firstName;\nconst nicotineType = $input.first().json.nicotineType || 'nicotine';\n\nconst message = `${firstName} -- you showed up for 5 days. That takes guts.\\n\\nI built the Freedom Toolkit for people who want to keep going. Full guide, your personalized plan as a PDF, 3 bonus craving videos, and a trigger replacement wallet card. Built specifically for people quitting ${nicotineType}.\\n\\nText TOOLKIT for the link ($27)\\nText KIT for the full program ($47) -- everything in the Toolkit PLUS my 45-min masterclass, 30 days of text check-ins from me, the Relapse Prevention Playbook, and 3 private audio messages\\n\\nThe full program is what I'd recommend. 30 days of check-ins from me plus a masterclass that goes way deeper than the challenge.\\n\\nEither way -- you earned your plan. It's yours. -NC\\n\\nReply STOP to opt out.`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day5-offer",
      "name": "SMS Day 5: The Offer",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        3960,
        300
      ]
    },
    {
      "parameters": {
        "amount": 6,
        "unit": "hours"
      },
      "id": "wait-6hr",
      "name": "Wait 6 Hours",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        4180,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\nconst firstName = $input.first().json.firstName;\nconst quitDate = $input.first().json.quitDate || 'soon';\n\nconst message = `Last thing from me on this challenge, ${firstName}.\\n\\nYour quit date is ${quitDate}. That's coming up.\\n\\nYour plan is ready. The Toolkit has everything you need to execute it.\\n\\nText TOOLKIT ($27) or KIT ($47) for the link.\\n\\nOr just keep your plan -- you earned it. I'm proud of you either way.\\n\\nText READY to this number anytime you need help. I'm here. -NC`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n// Tag as challenge complete\nawait this.helpers.httpRequest({\n  method: 'PUT',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}`,\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-complete'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day5-nudge",
      "name": "SMS Day 5: Last Nudge",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4400,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 7); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day7",
      "name": "Wait until Day 7 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        4620,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\nconst firstName = $input.first().json.firstName;\nconst quitDate = $input.first().json.quitDate || 'your quit date';\n\nconst message = `Hey ${firstName} -- Nurse Charles. Quick check-in. How are you doing since the challenge?\\n\\nYour quit date was ${quitDate}. Did you start?\\n\\nReply YES or NOT YET. No judgment either way.`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day7-sent'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day7",
      "name": "SMS Day 7: Check-in",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4840,
        300
      ]
    },
    {
      "parameters": {
        "resume": "specificTime",
        "dateTime": "={{ (function() { const signup = new Date($json.signupTime || new Date().toISOString()); const target = new Date(signup); target.setUTCDate(target.getUTCDate() + 14); target.setUTCHours(12, 0, 0, 0); return target.toISOString(); })() }}"
      },
      "id": "wait-day14",
      "name": "Wait until Day 14 8am ET",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        5060,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const contactId = $input.first().json.contactId;\nconst firstName = $input.first().json.firstName;\nconst quitDate = $input.first().json.quitDate || 'your quit date';\n\nconst message = `${firstName} -- checking in. Your quit date was ${quitDate}.\\n\\nIf you started: you're past the worst of it. The cravings get weaker every day.\\n\\nIf you haven't yet: that's okay. Text me a new date when you're ready.\\n\\nEither way -- I'm in your corner. -NC`;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://services.leadconnectorhq.com/conversations/messages',\n  headers: {\n    'Authorization': `Bearer ${\"pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b\"}`,\n    'Version': '2021-04-15',\n    'Content-Type': 'application/json'\n  },\n  body: { type: 'SMS', contactId, message },\n  json: true\n});\n\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: `https://services.leadconnectorhq.com/contacts/${contactId}/tags`,\n  headers: {\n    'Authorization': `Bearer pit-b68fa048-e2a1-4206-a68a-b3e6d3d7091b`,\n    'Version': '2021-07-28',\n    'Content-Type': 'application/json'\n  },\n  body: { tags: ['challenge-day14-sent'] },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "sms-day14",
      "name": "SMS Day 14: Final Check-in",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        5280,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const { firstName, phone, source } = $input.first().json;\n\nawait this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://api.telegram.org/bot8643128155:AAEu3a-z2Cm-f-m4DUXvP56_8PLT2gkWId8/sendMessage',\n  headers: { 'Content-Type': 'application/json' },\n  body: {\n    chat_id: -1003750217323,\n    text: `\ud83d\udd14 New 5-Day Challenge Signup!\n\nName: ${firstName || 'Unknown'}\nPhone: ${phone}\nSource: ${source}`,\n    parse_mode: 'HTML'\n  },\n  json: true\n});\n\nreturn $input.all();"
      },
      "id": "notify-telegram",
      "name": "Notify Telegram",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        520
      ]
    }
  ],
  "connections": {
    "Challenge Signup Webhook": {
      "main": [
        [
          {
            "node": "Extract Contact Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact Data": {
      "main": [
        [
          {
            "node": "Lookup/Create GHL Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup/Create GHL Contact": {
      "main": [
        [
          {
            "node": "Notify Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 0: Confirmation": {
      "main": [
        [
          {
            "node": "Wait until Day 1 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 1 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 1: ER Story",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 1: ER Story": {
      "main": [
        [
          {
            "node": "Wait until Day 2 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 2 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 2: Brain Science",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 2: Brain Science": {
      "main": [
        [
          {
            "node": "Wait until Day 3 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 3 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 3: Triggers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 3: Triggers": {
      "main": [
        [
          {
            "node": "Wait until Day 4 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 4 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 4: The Protocol",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 4: The Protocol": {
      "main": [
        [
          {
            "node": "Wait until Day 5 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 5 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 5: Personalized Plan",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 5: Personalized Plan": {
      "main": [
        [
          {
            "node": "Wait 5 Min",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 5 Min": {
      "main": [
        [
          {
            "node": "SMS Day 5: Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 5: Video": {
      "main": [
        [
          {
            "node": "Wait 3 Hours",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Hours": {
      "main": [
        [
          {
            "node": "SMS Day 5: The Offer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 5: The Offer": {
      "main": [
        [
          {
            "node": "Wait 6 Hours",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 6 Hours": {
      "main": [
        [
          {
            "node": "SMS Day 5: Last Nudge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 5: Last Nudge": {
      "main": [
        [
          {
            "node": "Wait until Day 7 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 7 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 7: Check-in",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 7: Check-in": {
      "main": [
        [
          {
            "node": "Wait until Day 14 8am ET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until Day 14 8am ET": {
      "main": [
        [
          {
            "node": "SMS Day 14: Final Check-in",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMS Day 14: Final Check-in": {
      "main": [
        []
      ]
    },
    "Notify Telegram": {
      "main": [
        [
          {
            "node": "SMS Day 0: Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "staticData": null,
  "meta": null,
  "pinData": null,
  "versionId": "292fd68b-c0af-4eca-ab96-7bc8e2aeab57",
  "activeVersionId": null,
  "versionCounter": 19,
  "triggerCount": 1,
  "shared": [
    {
      "updatedAt": "2026-03-30T03:34:06.220Z",
      "createdAt": "2026-03-30T03:34:06.220Z",
      "role": "workflow:owner",
      "workflowId": "b5tXV70CaejAwvv6",
      "projectId": "91dLj8Hg37i136qG",
      "project": {
        "updatedAt": "2026-03-22T06:53:28.112Z",
        "createdAt": "2026-02-12T18:32:53.056Z",
        "id": "91dLj8Hg37i136qG",
        "name": "Bryce Folsom <bfolsom@emersonnorth.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "creatorId": "17d3676f-3e74-4586-8363-5c1f4d237ed7"
      }
    }
  ],
  "tags": [],
  "activeVersion": null
}