Functions
Retrieve secrets
Retrieve secret in function
The secret_vault
function allows you to securely retrieve the contents of secrets added to your account.
Usage
To use the secret_vault
function, follow these steps:
Step 1: Import the Function
First, import the secret_vault
function into your custom function:
Step 2: Use the Function
Next, you can use the secret_vault function to retrieve your secret:
Returns
For a key-value type secret
For a key-value type secret, the function returns a dictionary of key-value pairs. Example:
You can access this like a standard Python dictionary in your function code.
For a single type secret
For a single type secret, the function returns the string containing the secret_value
. Example:
Tips
- Check Available Secrets: There is a box called “Secrets” on the top right corner of the “Function Definition” box in the Function Editor. Click that to see what secrets your assistant has access to.
- Permission Issues: If you cannot see the secret in the “Secrets” box, please refer to the Access Control for Secrets page to add permission for your function.
- Copy Code Snippet: In the “Secrets” box, you can also copy the code snippet for accessing the secret directly into your function code.