Google Forms
Google Forms has no webhook of its own, but every form can run a small Apps Script. The script on this page sends
each new response to the Flows address as the form_submitted event, with the title of the form and all the
answers. A sign-up for a consultation or a training becomes a confirmation in Viber or SMS, a reminder before the
date and a follow-up after it.
This page is written from the public documentation of Google Forms and Apps Script and has not been checked on a live account yet.
What you need
- A Google account with the right to edit the form. Apps Script is free; the script runs on behalf of the person who creates its trigger.
- A question for the phone. Google Forms has no phone question type: use a short-answer question and give it a clear title — Phone. The script finds the phone, the email and the name by the titles of the questions.
- A one-time consent: Google asks you to let the script read the form and call an external address.
- Apps Script has daily quotas: 20,000 outgoing requests a day for a gmail.com account and 100,000 for Google Workspace; 90 minutes of trigger run time a day for gmail.com and 6 hours for Workspace.
Step 1. Create a connection
- Open
Flows → Connections, press Connect a system and choose Google Forms. - Press Copy address. It looks like
https://events.alphasms.net/hooks/<TOKEN>— keep it secret.
Step 2. Add the script to the form
-
Open the form in edit mode, press ⋮ (More) and choose Apps Script. The script editor opens, already bound to this form.
-
Delete everything in Code.gs and paste the script below. In the first line replace
PASTE_THE_ADDRESS_HEREwith the address from the cabinet, keeping the quotes. -
Save the project (the disk icon or Ctrl+S).
-
On the left open Triggers (the alarm clock icon) and press Add Trigger:
- Choose which function to run —
sendToFlow; - Select event source — From form;
- Select event type — On form submit;
- Failure notification settings — Notify me immediately.
Press Save.
- Choose which function to run —
-
Google asks for access: choose your account, then Advanced → Go to … (unsafe) with the name of your project → Allow. The script asks for the right to read the form and to call an external address.
// AlphaFlow: a Google Forms response → the form_submitted event
const FLOW_URL = 'PASTE_THE_ADDRESS_HERE'; // the address from the cabinet
// The script finds the phone, the email and the name by the titles of the questions. Simplest: "Phone", "Email", "Name".
const PHONE_RE = /phone|телефон|mobile|мобіл|мобил/i;
const EMAIL_RE = /e-?mail|пошт|почт/i;
const NAME_RE = /ім.я|имя|^name|first name|піб|фио/i;
function sendToFlow(e) {
const form = e.source; // the Form the script is bound to
const response = e.response; // FormResponse — this response
const answers = {};
let phone = '';
let email = response.getRespondentEmail() || ''; // filled in if the form collects email addresses
let name = '';
response.getItemResponses().forEach(function (item) {
const title = item.getItem().getTitle();
let value = item.getResponse();
if (Array.isArray(value)) value = value.join(', ');
value = String(value);
answers[title] = value;
if (!phone && PHONE_RE.test(title)) { phone = value; return; }
if (!email && EMAIL_RE.test(title)) { email = value; return; }
if (!name && NAME_RE.test(title)) { name = value; }
});
const contact = {};
if (phone) contact.phone = phone;
if (email) contact.email = email;
const flowEvent = {
event: 'form_submitted',
message_id: 'gforms:' + response.getId(),
occurred_at: response.getTimestamp().toISOString(),
contact: contact,
properties: { form: form.getTitle(), response_id: response.getId(), answers: answers },
context: { source: 'google_forms' }
};
if (name) flowEvent.traits = { first_name: name };
UrlFetchApp.fetch(FLOW_URL, {
method: 'post',
contentType: 'application/json',
payload: JSON.stringify(flowEvent),
muteHttpExceptions: true
});
}
- The script recognises the question titles Phone and Mobile, Email and E-mail, Name and First name, and their Ukrainian and Russian forms: «Телефон», «Пошта», «Ім'я», «Имя», «ПІБ». If the form collects email addresses itself, that address is used.
- Every answer goes into the event as
answers: the title of the question and the answer. Several choices are joined with commas. - If the form is an application rather than a survey, change
'form_submitted'to'lead_submitted'in the lineevent: 'form_submitted',.
Step 3. Send a test
Open the form in Preview and submit it with your own phone number. In Apps Script, Executions shows the
run of sendToFlow, and the event appears in
Flows → Connections → Event journal within seconds. The
connection shows Recognised: Google Forms.
Events
| Google Forms | AlphaFlow event | Properties |
|---|---|---|
| A response is submitted | form_submitted | form, response_id, answers |
| The same, with the event changed in the script | lead_submitted | form, response_id, answers |
form is the title of the form, so one flow can serve several forms with a condition on form. The contact is
found by the phone and the email from the answers; the first name comes from the name question. The script sends
the event in the AlphaFlow format, so there is nothing to map — see
Event format.
Good to know
- The script sends each response once and does not repeat it. If a run fails, Google emails the owner of the
trigger. The id of the response is part of
message_id, so the same response is never recorded twice. - The script signs nothing: the secret in the address is enough.
- The event needs a phone or an email, or an id AlphaFlow already knows. Otherwise it is refused with
no_contactand shown in the journal — name the phone question clearly. - One form — one script and one trigger. The same address can go into the scripts of several forms.
- The address always answers
200. Above the daily event limit the event is refused in AlphaFlow withquota_exceededand shown in the journal; the trigger in the form stays on.