Objective
This article shows you how to have Twilio add your account credentials to a Functions service as environment variables, so your function code can call the Twilio API without you storing the credentials yourself.
Product
Twilio Functions and Assets
Environment
Twilio Console
Procedure
- In the Twilio Console, select Builder tools in the left sidebar.
- Select Functions & Assets, then Services.
- Select the name of the service you want to configure.
- Select the Environment variables tab.
- Select the checkbox labelled Add my Twilio credentials (ACCOUNT_SID and AUTH_TOKEN) as environment variables.
- The setting is saved for the service as soon as you change it.
Additional Information
- With the setting on, your function code reads the credentials from the context object as
context.ACCOUNT_SIDandcontext.AUTH_TOKEN. - Clear the checkbox to stop supplying the credentials to the service. Any function that relies on them will no longer be able to read them.
- For any other secret your functions need, add it yourself as an environment variable.
This content was generated by AI and reviewed, edited, and verified by a human.