Twilio Changelog

Additions and changes to the Twilio platform

The path of the executing Function is now available in the context object at runtime, allowing you to reconstruct the full Function URL for use in your application.

Example:

exports.handler = function(context, event, callback) {
    callback(null, 'https://' + context.DOMAIN_NAME + context.PATH);
};

Full structure available from the context:

{
  "PATH":"/contextpath",
  "ENVIRONMENT_VARIABLE":"ENVIRONMENT_VALUE",
  "ACCOUNT_SID":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "DOMAIN_NAME":"funny-name-1234.twil.io"
}

The context path is available in both Console-created Functions and those created via the API.

For more information about Twilio Functions, check the Runtime documentation.