The new layout of the editor is organized into following sections
- Coding window
- Functions Library
- Assets Library
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.
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:
For more detail on these settings and what they mean, check the understanding visibility docs page.
You can also manage your functions in the same place and take the following actions:
- Copy URL
Expert Tip : Copy URL from bottom right of the coding window for quick access.
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.
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.
You can deploy to your functions from the same window and debugger messages would fire right away for immediate response.
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.
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。