Twilio recently introduced Functions, a serverless environment to build and run Twilio apps. With Functions, you can build simple Twilio applications in JavaScript without worrying about configuring servers, finding a place to host TwiML or tunneling to localhost.

Let’s get acquainted with Functions by building an app that monitors the price of cryptocurrencies. The finished app will use CoinMarketCap to send us pricing information via SMS about any cryptocurrency we send (Bitcoin, Ethereum, Dogecoin, etc).

If you’re already familiar with setting up a new Function, the finished code for this Function is available on Github here.

Getting Started

In order to build this application and use Twilio Functions you’ll need the following:

A Twilio account (Sign up for free)

An SMS-capable Twilio number

It may also benefit you to read the Intro to Functions blog post that explains a lot of the basics that this post will touch on.

Creating a New Function

Functions can be accessed from the Twilio Console by navigating to Runtime -> Functions. Click the red ‘ ’ circle and select the Hello SMS template.

You’ll notice the following Node.js code already in the Code section of your Function: