Skip to main content

Secrets and environment variables

The Secrets and variables page is a place where you can control data that needs to be stored separately from the project source code, but still be accessible from the script.

Secrets

To increase the security of storing sensitive data, you can use secrets.
secret is a key-value pair that contains data which should not be publicly accessible, such as passwords or access keys. The values of secrets are encrypted.

caution
Only users with the SYSTEM_ADMIN role can add, edit, and delete secrets.

How to add a secret

To add a secret:

  1. Open your project. On the Secrets and variables page, select Secrets > Add secret.
  2. Specify the name of the secret. It must be unique within the project.
caution
The name can only contain Latin characters, numbers, and underscores.
  1. Specify the value of the secret. It will not be displayed in the interface after you save the secret.
  2. Click Add.

Click to edit the secret value or  to delete it.

tip
Newly added secrets and updated secret values will be applied automatically in all channels where the bot is deployed. For example, in a situation when your API key has expired and you have replaced it with a new one, you don’t have to redeploy the bot to all channels manually.

How to use a secret in the script

To access token values from the script, use the $secrets built-in service.

Environment variables

variable is an arbitrary key-value pair. Any piece of bot configuration which needs to be changed often without modifying the source code should be stored as a variable.

How to add a variable

To add a variable:

  1. Open your project. On the Secrets and variables page, select Environment variables > Add variable.
  2. Specify the name of the variable. The same restrictions as for secrets apply to variable names.
  3. Specify the value of the secret.
  4. Enable the Include into project export ZIP file checkbox if you want the variable to be saved when exporting the project as an archive.
  5. Click Add.

Click to edit the variable or  to delete it.

tip
Newly added variables and updated variable values are not applied automatically in any channels. This allows verifying that the bot works correctly with new variables in dedicated test channels (such as the test widget) before deploying the changes anywhere else.

How to use a variable in the script

To access variable values from the script, use the $env built-in service.