Type "text"
If you are writing a function that requires API Keys to connect to a third-party service such as Stripe or SendGrid, you can use environment variables of type text in your implementation. Then our platform will ask consumers to enter their value during installation.
The type text variables allow consumers of a function to enter any string value. It is displayed in the installation UI form as an input element (see image below).
Example of a type "text" environment variable definition
"env": [
{
"name": "SENDGRID_API_KEY",
"description": "The API key to authenticate access to SendGrid services.",
"required": true,
"type": "text"
}
]
Example of how to consume the value of the environment variable within the function implementation
const myFunction = () => {
const senderEmail = process.env.SENDGRID_API_KEY;
...
};
module.exports = myFunction;
Properties of the type
property
type
required
default
description
name
string
yes
-
The name of the environment variable. This should be unique for each variable.
description
string
no
-
The description of the environment variable.
default
string
no
-
The default value for the variable.
required
bool
no
false
Specifies that a variable must be filled out before submitting.
Last updated
Was this helpful?