
Because of the well-documented benefits of serverless computing (scalability, event-driven, cost, speed), I thought it would be helpful to show you how organizations could build serverless applications to leverage the power of cloud computing and Twilio's awesome APIs.
This blog post will walk you through deploying a serverless application on AWS, and provisioning Voice and Messaging channels in Twilio to build a cloud application that can host a survey over either voice or messaging channels.
Interactive serverless applications architecture
First, let me show you what we’ll be building together. Here’s an overview of the architecture of our app:

Going left to right, end-users will interact with a voice call or an SMS conversation. Twilio Messaging and Twilio Programmable Voice are used to manage the voice and messaging channels. The AWS container includes the bulk of the functionality for this application. The enterprise can initiate these interactions from its internal systems. …

Selecting the "From" number to use for voice solutions within a single country is straightforward because there is typically just one phone number. However, many voice solutions need to make calls across the globe, and the optimal customer experience for these outgoing calls is to provide localized "From" numbers. For globalized voice solutions making outgoing calls, we recommend that customers implement a process for selecting FROM numbers based on the specific TO number for each call.
While you could certainly build a solution internally to select FROM numbers before making API calls to Twilio to initiate outgoing calls, this blog post outlines a solution that uses Twilio Functions to handle FROM number selection on-the-fly. This solution also uses Twilio Lookup to determine the country code for each TO number and also validate the TO number format before initiating the outgoing call.
FROM number selection is relevant to any solution that …