{
  "schema_version": "1.0.0",
  "id": "no-show-text-reschedule",
  "title": "Text a no-show a link to reschedule",
  "category": "booking",
  "difficulty": "intermediate",
  "featured": false,
  "description": "When the front desk marks an appointment as no-show in the attendance sheet, the client gets a polite text with a reschedule link.",
  "tags": [
    "booking",
    "no-show",
    "google-sheets",
    "twilio",
    "sms"
  ],
  "apps": [
    "Google Sheets",
    "Filter by Zapier",
    "Code by Zapier",
    "Twilio"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 4 steps after the trigger",
      "Filter by Zapier"
    ]
  },
  "tasks": {
    "typical": 0,
    "max": 3
  },
  "trigger": {
    "app": "Google Sheets",
    "event": "New or Updated Spreadsheet Row",
    "kind": "polling",
    "title": "Attendance row updated",
    "why": "Fires when the status column of a row changes, which is when the front desk marks the outcome.",
    "config": {
      "Drive": "My Google Drive",
      "Spreadsheet": "Front desk",
      "Worksheet": "Attendance",
      "Trigger Column": "status"
    },
    "outputs": [
      "row_number",
      "appointment_at",
      "client_name",
      "phone",
      "service",
      "status",
      "reschedule_link"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "no_show",
      "kind": "filter",
      "app": "Filter by Zapier",
      "event": "Only continue if...",
      "title": "Only rows marked no-show",
      "why": "Attended and cancelled rows stop here. Most appointments are attended, so most runs end at this step.",
      "conditions": [
        [
          {
            "field": "{{trigger.status}}",
            "operator": "(Text) Exactly matches",
            "value": "no-show"
          }
        ]
      ],
      "usually": false
    },
    {
      "key": "phone",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Format the phone number",
      "why": "Front desk numbers are typed every possible way.",
      "code": {
        "language": "javascript",
        "module": "normalize-phone",
        "file": "code/normalize-phone.js"
      },
      "input_data": {
        "phone": "{{trigger.phone}}",
        "default_country": "44"
      },
      "outputs": [
        "e164",
        "valid",
        "extension"
      ]
    },
    {
      "key": "sms",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Write the text",
      "why": "Warm, no blame, and short enough for one segment with the link.",
      "code": {
        "language": "javascript",
        "module": "fit-sms",
        "file": "code/fit-sms.js"
      },
      "input_data": {
        "template": "Hi {first_name}, we missed you at {business} today. No problem at all. Pick a new time for your {{trigger.service}} here:",
        "first_name": "{{trigger.client_name}}",
        "business": "YOUR_BUSINESS_NAME",
        "link": "{{trigger.reschedule_link}}"
      },
      "outputs": [
        "message",
        "encoding",
        "length",
        "segments",
        "trimmed"
      ]
    },
    {
      "key": "text",
      "kind": "action",
      "app": "Twilio",
      "event": "Send SMS",
      "title": "Send the text",
      "why": "From the clinic number, so replies reach the front desk.",
      "fields": {
        "From Number": "YOUR_TWILIO_NUMBER",
        "To Number": "{{phone.e164}}",
        "Message": "{{sms.message}}",
        "Send Large Messages?": "No"
      },
      "outputs": [
        "sid",
        "status"
      ]
    }
  ]
}
