Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Understanding Visibility: Public, Protected and Private Functions and Assets

When you create Functions or Assets, you must specify their Visibility. There are three options:


A public Function or Asset is publically accessible on the internet at a specific URL once deployed. For example, if you create a Function with the path /send/sms and deploy to an environment then your function will be publically accessible at


A protected Function or Asset requires a valid Twilio request signature to be accessed. This means that the Function or Asset is only accessible if the request to access it contains the X-Twilio-Signature header and the signature is valid. This means you can limit your Functions and Assets only to be accessible to Twilio webhooks, such as on an incoming call or SMS message. Configure a phone number on the Twilio console to set a Function as the response to a webhook.


Private Functions and Assets are library files intended only for access via other Functions. For example, you may have a set of private library Functions that enable functionality that is called from a single protected Function. Or if your Function relied on a JSON file of data to read from, you can deploy that JSON file as a private asset and read it from the Function.

Example: Including a private Function in another function.

exports.handler = function(context, event, callback) {
	// First, get the path for the Function
	let path = Runtime.getFunctions()['function-path'].path;
	// Next, simply use the standard require() to bring the library into scope
	let zoltar = require(path);
	// Finally, use the module as you would any other 
	console.log('The answer to your riddle is: ' + zoltar.ask());
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.