Skip to contentSkip to navigationSkip to topbar

Functions and Assets

Traffic to communications applications is unpredictable, and scaling for spikes can be challenging. Functions and Assets is a serverless environment for your Node.js code and static files. It automatically handles scaling, hosting, and maintenance, so you can focus on your application code instead of worrying about server uptime. You can find documentation, sample code, and developer tools to help you build with Functions and Assets.

Deploy your first Function

Take the next steps with Functions and Assets

Get started
Functions and Assets concepts
Explore the Serverless Toolkit
1
Twilio servers
2
Your app
const axios = require('axios');
exports.handler = async (context, event, callback) => {
const twiml = new Twilio.twiml.MessagingResponse();
const response = await axios
.get('https://dog.ceo/api/breeds/image/random');
twiml
.message(`Hello, ${event.From}! Enjoy this doge!`)
.media(response.data.message);
return callback(null, twiml);
};
3
Hello, +2134567890! Enjoy this doge!

Take the next steps with Functions and Assets


Get started

You're just a few clicks away from deploying a Function that can scale to any number of incoming SMS, voice calls, and other events. No need to deploy or manage your own server.

You can also use the Twilio CLI and Serverless Toolkit to quickly deploy a prebuilt app template, or create an app from scratch.

If you prefer a GUI, visit the Twilio Console to get started.

Choose your preferred method to get started:

Quick-DeployDevelop and run locally

Quickly bootstrap a functional app using our templates

1
# Install the Twilio CLI
2
npm install -g twilio-cli
3
# Install the Serverless plugin
4
twilio plugins:install @twilio-labs/plugin-serverless
5
6
# Initialize a new project based off of a pre-configured
7
# template and configure it
8
twilio serverless:init example --template=hello-messaging
9
cd example
10
11
# Deploy your app in seconds!
12
twilio serverless:deploy
Build your serverless application

Explore these tutorials to start building with Functions and Assets:


Functions and Assets concepts

Learn how Functions and Assets work to provide scaling, reliability, and flexibility for your app. Building an application in Functions and Assets has some key differences from building on your own server using Express or Flask. Set yourself up for success by learning the key concepts and JavaScript methods that you'll be interacting with on your development journey.

Use these docs to learn about Functions and Assets' core concepts, the steps involved in cloud development, and common use cases.


Explore the Serverless Toolkit

The Serverless Toolkit is a CLI tool that helps you develop locally and deploy to Twilio Functions and Assets.

The Serverless Toolkit is a Twilio CLI plugin that streamlines your workflow and lets you bootstrap and deploy apps quickly. It integrates with your CI/CD pipeline and lets you develop in your IDE.


Use these tools to solve problems before they crop up and complement your serverless application with greater capabilities.

Twilio Studio
Twilio Studio

Don't want to code? Create apps with our visual builder

Product documentation