Updated on November 24, 2026
To send a WhatsApp message for every Google Forms response, you create an “on form submit” trigger in Apps Script that reads the response and calls the official WhatsApp Business API with UrlFetchApp. In Typeform, the equivalent is a webhook: on each submission, Typeform sends a signed POST to your server, which sends the template. In both cases the message is a Meta-approved template, and the form has to ask for the person’s number and consent.
This guide covers the code for both paths, a suggested template, the Apps Script quotas that limit you and the cost per message.
The two paths side by side
| Google Forms | Typeform | |
|---|---|---|
| How it signals a response | Apps Script installable “on form submit” trigger | Webhook (HTTPS POST) to your URL |
| Where the code runs | On Google’s servers, no hosting needed | On your server, a serverless function or n8n |
| Phone field | Short-answer question (you validate it) | Dedicated phone number question, in international format (+55…) |
| Security | The script runs in your Google account | Typeform-Signature header with HMAC SHA-256 |
| Limits | Daily Apps Script quotas | 2xx response within 30 seconds, with retries |
If you already store responses in a spreadsheet and want to send from there, the article on sending WhatsApp messages from Google Sheets covers that scenario. Here the focus is the instant message, sent the moment the form is submitted.
Before the code: phone number, consent and template
Questions your form needs
- WhatsApp number with country and area code. In Google Forms, use a short answer with regular-expression validation (for example, digits only). In Typeform, use the phone number question.
- Consent. A checkbox such as “I agree to receive the confirmation and follow-up from Example Company on WhatsApp”. Meta requires that people agree to receive messages from your business and know who will send them (Get opt-in for WhatsApp).
Personal data handling is subject to the privacy law where you operate; in Brazil that is the LGPD (Law 13,709/2018). Settle the legal basis and retention period with your lawyer; this article is not legal advice.
The template
The message goes out with no open conversation, so it must be an approved template. Example form_confirmation, suggested category utility:
Hi {{1}}! We received your {{2}} request. Reference: {{3}}. Our team will reply here within 1 business day.
It confirms something the person just requested, with no offer, which usually fits utility. If the copy includes a coupon, a call to buy or “check out our plans”, Meta tends to classify it as marketing (template categorization). Lead-generation forms with an offer should use a marketing template and its rate.
Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →
Google Forms with Apps Script
Step by step
- Open the form, click the three-dot menu and choose Script editor (or Apps Script). The script is bound to the form.
- Under Project Settings > Script Properties, create
VECTALK_TOKENwith your token, so it never sits in the code. - Paste the code below and adjust the question titles.
- Under Triggers > Add Trigger, pick the
onSubmitfunction, source “From form” and event On form submit. Authorize access when Google asks.
const TITLE_NAME = 'Name';
const TITLE_PHONE = 'WhatsApp number';
const TITLE_TOPIC = 'Topic';
const TITLE_OPTIN = 'I agree to receive the confirmation on WhatsApp';
function onSubmit(e) {
const answers = {};
e.response.getItemResponses().forEach(function (ir) {
answers[ir.getItem().getTitle()] = ir.getResponse();
});
const optin = answers[TITLE_OPTIN];
const agreed = Array.isArray(optin) ? optin.length > 0 : Boolean(optin);
if (!agreed) return;
const phone = String(answers[TITLE_PHONE] || '').replace(/\D/g, '');
if (phone.length < 10 || phone.length > 15) return; // expects country code
const reference = e.response.getId().slice(-8).toUpperCase();
const token = PropertiesService.getScriptProperties().getProperty('VECTALK_TOKEN');
const payload = {
messaging_product: 'whatsapp',
to: phone,
type: 'template',
template: {
name: 'form_confirmation',
language: { code: 'en_US' },
components: [{
type: 'body',
parameters: [
{ type: 'text', text: String(answers[TITLE_NAME] || 'there') },
{ type: 'text', text: String(answers[TITLE_TOPIC] || 'contact') },
{ type: 'text', text: reference },
],
}],
},
};
const r = UrlFetchApp.fetch('https://apis.vectalk.com.br/api/messages', {
method: 'post',
contentType: 'application/json',
headers: { Authorization: 'Bearer ' + token },
payload: JSON.stringify(payload),
muteHttpExceptions: true,
});
console.log(r.getResponseCode(), r.getContentText());
}
Notes on the code:
- The Forms submit event provides
e.response, a response object;getItemResponses()returns the answers in form order (trigger events). - Checkbox questions return a list, which is why the consent check accepts either a list or text.
muteHttpExceptions: truekeeps an HTTP error from stopping the script and lets you log the API response.- To create the trigger in code instead, run once:
ScriptApp.newTrigger('onSubmit').forForm(FormApp.getActiveForm()).onFormSubmit().create().
If the script is bound to the responses spreadsheet (not the form), the event changes: you get e.namedValues, with each question as a key and a list of answers, and e.values, in column order.
Apps Script quotas that matter
According to the quotas page:
| Limit | Free Google account | Google Workspace |
|---|---|---|
UrlFetchApp calls per day | 20,000 | 100,000 |
| Total trigger runtime per day | 90 min | 6 hr |
| Runtime per execution | 6 min | 6 min |
| Triggers per user per script | 20 | 20 |
For a contact or sign-up form, that is plenty. An installable trigger runs as the person who created it: use a company account, not the personal account of an employee who might leave.
Typeform with a webhook
Setup
- In the form, open Connect > Webhooks > Add a webhook and enter an HTTPS URL (Typeform help).
- New webhooks start disabled: turn the toggle on.
- Set a signing secret. Through the API, that is the
secretfield inPUT https://api.typeform.com/forms/{form_id}/webhooks/{tag}(reference). - Test with View deliveries > Send test request.
What reaches your server
The body has event_type: "form_response" and a form_response object with answers[] and hidden (hidden fields). Each answer has a type, a key with the same name as the type and field.ref, the question’s stable reference (example payload):
{
"event_type": "form_response",
"form_response": {
"form_id": "abc123",
"token": "a1b2c3d4",
"submitted_at": "2026-11-24T13:05:21Z",
"hidden": { "source": "november_ad" },
"answers": [
{ "type": "text", "text": "Marina", "field": { "ref": "name", "type": "short_text" } },
{ "type": "phone_number", "phone_number": "+14155550123", "field": { "ref": "whatsapp", "type": "phone_number" } },
{ "type": "boolean", "boolean": true, "field": { "ref": "optin", "type": "yes_no" } }
]
}
}
Set the question ref values in Typeform (name, whatsapp, optin) so you don’t depend on question text.
The Node.js endpoint
import express from 'express';
import crypto from 'node:crypto';
const app = express();
app.post('/typeform', express.raw({ type: 'application/json' }), async (req, res) => {
const expected = 'sha256=' + crypto
.createHmac('sha256', process.env.TYPEFORM_SECRET)
.update(req.body)
.digest('base64');
const received = req.get('Typeform-Signature') || '';
const valid = received.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
if (!valid) return res.sendStatus(401);
res.sendStatus(200); // reply right away; Typeform expects 2xx within 30 s
const { form_response: fr } = JSON.parse(req.body.toString('utf8'));
const a = Object.fromEntries(fr.answers.map((x) => [x.field.ref, x[x.type]]));
if (a.optin !== true || !a.whatsapp) return;
await fetch('https://apis.vectalk.com.br/api/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VECTALK_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
messaging_product: 'whatsapp',
to: a.whatsapp.replace(/\D/g, ''),
type: 'template',
template: {
name: 'form_confirmation',
language: { code: 'en_US' },
components: [{
type: 'body',
parameters: [
{ type: 'text', text: a.name || 'there' },
{ type: 'text', text: 'quote' },
{ type: 'text', text: fr.token.slice(-8).toUpperCase() },
],
}],
},
}),
});
});
app.listen(3000);
From Typeform’s webhook security docs: the signature is sha256= followed by the base64 HMAC SHA-256 of the raw body. Compute it before parsing the body as JSON, which is why the route uses express.raw.
Retries and duplicates
Per the webhooks documentation, Typeform retries when it does not get a 2xx (404 or 410 responses disable the webhook immediately) and may disable it if failures keep happening. A retry can deliver the same response twice: store form_response.token and skip anything already processed.
No code: n8n, Make or Zapier
Both forms also work with automation tools. In n8n, a Typeform trigger node or a Webhook node receives the response and an HTTP Request node calls the WhatsApp API; see n8n with the WhatsApp Business API and WhatsApp API with Make and Zapier. The approved-template and consent rules stay the same.
If your form lives on a WordPress site, the same logic applies to the Elementor form. And if you want the form inside the conversation itself, without leaving WhatsApp, see WhatsApp Flows for lead capture.
What it costs
Meta charges per delivered message, and the rate depends on the recipient’s country. For recipients in Brazil, since October 1, 2026: utility BRL 0.0350 and marketing BRL 0.3217 (pricing).
| Responses per month | Utility | Marketing |
|---|---|---|
| 500 | BRL 17.50 | BRL 160.85 |
| 2,000 | BRL 70.00 | BRL 643.40 |
| 10,000 | BRL 350.00 | BRL 3,217.00 |
When the person replies to the confirmation, the customer service window opens and your team’s replies are service messages: 1,000 free per month per number, billed from the 1,001st on. Model your case in the cost calculator.
How to do it with Vectalk
Vectalk is a proxy for the official WhatsApp API: the examples above already use https://apis.vectalk.com.br/api/messages, with the same JSON as the Cloud API. Use an instance token (required for templates) and create the template in the dashboard, where the Template Library helps you get started. Customer replies arrive at the webhook you register, in Meta’s format, and the logs show every send.
Billing is a monthly plan plus a prepaid balance: each delivered message is deducted from the balance, with no card in Meta. Vectalk has no built-in inbox; answer conversations in the system you already use. See the documentation or create an account.
Frequently asked questions
Does Google Forms have a native WhatsApp integration?
We found no native integration in Google’s documentation. The documented route is Apps Script with a submit trigger and UrlFetchApp, or an automation tool.
Can I use a wa.me link instead of the API?
A wa.me link opens the chat on the respondent’s phone, but they still have to tap send. For your business to send the message automatically, you need the API and an approved template.
Will the message arrive if the person has never talked to my business?
Yes, as long as it is an approved template and the number is active on WhatsApp. The consent in the form is what makes that message legitimate.
Does Typeform store phone numbers with the country code?
Yes. The phone number question returns the number in international format, such as +14155550123. Strip the + before sending it to the API.
Official sources checked on November 24, 2026: Apps Script: trigger events, Apps Script: installable triggers, Apps Script: UrlFetchApp, Apps Script: quotas, Apps Script: properties, Typeform: webhooks, Typeform: example payload, Typeform: securing webhooks, Typeform: webhooks help, WhatsApp: opt-in, WhatsApp: template categorization, WhatsApp: pricing, Vectalk documentation.
Put your business on the official WhatsApp
Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.
