SMSTunnel for Google Forms
A text for each response, from your own phone and number
Know the moment someone answers
Your form hands each text to SMSTunnel, and your own Android phone sends it from its own number: a text to you for each response, and, if you want, a confirmation text to the person who answered. People see a number they know, and they can reply to you. There is no server to run: everything is Google Apps Script inside your own form.
What it texts
To you
A text to your own numbers for each response, with the answers.
New response to {Form}: {Answers}
To the person who answered (optional)
A confirmation at the number they typed in the form.
Thanks! We got your answers to "{Form}".
How it works
-
For each response, a text to your own numbers (up to 5, one text each). The default text is
New response to {Form}:followed by the answers; you can use{Form},{Answers},{Time},{Email}and any question's title, like{Your name}. - Optionally, a confirmation text to the person who answered, at the number they typed in a short-answer question you choose. You can also choose a consent box: a checkbox question such as "Text me a confirmation", whose first box means yes; the confirmation then goes out only when that box is ticked. Tell people in the form that you will text them.
- An edited response sends you a new text marked "Edited"; the confirmation goes out once per response.
-
{Time}uses the time zone in Set up → More settings (your browser's, the first time). - Menu (in the form's editor): Set up, Send a test text, Recent texts (the last 20 texts and why any did not go out), Turn texts off, Help.
1. Get your key
- 1. Install the SMSTunnel app from Google Play on your Android phone and sign in.
- 2. In your dashboard, open Apps → Add an app, pick Google Sheets, Forms or Calendar, name it (for example "Google Forms") and click Create the key.
- 3. Copy the key right away: it's shown only once. You can stop or delete the app there anytime, and Google Forms can't send texts anymore.
Get the steps with your key in them
It opens Add an app with Google Sheets, Forms or Calendar picked. Once the key is made, the dashboard shows every step and command with the key already filled in, ready to copy.
Make one key per spreadsheet or form, so you can stop one without touching the others.
2. Add the template to your form
Ready-made copies (Make a copy) are coming soon. Pasting the code works today and takes a few minutes:
- 1. Open your form's editor, then ⋮ (More) → Apps Script.
- 2. Make the same files as the template's folder on GitHub
(apps-script/forms-text-me)
and paste each one's content:
-
SmsTunnel,SmsTunnelKitandCode: script files (+ → Script; the editor names them.gs); Setup: an HTML file (+ → HTML).
-
- 3. Open Project Settings (the gear), tick
Show "appsscript.json" manifest file in editor, open
appsscript.jsonand replace it with the template's. - 4. Save, go back to your form and reload it. The SMSTunnel menu shows up after a few seconds (reload the page once if it doesn't). The menu is in the form's editor; people who fill in the form never see it.
3. Set it up
- 1. Choose SMSTunnel → Set up. Google asks you to allow the script the first time (see below).
- 2. Paste your key, click Check, choose the phone that sends the texts, fill in the rest and click Save and turn on.
- 3. Send yourself a test: SMSTunnel → Send a test text.
Google's permission screen, explained
The first time you choose Set up, Google asks you to allow the script. Because it is your own copy of a script Google hasn't reviewed, Google shows "Google hasn't verified this app". That is expected for a script you own: click Advanced → Go to … (unsafe). You can read every line of it in Extensions → Apps Script first. Google may let you tick the permissions one by one: tick all of them, because the texts can't go out without them (Set up asks again if one is missing).
What each permission is for (Google's screen words them its own way):
- Connect to an external service
- Handing each text to SMSTunnel at https://smstunnel.io. Nothing else is called. (script.external_request)
- This form only
- Reading this form's questions and responses. (forms.currentonly)
- Show dialogs
- The SMSTunnel menu, the setup dialog and the previews. (script.container.ui)
- Run when you are not present
- The triggers that run when a response comes in, a cell changes or the time comes. (script.scriptapp)
You can remove the script's access anytime in your Google Account (Security → Third-party apps & services), and stop every text at once by deleting the key under Apps in your SMSTunnel dashboard.
If it doesn't work
- No SMSTunnel menu
- Reload the form's editor and wait a few seconds. In a form, the menu is only in the editor.
- "Google hasn't verified this app"
- Expected for your own copy: Advanced → Go to … (unsafe). See the permission screen above.
- A text didn't go out
- Help shows the last problem; Recent texts shows each text and why one was not sent. Check that your phone is online under Phones in your dashboard: when it's offline, texts wait and go out when it's back.
- "has no country code"
- Write the number with + and the country code, or set the country code in Set up → More settings.
- Google emails "Summary of failures for Google Apps Script"
- A run stopped on purpose, usually because the key was deleted or the chosen phone was unlinked. Open Help, then Set up to fix it.
- Texts arrive at odd times
- Check the time zone in Set up → More settings, which {Time} uses.
Good to know
- Numbers: international format works best, like
+14155550123. Numbers without a country code need the country code in Set up; without it they are skipped, so a text never goes to a number in the wrong country. - No confirmation without your say: the confirmation goes only to the phone question you choose, with an optional consent question on top.
- When something stops the texts (a deleted key, a phone no longer linked), the run fails on purpose, so Google emails you about it, and Help shows the last problem. Short outages and "too many texts" just wait for the next run.
- Your phone offline: the text waits and goes out as soon as the phone is back online.
- One setup per file: if two editors both run Set up, the latest one sends and the other one's trigger removes itself, so nobody gets a text twice.
- Turn texts off removes the triggers; your settings and key stay, so Set up turns them back on.
- Limits: SMSTunnel takes 30 send requests a minute, up to 1600 characters per text, and your plan's daily allowance applies. Google Apps Script (quotas) gives a free Google account 20,000 URL Fetch calls a day (one per text); Google Workspace accounts get 100,000.
Privacy and security
- The key stays in the script's user properties: only you can read it, and it is never written to a log. The setup dialog shows only its last 4 characters.
- Who can change the script: everyone with edit access to the form can edit its script, and a trigger runs with the permissions of the person who set it up. Give edit access only to people you trust.
- What leaves your form: for each text, the number and the text go to SMSTunnel and to your phone. Nothing is sent anywhere else.
- Stop everything by deleting the key under Apps in your SMSTunnel dashboard.
Questions
- Does it cost anything?
- The template is free, and Google Apps Script is free with any Google account. The texts count against your SMSTunnel plan, and your mobile plan applies to the texts your phone sends.
- Whose number do people see?
- Yours. The texts leave your own phone, from its SIM, like a text you type yourself. Replies come back to your phone.
- Do people who fill in the form see SMSTunnel?
- No. The SMSTunnel menu is in the form's editor; people who fill in the form never see it.
- Where is my key kept?
- In the script's own private storage for your account, which only you can read. It never goes into a log. Delete the key under Apps in your dashboard and every text stops at once.
- Does it work with Google Workspace accounts?
- Yes, with personal Google accounts and Google Workspace accounts. Workspace accounts get higher daily limits from Google.
Build it with an AI assistant
Copy this prompt into Claude, ChatGPT, Cursor or Copilot and replace the part in [brackets]. Don't paste your API key into the chat: the prompt doesn't need it.
Help me write Google Apps Script code (V8 runtime) that sends text messages when my Google Form gets a response, with SMSTunnel.
About SMSTunnel (https://smstunnel.io): my own apps and tools hand text messages (SMS) to my SMSTunnel account, and my own Android phone sends them from my own number, on my own SIM and plan. The phone runs the SMSTunnel app from Google Play (https://play.google.com/store/apps/details?id=io.smstunnel.app), signed in to my account.
What I want: [describe what should send a text, to whom, and when]
How it works:
- Install: paste the file SmsTunnel.js from "SMSTunnel for Google Sheets, Forms and Calendar" (https://github.com/narcisbodea/smstunnel-google, apps-script/library/SmsTunnel.js) into my Apps Script project. Then call SmsTunnel.sendSms(to, message, options).
- SmsTunnel.sendSms(to, message, { deviceId, defaultCountryCode }) makes one call to POST https://smstunnel.io/api/v1/sms/send with the header X-API-Key: <key> and the JSON body { "to": "+14155550123", "message": "...", "deviceId": "...", "defaultCountryCode": "+1" } (deviceId and defaultCountryCode are optional). It returns { messageId, queued }.
- One recipient per call: to text several people, call it once per person.
- Numbers in international format (+14155550123). defaultCountryCode ("+1", "40") completes numbers written without + or 00, and wins over the phone's own country. SmsTunnel.normalizePhone(value, countryCode) gives the exact number or the reason it is refused.
- Texts: up to 1600 characters. Sending is limited to 30 requests a minute.
- Sign-in codes: SmsTunnel.sendCode(to, message) calls POST /api/v1/sms/send-2fa; the text must contain a code of 4 to 10 digits standing on its own (or 123-456), at most 320 characters, or it is refused (400).
- Errors throw an Error named SmsTunnelError with status, code and retryable: 401 = wrong or deleted key, 403 = the key lacks a permission (code PERMISSION_REQUIRED) or the plan doesn't allow it, 429 = too many requests (retryable, retryAfter in seconds), 5xx and network errors = retryable.
- When my phone is offline the text waits (queued: true) and goes out as soon as the phone is back online.
- Optional { idempotencyKey: "..." } (the Idempotency-Key header): a retry with the same key within 24 hours gets the first answer instead of sending a second text. Use one key per text you mean to send.
- For a form: an installable "on form submit" trigger, the answers from the response, and a confirmation only to a number the person typed in the form (and only when they ticked a consent box, if the form has one).
- The API key comes from my SMSTunnel dashboard (https://dashboard.smstunnel.io): Apps → Add an app → Create the key. It is shown only once and can send texts and check whether they went out.
Rules for your answer:
- Keep the API key in an environment variable or the platform's secret store (for example SMSTUNNEL_API_KEY). Never put it in source code, in a repository, or in code that runs in a browser or a mobile app: call SMSTunnel from a server. I will not paste my key in this chat; use a placeholder.
- Validate phone numbers before sending (international format, like +14155550123) and skip or report the invalid ones.
- Handle errors: log or show what went wrong, retry only after 429, 5xx or network errors and only a few times, and never send the same text twice.
- Only send texts people expect from me: alerts to myself, reminders, sign-in codes, updates they asked for. No unsolicited texts.
- Keep the API key in PropertiesService (SmsTunnel.setApiKey from a one-time prompt or dialog, which stores it in user properties). Never put the key in the code, in a cell, in a log, or in HTML/JavaScript that runs in the browser.
- Check every number with SmsTunnel.normalizePhone before sending; skip invalid ones and say why.
- Handle errors: stop and tell me on 401 or 403; leave the item for the next run on 429 or 5xx; write down what was sent so nothing is sent twice; cap the texts per run.
- Only send texts people expect from me: to people who gave me their number for these texts.
- Apps Script only: UrlFetchApp (no fetch), no setTimeout, no async/await; installable triggers for automation. Responsible use
Built for alerts to yourself and your team, and texts people expect from you. One text goes to one number. Sending unsolicited messages from a consumer SIM generally breaches mobile carrier terms of service.
Google, Google Sheets, Google Forms, Google Calendar and Google Apps Script are trademarks of Google LLC. SMSTunnel is a third-party integration and is not affiliated with, endorsed by, or sponsored by Google.