Templates / Enforce SMS and email opt-outs with Twilio and Google Sheets

Enforce SMS and email opt-outs with Twilio and Google Sheets

Ready for 3.0

by Dele Tosh @ Protomated ✓ · 1 views · created 2026-07-21 · Document Extraction

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (6)

Google Sheets

What it does

Quick overview This workflow adds a reusable compliance layer for outbound SMS/email by checking a Google Sheets opt-out list, appending TCPA opt-out language, and writing an audit log, and it also receives inbound Twilio SMS STOP/UNSTOP messages to maintain the same opt-out list. How it works 1. Receives a compliance-check request from a parent n8n workflow via an Execute Sub-workflow trigger. 2. Loads firm settings from n8n Variables, validates the required inputs (channel, recipient, message, template ID), and reads the Opt-Outs tab from Google Sheets. 3. Checks whether the recipient phone number or email address is present in the opt-out list. 4. If the recipient is opted out, logs the suppression to the Audit Log tab in Google Sheets and returns { approved: false, messageout: '' } to the caller. 5. If the recipient is not opted out, appends the appropriate SMS or email opt-out disclaimer, logs the approved message to the Audit Log tab in Google Sheets, and returns { approved: true, messageout } to the caller. 6. Separately, receives inbound SMS via a Twilio webhook, classifies the message as STOP/UNSTOP/other, and updates the Opt-Outs tab by adding the sender on STOP, removing the sender on UNSTOP, or doing nothing for unrelated replies. Setup 1. Create a Google Sheet with two tabs named exactly Opt-Outs (phone, email, optedoutat, source) and Audit Log (loggedat, templateid, matterid, recipient, channel, messagepreview, status). 2. Add Google Sheets OAuth2 credentials in n8n and ensure they have access to the compliance sheet. 3. Set n8n Variables for OPS1SHEETID (the spreadsheet ID) and FIRMNAME (used in the email footer). 4. In each outbound template workflow, add an Execute Sub-workflow step before sending and use the returned approved flag and messageout text. 5. Activate this workflow and configure your Twilio phone number’s “When a message comes in” webhook URL to point to the workflow’s production webhook endpoint.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.