Hello Twilio Serverless!

Congratulations you just started a new Twilio Serverless project in TypeScript.

Assets

Assets are static files, like HTML, CSS, JavaScript, images or audio files. TypeScript files will be compiled to JavaScript before deploying.

This HTML page is an example of a public asset, you can access this by loading it in the browser. The HTML also refers to another public asset for CSS styles.

You can also have private assets, there is an example private asset called message.private.ts in the /assets directory. This file cannot be loaded in the browser, but you can load it as part of a function by finding its path using Runtime.getAssets() and then requiring the file. There is an example of this in /functions/private-message.ts.

Functions

Functions are JavaScript files that will respond to incoming HTTP requests. There are public and protected functions.

Public functions respond to all HTTP requests. There is an example of a public function in /functions/hello-world.ts.

Protected functions will only respond to HTTP requests with a valid Twilio signature in the header. You can read more about validating requests from Twilio in the documentation. There is an example of a protected function in /functions/sms/reply.protected.ts

twilio-run

Functions and assets are served, deployed and debugged using twilio-run. You can serve the project locally with the command npm start which is really running twilio-run --env under the hood. If you want to see what else you can do with twilio-run enter npx twilio-run --help on the command line or check out the project documentation on GitHub.