Receive Automatic SMS Notifications for Typeform Submissions with Webhooks, AWS, and Twilio

Shubha Swamy
Jul 17, 2018 · 6 min read

Data collection plays a big role in our day-to-day lives, whether that’s collecting data to make better inferences or understanding how your customers feel. To make this process of data collection more interactive, I built a tool to create automatic SMS notifications when a response is submitted to a Typeform.

I integrated Typeform’s API with AWS Lambda, Amazon API Gateway, and Twilio to make this happen. The first step was creating a Typeform to collect data from users. Using Typeform’s webhook, I was able to get the response data automatically once a user pressed submit, and through AWS Lambda and API Gateway, finally send the data as an SMS using the Twilio SMS API.

We'll work through an example below. I created a tool where a local restaurant owner receives live notifications when a review is submitted for their business via Typeform.

What You'll Need

Steps To Follow

1. Create a Typeform and Enable Webhooks

First, you will need to create your custom Typeform. For this tutorial, I created an example for a local restaurant owner to receive live time notifications for business reviews.

An example of what the form might look like

You will need to enable webhooks under Integrate, as we'll be using webhooks to automatically send SMS notifications when an event occurs.

Enabling webhooks will allow us to receive our data payload

Webhooks are simply an HTTP callback resulting in an HTTP POST when an event occurs. In this case, our event occurs when a user submits their response to Typeform so, for now, we will use a website which provides destination URLs to test the webhook. You will need to copy and paste your unique URL from this website into our Destination URL. We'll replace this Destination URL once we setup our Amazon API Gateway.

Enter the destination URL to test your webhook

2. AWS Lambda and API Gateway Setup

Next, it's time to create our lambda function. We'll start off by using a Blueprint function as our starting template when we create a function in AWS's Lambda platform and begin with the simple hello-world-python3 template. After naming our function, we set up our role as an existing lambda_basic_execution role.

Once we create our function, we add API Gateway as a trigger for our lambda function. API Gateway allows the Typeform webhook to interact with our code running on AWS Lambda so declaring API Gateway as our trigger results in an Invoke URL which is now our new Destination URL for our Typeform webhook.

Replace the Destination URL in Typeform Webhooks with Invoke URL from AWS

We can test this implementation by checking our logs from the monitoring tab in our AWS Lambda dashboard. Now we're done setting up our URL for the Lambda function. Let's make sure everything is working. Fill out your Typeform and submit the response. We should now be able to see our payload received in AWS CloudWatch logs.

The CloudWatch logs display the payload received under the "body" property

3. Get Twilio Credentials

We'll be using Twilio's API in order to facilitate the process of sending the SMS. You will need a few credentials from your Twilio account to make this happen, including your ACCOUNT SID, AUTH TOKEN, and your own Twilio phone number.

Get your Twilio phone number

4. Configure the Lambda Function

Now we will put all the components together. You can find the code that you will need here under We can simply copy this code into our inline code editor in AWS Lambda. However, there are a few things we need to remember to change.

TWILIO_ACCOUNT_SID : You can access your Account SID on your Twilio dashboard once you log in.

TWILIO_AUTH_TOKEN : You will have access to your Auth Token in your Twilio dashboard also.

TO_NUMBER : You will need to confirm your phone number for the Twilio trial account. This will be the phone number where we will send the Typeform data to.

TWILIO_NUMBER : You will also need to create a Twilio phone number which will allow you to send the data (see step 3).

We’ll set these Twilio API variables as Environment variables in our AWS Lambda dashboard.

Our environment variables in AWS Lambda are being called in our code as shown below
#get environment variables into lambda function 
TWILIO_SMS_URL = “{}/Messages.json"
TO_NUMBER = os.environ.get(“TO_NUMBER”)

Once we setup our environment variables, we also need to make sure to edit our lambda_handler method so that the field ID's match up to the custom question ID's from your custom Typeform. You can find your corresponding question ID’s by exploring the data payload we received in our CloudWatch logs in step 2.

Custom field ID's from our JSON payload in CloudWatch
#get field ID’s from your custom Typeform’s API
nameID = ‘cqGsQnbWUFrO’ #replace this
foodRatingID = ‘AUg19Oo8DAR6’ #replace this
CSRatingID = ‘N5WIKDH55nC6’ #replace this
satisfactionRatingID = ‘enkMJA3vylY0’ #replace this

In the example above, we parse our JSON using custom field ID's that correspond to different questions in Typeform. We will need to set these variables to our custom field ID's.

And done! 🎉

We should now be receiving an automatic SMS notification every time a response is submitted to Typeform.

Our local business owner receives automatic notifications when a review is submitted on Typeform


This was my first time using AWS Lambda and webhooks, and I ran into many challenges. Setting up the lambda function includes many components: creating and initializing the lambda function, integrating the code, configuring triggers, and finally deploying and testing. After going through multiple rounds of debugging my code and various tutorials, I had a better understanding of the lambda function anatomy and how webhooks integrate into it. If you’re looking into experimenting with AWS Lambda, I found the documentation and examples on AWS to be helpful.

There are lots of benefits to implementing real-time notifications with form submissions. What I’ve created is just a minimal example of what can be achieved using Typeform’s API , AWS Lambda, and Twilio. Here’s my code on Github if you’d like to check it out.

Thank you for reading! We are glad to share our experience and help everybody out there to code better.

Do you use Typeform’s Developer Platform? Would you like it to be featured on our Developer Portal? Please share with us!

And yes… we are hiring!

Typeform's Engineering Blog


Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store