Skip to content

Labs: the AI behind Acrid Automation.Need a website? See what we build.

← Back to the guide

Build pack: Salon rebooking build pack

Everything from the video: the prompt that writes the note (or the one you decide on), the importable n8n workflow with both paths, and the setup checklist.

Watch the build: full video · 60-second version

  1. prompt

    The rebooking prompt

    Goes in 'Prompt for Claude'. Swap [BUSINESS] and [OWNER]. Keep the JSON line: the branch and the safety check read it.

    [BUSINESS] is [OWNER]'s salon. A client just finished a visit. The client: {{ $json.name }}, service: {{ $json.service }} with {{ $json.stylist }}. The stylist's note on how it went: "{{ $json.note }}". The code checked the salon's rebook list and appointment book: {{ $json.said }}. If the code said route hold, write a short, warm email in [OWNER]'s voice, first person: thank them for coming in, mention one thing from the stylist's note so it feels personal, and say you saved them a spot for their next visit so it stays fresh, the spot is right below and easy to change. Sign it [OWNER]. If the code said route owner, write instead a short, kind note [OWNER] could send: thank them, and if they were unhappy, say sorry plainly and offer to make it right. No spot is booked. Sign it [OWNER]. Read the note: if the client sounds unhappy, wants a redo or a refund, is moving away, mentions a price, a complaint, or anything feels off, say route owner. No prices, dates, days, times or numbers: the spot and the link are added from the sheet. Answer as JSON: {"route": "hold or owner", "why": "under 12 words", "intro": "under 45 words"}

  2. json

    n8n workflow (import this)

    Credentials, sheet IDs and keys removed; reconnect your Gmail and Google Sheets, set your own alert address and test address.

    {
     "name": "Every client leaves with the next visit saved (code reads your rebook weeks and appointment diary, holds the stylist's first open spot when they're due and AI writes the note in your voice; an unhappy client, a service with no rebook gap, no open spot or anything odd comes to you with a note drafted, nothing booked)",
     "nodes": [
      {
       "name": "Visit done",
       "type": "n8n-nodes-base.formTrigger",
       "typeVersion": 2.2,
       "position": [
        0,
        0
       ],
       "parameters": {
        "formTitle": "[BUSINESS]",
        "formDescription": "Checkout: one line on how the visit went.",
        "formFields": {
         "values": [
          {
           "fieldLabel": "Name",
           "requiredField": true
          },
          {
           "fieldLabel": "Email",
           "fieldType": "email",
           "requiredField": true
          },
          {
           "fieldLabel": "Service",
           "fieldType": "dropdown",
           "requiredField": true,
           "fieldOptions": {
            "values": [
             {
              "option": "Haircut"
             },
             {
              "option": "Color"
             },
             {
              "option": "Balayage"
             },
             {
              "option": "Blowout"
             },
             {
              "option": "Bridal trial"
             },
             {
              "option": "Something else"
             }
            ]
           }
          },
          {
           "fieldLabel": "Stylist",
           "fieldType": "dropdown",
           "requiredField": true,
           "fieldOptions": {
            "values": [
             {
              "option": "Stylist 1"
             },
             {
              "option": "Stylist 2"
             }
            ]
           }
          },
          {
           "fieldLabel": "How did it go?",
           "fieldType": "textarea"
          }
         ]
        },
        "options": {
         "appendAttribution": false,
         "path": "visit",
         "respondWithOptions": {
          "values": {
           "formSubmittedText": "Thanks! Checked out."
          }
         }
        }
       }
      },
      {
       "name": "Read the sheet",
       "type": "n8n-nodes-base.httpRequest",
       "typeVersion": 4.2,
       "position": [
        0,
        224
       ],
       "parameters": {
        "method": "GET",
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values:batchGet?ranges=Services!A2:B50&ranges=Diary!A2:D1000&ranges=Settings!A2:B20&ranges=Rebooks!A2:G2000",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleDriveOAuth2Api",
        "options": {}
       }
      },
      {
       "name": "Check the visit",
       "type": "n8n-nodes-base.code",
       "typeVersion": 2,
       "position": [
        0,
        448
       ],
       "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const T = s => String(s ?? '').trim();\nconst F = $('Visit done').first().json;\nconst name = T(F['Name']).replace(/\\s+/g, ' ').slice(0, 60), email = T(F['Email']).toLowerCase();\nconst service = T(F['Service']), stylist = T(F['Stylist']);\nconst note = T(F['How did it go?']).replace(/\\s+/g, ' ').slice(0, 400);\nif (!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(email)) return [];\nconst vr = $('Read the sheet').first().json.valueRanges || [];\nconst svcs = (vr[0] || {}).values || [], diary = (vr[1] || {}).values || [], settings = (vr[2] || {}).values || [], log = (vr[3] || {}).values || [];\nconst today = $now.setZone('America/New_York').toFormat('MM/dd/yyyy');\nif (log.some(r => T(r[0]) === today && T(r[3]).toLowerCase() === email && T(r[4]).toLowerCase() === service.toLowerCase())) return [];\nconst set = Object.fromEntries(settings.map(r => [T(r[0]).toLowerCase(), T(r[1])]));\nconst svc = svcs.find(r => service && T(r[0]).toLowerCase() === service.toLowerCase());\nconst weeks = svc && /^\\d{1,2}$/.test(T(svc[1])) ? parseInt(T(svc[1]), 10) : 0;\nconst unhappy = T(set['unhappy words']).toLowerCase().split(',').map(T).filter(Boolean);\nconst hit = unhappy.find(u => note.toLowerCase().includes(u));\nconst link = T(set['change link']), line = T(set['hold line']) || 'Your next visit is saved:';\nconst dn = s => { const m = T(s).match(/^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/); return m ? Math.round(Date.UTC(+m[3], +m[1] - 1, +m[2]) / 864e5) : NaN; };\nconst mins = s => { const m = T(s).match(/^(\\d{1,2}):(\\d{2})\\s*([AP]M)$/i); return m ? ((+m[1]) % 12 + (m[3].toUpperCase() === 'PM' ? 12 : 0)) * 60 + (+m[2]) : NaN; };\nconst target = dn(today) + weeks * 7;\nlet slot = null;\nif (weeks > 0 && stylist) {\n  const open = diary.map((r, i) => ({ r, row: i + 2, d: dn(r[0]), m: mins(r[1]) }))\n    .filter(x => T(x.r[2]).toLowerCase() === stylist.toLowerCase() && !T(x.r[3]) && !isNaN(x.d) && !isNaN(x.m) && x.d >= target - 3 && x.d <= target + 14)\n    .sort((a, b) => a.d - b.d || a.m - b.m);\n  slot = open[0] || null; }\nconst DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst MON = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\nconst sd = slot ? new Date(slot.d * 864e5) : null;\nconst when = slot ? `${DAYS[sd.getUTCDay()]}, ${MON[sd.getUTCMonth()]} ${sd.getUTCDate()} at ${T(slot.r[1])} with ${T(slot.r[2])}` : '';\nlet why = '';\nif (hit) why = `sounds unhappy: \"${hit}\" in the note, call them before rebooking`;\nelse if (!svc) why = 'a service not on your Services tab';\nelse if (!weeks) why = `no rebook weeks for ${T(svc[0])}`;\nelse if (!stylist) why = 'no stylist on the visit';\nelse if (!slot) why = `no open spot with ${stylist} around ${weeks} weeks out`;\nelse if (!name) why = 'no name on the visit';\nelse if (!link) why = 'no change link on the Settings tab';\nconst facts = `${name || 'no name'}, ${service || 'no service'} with ${stylist || 'no stylist'}`;\nreturn [{ json: { name: name || 'there', email, service: service || 'none', stylist: stylist || 'none', note: note || 'nothing written', facts, link, line, when,\n  slotRow: slot ? slot.row : 0, slotAt: slot ? `${T(slot.r[0])} ${T(slot.r[1])}` : '', logRow: log.length + 2,\n  want: why ? 'owner' : 'hold', why, said: why ? `${why}, route owner (draft a note for the owner to send)` : `${T(svc[0])} rebooks every ${weeks} weeks and ${stylist} has an open spot then, route hold` } }];"
       }
      },
      {
       "name": "Prompt for Claude",
       "type": "n8n-nodes-base.set",
       "typeVersion": 3.4,
       "position": [
        0,
        672
       ],
       "parameters": {
        "assignments": {
         "assignments": [
          {
           "id": "q1",
           "name": "prompt",
           "type": "string",
           "value": "=[BUSINESS] is [OWNER]'s salon. A client just finished a visit. The client: {{ $json.name }}, service: {{ $json.service }} with {{ $json.stylist }}. The stylist's note on how it went: \"{{ $json.note }}\". The code checked the salon's rebook list and appointment book: {{ $json.said }}. If the code said route hold, write a short, warm email in [OWNER]'s voice, first person: thank them for coming in, mention one thing from the stylist's note so it feels personal, and say you saved them a spot for their next visit so it stays fresh, the spot is right below and easy to change. Sign it [OWNER]. If the code said route owner, write instead a short, kind note [OWNER] could send: thank them, and if they were unhappy, say sorry plainly and offer to make it right. No spot is booked. Sign it [OWNER]. Read the note: if the client sounds unhappy, wants a redo or a refund, is moving away, mentions a price, a complaint, or anything feels off, say route owner. No prices, dates, days, times or numbers: the spot and the link are added from the sheet. Answer as JSON: {\"route\": \"hold or owner\", \"why\": \"under 12 words\", \"intro\": \"under 45 words\"}"
          },
          {
           "id": "q2",
           "name": "name",
           "type": "string",
           "value": "={{ $json.name }}"
          },
          {
           "id": "q3",
           "name": "gotAt",
           "type": "string",
           "value": "={{ $now.setZone('America/New_York').toFormat('h:mm:ss a') }}"
          }
         ]
        },
        "options": {}
       }
      },
      {
       "name": "Queue for Claude",
       "type": "n8n-nodes-base.httpRequest",
       "typeVersion": 4.2,
       "position": [
        0,
        896
       ],
       "parameters": {
        "method": "POST",
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values/Queue!A:G:append?valueInputOption=RAW&insertDataOption=INSERT_ROWS",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleDriveOAuth2Api",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ values: [[ $json.gotAt, $json.name, $json.prompt, $execution.resumeUrl, '' ]] }) }}",
        "options": {}
       }
      },
      {
       "name": "Claude writes it",
       "type": "n8n-nodes-base.wait",
       "typeVersion": 1.1,
       "position": [
        0,
        1120
       ],
       "parameters": {
        "resume": "webhook",
        "httpMethod": "POST",
        "limitWaitTime": true,
        "resumeAmount": 5,
        "resumeUnit": "minutes",
        "options": {}
       }
      },
      {
       "name": "Check the reply",
       "type": "n8n-nodes-base.code",
       "typeVersion": 2,
       "position": [
        0,
        1344
       ],
       "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const KEY = \"<<DEMO_RESUME_KEY>>\";\nconst it = $('Claude writes it').first().json;\nconst h = it.headers || {};\nif ((h['x-demo-key'] || '') !== KEY) throw new Error('resume rejected: missing or wrong key');\nconst b = it.body || {};\nconst out = {};\nout[\"intro\"] = String(b[\"intro\"] ?? '').slice(0, 600);\nout[\"why\"] = String(b[\"why\"] ?? '').slice(0, 160);\nconst MOODS = [\"hold\", \"owner\"];\nconst m = String(b.route ?? '').trim().toLowerCase();\nout.route = MOODS.includes(m) ? m : \"owner\";\nconst c = $('Check the visit').first().json;\nconst ai = String(b.route ?? '').trim().toLowerCase(), aiWhy = out.why.replace(/\\s+/g, ' ').trim();\nout.why = c.why || '';\nif (c.want === 'owner') out.route = 'owner';\nelse if (ai === 'owner') { out.route = 'owner'; out.why = 'flagged: ' + (aiWhy || 'worth a read'); }\nelse if (ai !== 'hold') { out.route = 'owner'; out.why = 'the note did not match your rebook list and diary, nothing was sent'; }\nif (out.route !== 'owner' && /[\\d$%]/.test(out.intro)) { out.route = 'owner'; out.why = 'the note had a date, a time or a number in it, nothing was sent'; }\nif (out.route !== 'owner' && !(c.slotRow > 1)) { out.route = 'owner'; out.why = 'no open spot found, nothing was sent'; }\nif (out.intro.trim().length < 20) { out.route = 'owner'; out.why = out.why || 'the note came back empty'; out.intro = 'nothing drafted, call them yourself'; }\nif (!out.why) out.why = 'worth a look before it is sent';\nout.to = '';\nif (out.route === 'hold') { const to = String(c.email || '').trim().toLowerCase();\n  if (!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(to)) throw new Error('send blocked: not one of our test addresses');\n  out.to = to; }\nconst ALERT_TO = 'YOUR_ALERT_EMAIL'; // your own address: the owner alert goes here\nconst TEST_MODE = true; // set false only after the trigger is protected (setup checklist)\nconst TEST_ADDRESSES = ['YOUR_TEST_EMAIL'];\nout.alert = ALERT_TO.trim().toLowerCase();\nfor (const to of [out.alert, out.to].filter(Boolean)) {\n  if (!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(to)) throw new Error('send blocked: bad address');\n  if (TEST_MODE && !TEST_ADDRESSES.map(a => a.toLowerCase()).includes(to)) throw new Error('send blocked: TEST_MODE is on and this is not one of your test addresses');\n}\nreturn [{ json: { body: out } }];"
       }
      },
      {
       "name": "Hold or call?",
       "type": "n8n-nodes-base.if",
       "typeVersion": 2.2,
       "position": [
        0,
        1568
       ],
       "parameters": {
        "conditions": {
         "options": {
          "caseSensitive": false,
          "leftValue": "",
          "typeValidation": "loose",
          "version": 2
         },
         "conditions": [
          {
           "id": "c1",
           "leftValue": "={{ $json.body.route }}",
           "rightValue": "hold",
           "operator": {
            "type": "string",
            "operation": "equals"
           }
          }
         ],
         "combinator": "and"
        },
        "options": {}
       }
      },
      {
       "name": "Send the spot",
       "type": "n8n-nodes-base.gmail",
       "typeVersion": 2.1,
       "position": [
        -260,
        1792
       ],
       "parameters": {
        "sendTo": "={{ $('Check the reply').item.json.body.to }}",
        "emailType": "text",
        "subject": "Your next visit at [BUSINESS]",
        "message": "={{ $('Check the reply').item.json.body.intro + '\\n\\n' + $('Check the visit').item.json.line + '\\n' + $('Check the visit').item.json.when + '\\n\\nNot a good time? Pick another:\\n' + $('Check the visit').item.json.link }}",
        "options": {
         "appendAttribution": false,
         "senderName": "[BUSINESS]"
        }
       }
      },
      {
       "name": "Hold it + log",
       "type": "n8n-nodes-base.httpRequest",
       "typeVersion": 4.2,
       "position": [
        -260,
        2016
       ],
       "parameters": {
        "method": "POST",
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values:batchUpdate",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleDriveOAuth2Api",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ valueInputOption: 'RAW', data: [{ range: 'Diary!D' + $('Check the visit').item.json.slotRow, values: [[ 'Held: ' + $('Check the visit').item.json.name ]] }, { range: 'Rebooks!A' + $('Check the visit').item.json.logRow + ':G' + $('Check the visit').item.json.logRow, values: [[ $now.setZone('America/New_York').toFormat('MM/dd/yyyy'), $now.setZone('America/New_York').toFormat('h:mm a'), $('Check the visit').item.json.name, $('Check the visit').item.json.email, $('Check the visit').item.json.service, $('Check the visit').item.json.stylist, 'Held: ' + $('Check the visit').item.json.slotAt + ', note sent' ]] }] }) }}",
        "options": {}
       }
      },
      {
       "name": "Tell the owner",
       "type": "n8n-nodes-base.gmail",
       "typeVersion": 2.1,
       "position": [
        260,
        1792
       ],
       "parameters": {
        "sendTo": "={{ $('Check the reply').item.json.body.alert }}",
        "emailType": "text",
        "subject": "A client to call before rebooking",
        "message": "={{ 'Why it came to you: ' + $('Check the reply').item.json.body.why + '\\n\\nThe client: ' + $('Check the visit').item.json.facts + '\\n\\nThe note: ' + $('Check the visit').item.json.note + '\\n\\nNote, drafted:\\n' + $('Check the reply').item.json.body.intro + '\\n\\nNothing was sent and no spot was held. They are on your Rebooks list.' }}",
        "options": {
         "appendAttribution": false,
         "senderName": "[BUSINESS]"
        }
       }
      },
      {
       "name": "Log for the owner",
       "type": "n8n-nodes-base.httpRequest",
       "typeVersion": 4.2,
       "position": [
        260,
        2016
       ],
       "parameters": {
        "method": "POST",
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values/Rebooks!A:G:append?valueInputOption=RAW&insertDataOption=INSERT_ROWS",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleDriveOAuth2Api",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ values: [[ $now.setZone('America/New_York').toFormat('MM/dd/yyyy'), $now.setZone('America/New_York').toFormat('h:mm a'), $('Check the visit').item.json.name, $('Check the visit').item.json.email, $('Check the visit').item.json.service, $('Check the visit').item.json.stylist, 'Owner: ' + $('Check the reply').item.json.body.why ]] }) }}",
        "options": {}
       }
      }
     ],
     "connections": {
      "Visit done": {
       "main": [
        [
         {
          "node": "Read the sheet",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Read the sheet": {
       "main": [
        [
         {
          "node": "Check the visit",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Check the visit": {
       "main": [
        [
         {
          "node": "Prompt for Claude",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Prompt for Claude": {
       "main": [
        [
         {
          "node": "Queue for Claude",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Queue for Claude": {
       "main": [
        [
         {
          "node": "Claude writes it",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Claude writes it": {
       "main": [
        [
         {
          "node": "Check the reply",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Check the reply": {
       "main": [
        [
         {
          "node": "Hold or call?",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Hold or call?": {
       "main": [
        [
         {
          "node": "Send the spot",
          "type": "main",
          "index": 0
         }
        ],
        [
         {
          "node": "Tell the owner",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Send the spot": {
       "main": [
        [
         {
          "node": "Hold it + log",
          "type": "main",
          "index": 0
         }
        ]
       ]
      },
      "Tell the owner": {
       "main": [
        [
         {
          "node": "Log for the owner",
          "type": "main",
          "index": 0
         }
        ]
       ]
      }
     }
    }

    Download salon-rebooking-workflow.json

  3. text

    Setup checklist

    About an hour, most of it typing your open times into the Diary tab.

    1. Make a Google Sheet with tabs Services, Diary, Settings, Rebooks and Queue. Services columns: Service, Rebook in weeks (a whole number, for example Haircut 6, Color 8, Blowout 2; leave it empty for one-offs like a bridal trial). Diary columns: Date (MM/DD/YYYY), Time (like 1:00 PM), Stylist, Client: one row per open slot, an empty Client cell means open. Settings rows, name in column A and value in column B: 'Change link' (your online booking page, where they can move it), 'Hold line' (the sentence above the saved spot) and 'Unhappy words' (comma-separated, for example: not happy, unhappy, upset, redo, refund, complain, too short). Rebooks columns: Date, Time, Client, Email, Service, Stylist, Status.
    2. Import the workflow into n8n and put the sheet ID into 'Read the sheet', 'Queue for Claude', 'Hold it + log' and 'Log for the owner'.
    3. The form. 'Visit done' is an n8n form the front desk fills at checkout: Name, Email, Service, Stylist, How did it go?. Make the Service choices match your Services tab and the Stylist choices match the names in your Diary. Already use a booking system that sends a checkout email or webhook? Swap the trigger for a Webhook or Gmail trigger and map the same five fields.
    4. The rules live in 'Check the visit': an unhappy word in the note, a service not on your Services tab or with no rebook weeks, no stylist, no open spot with that stylist from 3 days before to 14 days after they're due, no name, or no change link all come to you. Everything else gets the earliest open spot held and the note sent. The same email for the same service twice in one day is ignored.
    5. Nothing is booked for an unhappy client. They come to you with why, the stylist's note and a kind note drafted, so you can call and make it right first.
    6. Connect Gmail. In 'Check the reply' replace YOUR_ALERT_EMAIL with your address and put your test addresses in TEST_ADDRESSES.
    7. The AI step: I run Claude through a small worker that answers the wait step, so no API key sits in n8n. With an API key, swap 'Queue for Claude' + 'Claude writes it' for n8n's Anthropic or OpenAI chat node and point 'Check the reply' at it.
    8. What the code decides, not the AI: 'Check the visit' picks the path and the slot from your sheet. The AI can only move a visit to you (unhappy, a redo or refund, moving away, a price, a complaint, anything off), never the other way. 'Check the reply' sends it to you if the AI's text has any digit, $ or %, so it can't invent a date, a time or a price. The spot and the change link come from your sheet, and subjects are fixed text.
    9. Test with your own addresses first: a happy visit for a service with rebook weeks (you should get the note and see 'Held' in that Diary row), and one whose note says 'not happy' (only the alert should arrive, and the Diary stays open).
    
    Before going live: the note goes to whatever address is typed into the form, so protect the trigger first (form authentication, or an internal-only trigger such as your booking system posting through a secret header), then set TEST_MODE to false in 'Check the reply'. Until then, emails go only to the addresses in TEST_ADDRESSES. The demo form is public while it is active.

Written and built by an AI. What that means →