{
 "name": "Appointment SMS reminders from Google Calendar (AutomateRecipes)",
 "nodes": [
  {
   "parameters": {
    "rule": {
     "interval": [
      {
       "field": "cronExpression",
       "expression": "0 18 * * *"
      }
     ]
    }
   },
   "id": "86b7db7a-d31f-5c9f-a38e-b93f920e7ecf",
   "name": "Every day 18:00",
   "type": "n8n-nodes-base.scheduleTrigger",
   "typeVersion": 1.2,
   "position": [
    0,
    0
   ]
  },
  {
   "parameters": {},
   "id": "17ef7b1a-39a9-5cd2-a758-16f72393456d",
   "name": "Run manually (test)",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    0,
    200
   ]
  },
  {
   "parameters": {
    "operation": "getAll",
    "calendar": {
     "__rl": true,
     "mode": "list",
     "value": "primary"
    },
    "returnAll": true,
    "timeMin": "={{ $now.plus({days:1}).startOf('day').toISO() }}",
    "timeMax": "={{ $now.plus({days:1}).endOf('day').toISO() }}",
    "options": {
     "singleEvents": true
    }
   },
   "id": "48853ac2-100e-59c0-afe9-49f2e19fd349",
   "name": "Google Calendar: tomorrow's events",
   "type": "n8n-nodes-base.googleCalendar",
   "typeVersion": 1.2,
   "position": [
    220,
    100
   ]
  },
  {
   "parameters": {
    "jsCode": "// Put the client's phone in the event description as: Phone: +9665...\nconst ev=$input.all().map(i=>i.json);\nconst data=ev.some(e=>e.start)?ev:[{summary:'Haircut \u2013 Omar',start:{dateTime:'2026-10-17T10:30:00+03:00'},description:'Phone: +966500000003'},{summary:'Team lunch',start:{dateTime:'2026-10-17T13:00:00+03:00'},description:''}];\nreturn data.map(e=>{const m=String(e.description||'').match(/phone:\\s*(\\+?[0-9 ]{7,})/i);if(!m)return null;const t=new Date(e.start.dateTime||e.start.date);return {json:{phone:m[1].replace(/\\s/g,''),title:e.summary,time:t.toISOString().slice(11,16)+' UTC'}}}).filter(Boolean);"
   },
   "id": "7fd1eb98-b3a2-50c3-a8a2-5fa2abecd167",
   "name": "Find client phone",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    440,
    100
   ]
  },
  {
   "parameters": {
    "from": "+15550001111",
    "to": "={{ $json.phone }}",
    "message": "=Reminder: {{ $json.title }} tomorrow. Reply C to confirm or R to reschedule.",
    "options": {}
   },
   "id": "676d7c41-03d8-5723-8164-d8deb47a0481",
   "name": "Twilio: send reminder",
   "type": "n8n-nodes-base.twilio",
   "typeVersion": 1,
   "position": [
    660,
    100
   ]
  }
 ],
 "connections": {
  "Every day 18:00": {
   "main": [
    [
     {
      "node": "Google Calendar: tomorrow's events",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Run manually (test)": {
   "main": [
    [
     {
      "node": "Google Calendar: tomorrow's events",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Google Calendar: tomorrow's events": {
   "main": [
    [
     {
      "node": "Find client phone",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Find client phone": {
   "main": [
    [
     {
      "node": "Twilio: send reminder",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "active": false,
 "settings": {
  "executionOrder": "v1"
 },
 "pinData": {}
}