Send Email and SMS from Google Forms using Zapier, SendGrid, and Twilio

Niels Swimburger.NET 🍔 - Jun 27 '22 - - Dev Community

This blog post was written for Twilio and originally published at the Twilio blog.

Forms are one of the fundamental building blocks of the web. Almost all websites use forms to get feedback from users and to gather leads. Many of these forms integrate directly with a Customer Relationship Management (CRM) system, while others forward the form data directly to an email inbox.

If you're building a form using a web framework, you can quickly integrate SendGrid's Email API or one of the SendGrid libraries to forward the data to an email inbox. However, sometimes there's no time to build a fully fledged form yourself, or the form's purpose is for a single short-lived campaign. In that case, you could use an off-the-shelf form product like Google Forms to get the job done quickly with minimal investment. You don't even have to sacrifice the form integrations, because with Zapier's workflow automation, you can integrate Google Forms with tons of products including SendGrid to send emails and Twilio Messaging to send SMS.

In this tutorial, you'll learn how to forward form submission data via email and send a notification via SMS using Google Forms, Zapier, and Twilio. This is a very common scenario on the web, but with these tools you don't even need to write any code to make it happen!

A Zapier "Zap" that trigger when a Google Form is submitted, then sends an email using SendGrid, and lastly, sends an SMS using Twilio messaging.

Zapier workflow automation with Google Forms, SendGrid, and Twilio SMS

If you're looking to build a form for users to signup for your newsletter, you can use SendGrid’s Signup Forms to build and manage your email contact list for newsletters.

Prerequisites

