Build pack: Membership cancel-saver build pack
Everything from the video: the prompt that writes the note, the importable n8n workflow with both paths, and the setup checklist.
Watch the build: full video · 60-second version
- prompt
The cancel-note 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 gym. A member, {{ $json.name }}, just asked to cancel. Reason: {{ $json.reason }}. Their note: "{{ $json.note }}". The code checked the member list: {{ $json.said }}. Write a short, warm note in [OWNER]'s voice. Thank them by name and say no hard feelings. If the code said route offer, say there is one option below that might suit them better, and that cancelling is one click if not. If the code said route owner, mention no option: say you will be in touch personally. Read the note: if they sound angry, mention a refund, a billing problem, an injury that needs care, or a complaint about the gym, say route owner: the owner calls those members. No prices, numbers, dates or plan names: the offer is added from the sheet. Answer as JSON: {"route": "offer or owner", "why": "under 12 words", "intro": "under 45 words, signed [OWNER]"} - 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": "Cancel requests answered in seconds (code reads your member list and picks the save offer, AI writes the note in your voice, the cancel link always rides along; loyal or unhappy members go to you with a note drafted)", "nodes": [ { "name": "Cancel request", "type": "n8n-nodes-base.formTrigger", "typeVersion": 2.2, "position": [ 0, 0 ], "parameters": { "formTitle": "[BUSINESS]", "formDescription": "Cancel your membership.", "formFields": { "values": [ { "fieldLabel": "Name", "requiredField": true }, { "fieldLabel": "Email", "fieldType": "email", "requiredField": true }, { "fieldLabel": "Reason", "fieldType": "dropdown", "requiredField": true, "fieldOptions": { "values": [ { "option": "Not using it enough" }, { "option": "Too expensive" }, { "option": "Injury or health" }, { "option": "Moving away" }, { "option": "Unhappy with the gym" }, { "option": "Other" } ] } }, { "fieldLabel": "Anything else?", "fieldType": "textarea" } ] }, "options": { "appendAttribution": false, "path": "member-cancel", "respondWithOptions": { "values": { "formSubmittedText": "Got it. Check your email in a minute." } } } } }, { "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=Members!A2:F2000&ranges=Settings!A2:B20&ranges=Cancellations!A2:F2000", "authentication": "predefinedCredentialType", "nodeCredentialType": "googleDriveOAuth2Api", "options": {} } }, { "name": "Find the member", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 0, 448 ], "parameters": { "mode": "runOnceForAllItems", "language": "javaScript", "jsCode": "const T = s => String(s ?? '').trim();\nconst F = $('Cancel request').first().json;\nconst name = T(F['Name']).slice(0, 60), email = T(F['Email']).toLowerCase(), note = T(F[\"Anything else?\"]).replace(/\\s+/g, ' ').slice(0, 300);\nconst REASONS = [\"Not using it enough\", \"Too expensive\", \"Injury or health\", \"Moving away\", \"Unhappy with the gym\", \"Other\"];\nconst reason = T(F['Reason']);\nif (!name || !/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(email) || !REASONS.includes(reason)) return [];\nconst vr = $('Read the sheet').first().json.valueRanges || [];\nconst members = (vr[0] || {}).values || [], settings = (vr[1] || {}).values || [], log = (vr[2] || {}).values || [];\nconst now = $now.setZone('America/New_York'), today = now.toFormat('MM/dd/yyyy');\nif (log.some(r => T(r[0]) === today && T(r[2]).toLowerCase() === email)) return [];\nconst set = Object.fromEntries(settings.map(r => [T(r[0]).toLowerCase(), T(r[1])]));\nconst loyal = Math.max(1, Number(set['loyal after (months)']) || 24);\nconst r = members.find(x => T(x[0]).toLowerCase() === email);\nconst m = r ? { plan: T(r[2]), monthly: Number(T(r[3]).replace(/[$,]/g, '')) || 0, joined: T(r[4]), visits: T(r[5]) } : null;\nlet months = -1;\nif (m) { const j = /^(\\d{1,2})\\/(\\d{4})$/.exec(m.joined); if (j) months = (now.year - Number(j[2])) * 12 + (now.month - Number(j[1])); }\nconst span = n => n >= 24 ? `${Math.floor(n / 12)} years` : n >= 12 ? '1 year' : `${n} month${n === 1 ? '' : 's'}`;\nconst facts = m ? `${m.plan} plan, $${m.monthly} a month, member ${months >= 0 ? span(months) : '(join date unknown)'}, ${m.visits || '?'} visit${m.visits === '1' ? '' : 's'} in the last 30 days` : 'not on your member list';\nconst cheap = set['cheaper plan'] || '', cheapPrice = set['cheaper price'] || '';\nlet offer = '', offerLine = '', offerLink = '', why = '';\nif (!m) why = 'that email is not on your member list';\nelse if (months < 0) why = 'their join date on the sheet is unreadable';\nelse if (months >= loyal) why = `a loyal member (${span(months)}), worth a personal call`;\nelse if (reason === 'Moving away') why = 'moving away, no offer fits';\nelse if (reason === 'Unhappy with the gym') why = 'unhappy with the gym, worth hearing why';\nelse if (reason === 'Other') why = 'a reason the offers do not cover';\nelse if (reason === 'Too expensive' && cheap && cheapPrice && set['switch link'] && m.plan.toLowerCase() !== cheap.toLowerCase()) {\n offer = cheap + ' plan'; offerLine = `Switch to ${cheap} for $${cheapPrice} a month.`; offerLink = set['switch link']; }\nelse if (set['pause offer'] && set['pause link']) { offer = 'Pause'; offerLine = set['pause offer']; offerLink = set['pause link']; }\nelse why = 'no offer is set up on the Settings tab';\nconst cancel = set['cancel link'] || '';\nif (!why && !cancel) why = 'no cancel link on the Settings tab';\nreturn [{ json: { name, email, reason, note: note || 'none', facts, plan: m ? m.plan : '', offer, offerLine, offerLink, cancel,\n want: why ? 'owner' : 'offer', why, said: why ? `${why}, route owner (say you will be in touch personally)` : `${facts}; an option fits, route offer` } }];" } }, { "name": "Prompt for Claude", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 0, 672 ], "parameters": { "assignments": { "assignments": [ { "id": "p1", "name": "prompt", "type": "string", "value": "=[BUSINESS] is [OWNER]'s gym. A member, {{ $json.name }}, just asked to cancel. Reason: {{ $json.reason }}. Their note: \"{{ $json.note }}\". The code checked the member list: {{ $json.said }}. Write a short, warm note in [OWNER]'s voice. Thank them by name and say no hard feelings. If the code said route offer, say there is one option below that might suit them better, and that cancelling is one click if not. If the code said route owner, mention no option: say you will be in touch personally. Read the note: if they sound angry, mention a refund, a billing problem, an injury that needs care, or a complaint about the gym, say route owner: the owner calls those members. No prices, numbers, dates or plan names: the offer is added from the sheet. Answer as JSON: {\"route\": \"offer or owner\", \"why\": \"under 12 words\", \"intro\": \"under 45 words, signed [OWNER]\"}" }, { "id": "p2", "name": "name", "type": "string", "value": "={{ $json.name }}" }, { "id": "p3", "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:F: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 = [\"offer\", \"owner\"];\nconst m = String(b.route ?? '').trim().toLowerCase();\nout.route = MOODS.includes(m) ? m : \"owner\";\nconst c = $('Find the member').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 call'); }\nelse if (ai !== 'offer') { out.route = 'owner'; out.why = 'the reply did not match the member list, nothing was sent'; }\nif (out.route !== 'owner' && /[\\d$%]/.test(out.intro)) { out.route = 'owner'; out.why = 'the note had a price or number in it, nothing was sent'; }\nif (out.intro.trim().length < 20) { out.route = 'owner'; out.why = out.why || 'the note came back empty'; out.intro = 'no note drafted, write this one yourself'; }\nif (!out.why) out.why = 'worth a look before it is sent';\nout.to = '';\nif (out.route === 'offer') { 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": "Who answers?", "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": "offer", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} } }, { "name": "Send the offer", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ -260, 1792 ], "parameters": { "sendTo": "={{ $('Check the reply').item.json.body.to }}", "emailType": "text", "subject": "Before you go", "message": "={{ $('Check the reply').item.json.body.intro + '\\n\\nOne option:\\n' + $('Find the member').item.json.offerLine + '\\n' + $('Find the member').item.json.offerLink + '\\n\\nStill want to cancel? One click, no questions:\\n' + $('Find the member').item.json.cancel }}", "options": { "appendAttribution": false, "senderName": "[BUSINESS]" } } }, { "name": "Log the offer", "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/Cancellations!A:F: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'), $('Find the member').item.json.name, $('Find the member').item.json.email, $('Find the member').item.json.reason, $('Find the member').item.json.offer, 'Offer 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 member wants to cancel", "message": "={{ 'Why it came to you: ' + $('Check the reply').item.json.body.why + '\\n\\nThe member: ' + $('Find the member').item.json.name + ', ' + $('Find the member').item.json.facts + '\\n\\nReason: ' + $('Find the member').item.json.reason + '\\n\\nTheir note: ' + $('Find the member').item.json.note + '\\n\\nNote, drafted:\\n' + $('Check the reply').item.json.body.intro + '\\n\\nNothing was sent. It is on your Cancellations 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/Cancellations!A:F: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'), $('Find the member').item.json.name, $('Find the member').item.json.email, $('Find the member').item.json.reason, '', 'Call: ' + $('Check the reply').item.json.body.why ]] }) }}", "options": {} } } ], "connections": { "Cancel request": { "main": [ [ { "node": "Read the sheet", "type": "main", "index": 0 } ] ] }, "Read the sheet": { "main": [ [ { "node": "Find the member", "type": "main", "index": 0 } ] ] }, "Find the member": { "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": "Who answers?", "type": "main", "index": 0 } ] ] }, "Who answers?": { "main": [ [ { "node": "Send the offer", "type": "main", "index": 0 } ], [ { "node": "Tell the owner", "type": "main", "index": 0 } ] ] }, "Send the offer": { "main": [ [ { "node": "Log the offer", "type": "main", "index": 0 } ] ] }, "Tell the owner": { "main": [ [ { "node": "Log for the owner", "type": "main", "index": 0 } ] ] } } } - text
Setup checklist
About an hour, most of it getting your member list into the sheet.
1. Make a Google Sheet with tabs Members, Settings, Cancellations and Queue. Members columns, in this order: Email, Name, Plan, Monthly, Joined (MM/YYYY), Visits (30 days). Settings rows, name in column A and value in column B: 'Pause offer', 'Pause link', 'Cheaper plan', 'Cheaper price', 'Switch link', 'Cancel link', 'Loyal after (months)'. Cancellations columns: Date, Name, Email, Reason, Offer sent, Status. 2. Import the workflow into n8n and put the sheet ID into 'Read the sheet', 'Queue for Claude', 'Log the offer' and 'Log for the owner'. 3. The Reason dropdown on the form in 'Cancel request' and the REASONS list at the top of 'Find the member' must match. Change both together. 4. The rules live in 'Find the member': not using it enough or injury / health gets the pause offer; too expensive gets the cheaper plan (or the pause if they are already on it); moving away, unhappy, other, an email not on your member list, or anyone who joined at least 'Loyal after (months)' ago comes to you. The same email twice in one day is ignored. 5. Connect Gmail. In 'Check the reply' replace YOUR_ALERT_EMAIL with your address and put your test addresses in TEST_ADDRESSES. 6. 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. 7. What the code decides, not the AI: 'Find the member' picks the offer and the path. The AI can only move a member to you (angry, a refund or billing problem, an injury that needs care, a complaint), never the other way. 'Check the reply' sends it to you if the AI's text has any digit, $ or %. The offer, prices and links come from your sheet, and subjects are fixed text. 8. Keep the cancel link in the offer email. Making people jump through hoops to cancel is against the rules in a lot of places (and it makes people angry). The offer works because cancelling is still one click. 9. Test with your own addresses first: a member who is 'not using it enough' (you should get the pause offer), one who joined long ago (only the alert should arrive), and an email that is not on your member list. Before going live: the offer goes to the member who matches the email typed into the form, so protect the trigger first (form authentication, members-only login, or an internal-only trigger such as your booking software's own cancel event posting through a secret), then set TEST_MODE to false in 'Check the reply'. Until then, emails go only to the addresses in TEST_ADDRESSES. The form is public while it is active.
Written and built by an AI. What that means →