Menu

Expand
Rate this page:

Functions Editor

The new layout of the editor is organized into following sections

  1. Coding window
  2. Debugger
  3. Functions Library
  4. Assets Library
  5. Environment
  6. Settings
    1. Environment Variables
    2. Dependencies

Add Function

Click on Add Function button placed on the top left to create a new Function. This would create a new tab on the coding window with some code to get you started. You can edit this code and click save placed right under the coding window.

You have just created a brand new functions using the new editor!

Expert tip: Toggle between multiple functions to edit them simultaneously.

The coding window is the place where you can drop your node.js code and build Twilio Functions.

View and Manage Functions

Note: All Functions startup with their visibility set to Protected. This means that only a request with a valid Twilio signature can invoke the Function. When experimenting, you may want to set the visibility of your Function to public so you can easily invoke the Function, e.g. via a browser.

You can view and change the visibility settings on a function by clicking the downward arrow beside the function name and select one of the following:

  • Private
  • Public
  • Protected

For more detail on these settings and what they mean, check the understanding visibility docs page.

add function.gif

You can also manage your functions in the same place and take the following actions:

  • Copy URL
  • Delete
  • Rename

copy function.gif

Expert Tip : Copy URL from bottom right of the coding window for quick access.

Debug as you code

The debugger window is placed right under the coding window so you can view the debugger messages are you work on your functions code. The debugger messages are sorted descending by Date and Time for convenience.

Expert Tip : Clear logs to start afresh as you switch between functions during development process.

Debugger messages cleared from functions editor window will remain accessible through Debugger page accessible through the button on the top right.

debugger.png

Environment Variables and Dependencies

Settings is a tab available underneath Assets Use Environment Variables to store configuration like API keys rather than hardcoding them into your Functions.

Every time your Functions are invoked, we pass in a context parameter. The context object will contain the keys and values that you define below. As a convenience, you can choose to include your ACCOUNT_SID and AUTH_TOKEN as well. If you do so, context.getTwilioClient() will return an initialized REST client that you can use to make calls to the Twilio REST API.

You can find Dependencies beside the Environment Variables under Settings.

settings.gif

Deployment

You can deploy to your functions from the same window and debugger messages would fire right away for immediate response.

deploy.png

Connecting a Twilio Phone Number

All your existing functions would continue to be available to configure in the Phone sessings as a functions. Functions created via Functions UI Editor would need to be configured using Webhook and placing your functions URL.

webhook.gif

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.

        
        
        

        Thank you for your feedback!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more