You will need these things to follow along:

  • A free or paid SendGrid account. Sign up here to send up to 100 emails per day completely free of charge.
  • A free or paid Twilio account (If you register here, you'll receive $10 in Twilio credit when you upgrade to a paid account!)
  • A free Zapier account, or even better, a paid or Zapier trial account (more on that later)
  • A Google account

Create a Google Form

You can skip this step if you already set up a Google Form. If not, head over to forms.new which will automatically create a blank new form in Google Forms for you. Give your new form a name and use the interface to build your form out until you're happy with the result.

For example, here's a form that will contact me, so I added a Name, Email Address, and Question field to the form.

Google Form named "Contact Niels" with 3 form fields: Name, Email Address, and Question

Click on the Responses tab, click the 3 dotted icon to open the overflow menu, and click Select response destination.

User clicks on the responses tab, then on the three dotted icon which opens a submenu, and the user selects the "Select response destination" option.

A modal will appear where you can decide which Google Sheet (spreadsheet) will be used to store the form submissions in. Select the Create a new spreadsheet option and, if desired, change the name of the spreadsheet and then click Create.

Modal with two radio buttons: Create a new spreadsheet, and Select existing spreadsheet. The user selects the "Create a new spreadsheet" option and gives the spreadsheet the name "Contact Niels (Responses)"

This spreadsheet will be used to store responses in rows whenever the form gets filled out and submitted.

Later, you will configure Zapier to watch this spreadsheet and run your automation workflow whenever a new row appears on the spreadsheet.

Configure your SendGrid account to send emails

In SendGrid, you'll need to configure two things before you can send emails: First, you’ll need to set up Sender Authentication. This will verify that you own the email address or domain that you will send emails from. Second, you’ll need to create a SendGrid API Key with permission to send emails.

Sender Authentication

To quickly get started, you will use Single Sender Verification for this tutorial. This verifies that you own the email address that the application will send emails from. Single Sender Verification is great for testing purposes , but it is not recommended for production.

Twilio recommends Domain Authentication for production environments. An authenticated domain proves to email providers that you own the domain, and removes the "via sendgrid.net" text that inbox providers would otherwise append to your from address.

To set up Single Sender Verification, click the Settings tab in the left menu. Once the settings tab opens, click Sender Authentication.

Side-navigation with a Settings group and multiple links in the group. The link "Sender Authentication" is highlighted.

Then, click Get Started under the Single Sender Verification section.

A button saying "Get Started" to verify an individual email address.

This opens a form in the right-side panel. Fill out the form with your information and email address.

A form to create a sender. The form asks for contact information including the email address that will be used to send emails from.

Click Create after filling out the form. Another panel will appear on the right, asking you to confirm your email address in your email inbox.

Go to your personal email inbox, open the email from SendGrid, and click Verify Single Sender.

An email from SendGrid with a button saying "Verify Single Sender".

Your email address has been verified. You can now use it to send emails!

Create a SendGrid API key to send emails

Back on the SendGrid website, click API Keys under the Settings tab , then click Create API Key in the top right-hand corner. This opens another form in the right-side panel.

Give your API Key a useful name. You can assign different permissions to the API Key. For optimal security, you should only give the minimum amount of permissions that you need.

Next, click Restricted Access.

A form to create an API Key. The form asks for a name for the key and what permissions to grant to the key.

Scroll down to the Mail Send accordion item and click on it to reveal the permissions underneath. Drag the slider to the right for the Mail Send permission.

A list of permissions that you can control using a slider bar next to each permission. The "Mail Send" accordion item is expanded to reveal the "Mail Send" permission underneath.

Scroll to the bottom of the form and click Create & View. The API key will now be displayed on your screen.

You will not be able to retrieve the API key again once you leave this screen, so make sure you copy the API Key somewhere safe.

API key is displayed to copy and store elsewhere. Key will not be shown again.

With the sender verified and the API Key created, you’ll now be able to send emails from Zapier's workflow automation.

Get Your Twilio Configuration

To send text messages from Zapier, you'll first need to buy a Twilio Phone Number. If you're using a trial account, the cost for the phone number will be applied to the complimentary trial credit. If you don't already have a phone number, go and buy a phone number via the Twilio Console.

Next, you'll need some configuration elements from Twilio to send text messages from Zapier. Back in the Twilio Console, take note of your Twilio Account SID and Auth Token located at the bottom left of the page.

Account Info box holding 3 read-only fields: Account SID field, Auth Token field, and Twilio phone number field.

After all these steps you should have:

  • The name of the spreadsheet that hosts your Google Form data
  • The email address of your Verified Sender on SendGrid.
  • The API Key from SendGrid to send emails
  • The Account SID and Auth Token from Twilio to send SMS

Fantastic! Time to create the automation with Zapier.

Create workflow automation with Zapier

Head over to the Zapier dashboard and click on the Create Zap button on the top left.

Big orange Create Zap button on the top left of the Zapier dashboard

In Zapier's words: "A Zap is an automated workflow that connects your apps and services together". After creating the Zap, change the name of the Zap to something meaningful. This can be done by clicking on the pen icon next to Untitled Zap in the top left corner of the page.

Configure the Google Forms Trigger to receive the form submission

Every Zap needs to have a Trigger; a trigger is an event that will start the workflow. In the App Event search bar, enter " Google Forms" and then click on the "Google Forms" entry.

The Zap Trigger to be chosen by the user. You can see different triggers listed like Twilio, Google Sheets, Twitter, and more. There"s a search bar to find the trigger you need.

In the Event dropdown, select the " New Response in Spreadsheet" option, and click Continue.

Click on Sign in, authenticate with Google, and share the necessary permissions with Zapier. Once authenticated, click Continue.

Now, click on the Spreadsheet dropdown and select the spreadsheet that you created earlier for your Google Form.

User selects the "Contact Niels (Responses)" option from the Spreadsheet dropdown for the Google Forms trigger in Zapier.

A single spreadsheet can contain multiple worksheets, so Zapier will also prompt you to select the Worksheet of which there is only one in this case. Select the Worksheet and then click Continue.

You may be asked to test the trigger; if so, click Skip test since testing will be done at the end of the tutorial.

Configure the SendGrid Action to send an email

After the Trigger, there's already an empty action added to your Zap. Click on the action and search for the SendGrid app. For the Event dropdown, select " Send Email", and then click Continue.

User adds SendGrid action to Zapier and selects the "Send Email" option from the "Event" dropdown.

Now you have to help Zapier authenticate to your SendGrid account. Click on the Sign In button and a window will pop up asking you for the " Mail API Key", enter the SendGrid API Key you took note of earlier and click " Yes, Continue".

Zapier"s window to authenticate with SendGrid. The window has a single field "Mail API Key" asking for the SendGrid API Key with mail permissions.

Now that Zapier has your SendGrid API Key, click Continue and configure the action.

As you can see in the screenshot below, I configured the fields as follows:

  • To: The email address of the person that will review the form submission. You can use your own email address for this.
  • From : The Verified Sender email address that you configured earlier in SendGrid.

    • From Name : A name that uniquely identifies the form. This is added using the "Insert Data …" popover that lets you use the data from a trigger or a previous action. In this case, the data is pulled from the Google Form trigger.- Reply To : This is optional, but if your form is like mine and has an input for the user's email address, this field can be used to reply directly to the form submitter through the email instead of replying to the From email address.
    • Subject : The title that will be shown on the subject line of the email.
    • HTML : The HTML will be the content of your email. You can also use the Text field if you don't want to use HTML.

Here's the HTML I used for my email:

<p>Someone submitted the Contact Niels Form:</p>
<ul>
<li>Name: [FORM SUBMISSION NAME]</li>
<li>Email Address: [FORM SUBMISSION EMAIL ADDRESS]</li>
<li>Question: <br />
[FORM SUBMISSION QUESTION]
</li>
</ul>
Enter fullscreen mode Exit fullscreen mode

If you have a similar form as mine, you'll have to replace the [FORM SUBMISSION …] placeholders with the data from the Google Forms trigger.

A form to specify how to send the email from Zapier with SendGrid.

Click Continue. The last step is to Test action which you can skip by clicking Skip test since you will be coming back at the end to it to test it out.

Configure the Twilio Action to send an SMS

The next action you will create is to send an SMS notification when the form has been submitted.

This will require you to add a second action to your Zap, which is only possible for paid Zapier plans. If you don't have a paid Zapier plan or trial, you can only create Zaps with a single action. However, as a workaround, you could create a second Zap with the same Google Forms trigger and the Twilio action for sending SMS.

Click on the plus-icon below the SendGrid action you just created. Look for "Twilio" in the App Event search box and click on the Twilio option.

User adds another action, this time selecting "Twilio" as the "App Event".

Next, select " Send SMS" in the Event dropdown, and click Continue.

The user selected "Twilio" as the action in the Zapier flow and selected "Send SMS" for the "Event" dropdown.

Click on Sign in to share the Twilio credentials with Zapier. Enter the Twilio Account SID and Auth Token you took note of earlier and click " Yes, Continue".

Zapier asking the user for their Twilio Account SID and Auth Token.

Back in your Zap, click Continue.

Select your Twilio Phone Number from the "From Number" dropdown. Next, enter your phone number into the " To Number" field, and enter some text into the Message field.

A form to specify how to send the SMS from Zapier with Twilio.

Click Continue , then Skip test and finally Publish Zap. You’ll be asked to confirm to turn on your Zap; click Publish & Turn On.

Testing your Zap

While creating your Zap, you may have noticed that you can test the trigger and actions from Zapier's interface. Go to your trigger and under the " Test trigger" section, click on the " Test trigger" button.

Zapier lets you test the Zap by pressing the "Test trigger" button.

If someone already submitted the form before, Zapier will grab the form submission data and use it to test your Zap. Be mindful tho, this data may be a real submission, not just your own test data. Now head over to each of your actions and test them out as well.

To do an end-to-end test, go to your Google Form and submit it and wait until you get your email and text message.

Next steps

You just created one of the most commonly requested form flows without writing any code; well apart from some HTML that is. However, there are many more triggers and actions you could build automations with, and if you want to build and explore more communication applications, check out our no-code application builder, Twilio Studio. For example, learn how to build an Interactive Voice Response (IVR) application with Twilio Studio so you can take phone calls to help out customers without having a call representative.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .