Environments help you organize your apps by deployment stage (Dev, Staging, Production) and manage environment-specific configuration through environment variables.
What are Environments?
An Environment in Autosana serves two purposes:
- App Organization: Group apps by deployment stage or purpose
- Configuration Management: Store environment-specific variables (API keys, URLs, credentials)
Creating an Environment
Step 1: Navigate to Settings
Click your profile icon or navigate to Settings from the sidebar.
Step 2: Find the Environments Section
Scroll down to the Environments section.
Step 3: Create Environment
- Click Create Environment
- Enter a name (e.g., “Development”, “Staging”, “Production”)
- Click Create
Your new environment appears in the list.
Managing Environment Variables
Environment variables are key-value pairs that you can reference in hooks and flow instructions. They make your flows and hooks reusable across different environments.
Adding a Variable
- Find your environment in the Environments section
- Click Add Variable or the + icon
- Enter the Key (e.g.,
TEST_EMAIL)
- Enter the Value (e.g.,
[email protected])
- Click Save or press Enter
Use UPPERCASE_WITH_UNDERSCORES for variable names (e.g., API_KEY, TEST_PASSWORD) to make them easily identifiable.
Editing a Variable
- Find the variable in the environment
- Click the pencil icon (✏️)
- Update the key or value
- Save changes
Deleting a Variable
- Find the variable in the environment
- Click the trash icon (🗑️)
- Confirm deletion
Deleting a variable will cause any hooks or flows that reference it to fail if they try to use {{VARIABLE_NAME}}.
Using Environment Variables
In Hooks
Reference variables in hook scripts using {{VARIABLE_NAME}} syntax:
Hook Script:
Log in with `{{TEST_EMAIL}}` and password `{{TEST_PASSWORD}}`
Navigate to `{{API_BASE_URL}}`/dashboard
Verify that `{{EXPECTED_USERNAME}}` appears in the header
Environment Variables:
TEST_EMAIL = [email protected]
TEST_PASSWORD = SecurePass123
API_BASE_URL = https://api.staging.example.com
EXPECTED_USERNAME = Alice Tester
When the hook runs, variables are replaced:
Log in with [email protected] and password SecurePass123
Navigate to https://api.staging.example.com/dashboard
Verify that Alice Tester appears in the header
Learn more about using variables in hooks →
In Flow Instructions
You can also use variables directly in flow instructions:
Open the app
Navigate to Settings
Enter "`{{API_KEY}}`" in the API Key field
Tap Save
Variable Scope
Variables are scoped to their environment:
- Apps assigned to “Staging” environment use Staging variables
- Apps assigned to “Production” environment use Production variables
- Apps without an environment don’t have access to variables
Assigning Apps to Environments
During App Creation
When creating a new app:
- Select an environment from the Environment dropdown
- Complete the app creation process
For Existing Apps
- Navigate to the Apps page
- Find your app
- Click the Environment dropdown on the app card
- Select an environment
Use Cases
Development vs Production Credentials
Development Environment:
TEST_EMAIL = [email protected]
TEST_PASSWORD = DevPass123
API_URL = https://api.dev.example.com
Production Environment:
TEST_EMAIL = [email protected]
TEST_PASSWORD = ProdPass123
API_URL = https://api.example.com
Hook (works in both):
Log in with `{{TEST_EMAIL}}` and `{{TEST_PASSWORD}}`
Verify API connection to `{{API_URL}}`
Feature Flags
Staging Environment:
FEATURE_NEW_CHECKOUT = true
FEATURE_BETA_UI = true
EXPERIMENTAL_MODE = enabled
Production Environment:
FEATURE_NEW_CHECKOUT = false
FEATURE_BETA_UI = false
EXPERIMENTAL_MODE = disabled
Flow (works in both):
Open settings
Enable experimental mode if `{{EXPERIMENTAL_MODE}}` is "enabled"
Verify new checkout is `{{FEATURE_NEW_CHECKOUT}}`
Best Practices
Use Consistent NamingEstablish a naming convention and stick to it:
TEST_EMAIL, TEST_PASSWORD for credentials
API_URL, BASE_URL for endpoints
FEATURE_* for feature flags
ENV_* for environment-specific settings
Use Variables for Anything That ChangesNot just credentials! Use variables for:
- URLs and endpoints
- Test data (names, addresses, etc.)
- Configuration values
- Feature flags
Troubleshooting
Variable Not Replacing in Hook
Possible Causes:
- Variable name doesn’t match exactly (case-sensitive)
- Typo in variable name
- Wrong syntax (must be
{{VAR_NAME}})
- App not assigned to the environment
Solutions:
- Check variable name spelling and case
- Use
{{VARIABLE}} not ${VARIABLE} or $VARIABLE
- Verify app is assigned to the correct environment
Flow Works in One Environment but Not Another
Cause: Missing or different variables
Solution:
- Check that all required variables exist in both environments
Next Steps