Constants

Constants are reusable values that you can define once and use throughout your automations and workflows. They are perfect for storing sensitive information like API keys, tokens, or frequently used URLs that might change over time.

Why Use Constants?

  • Security: Store sensitive data like API secrets securely. When you create a constant with the type "Secret", the value is encrypted in the database.
  • Maintainability: If an API key changes, you only need to update it in one place (the Constant), rather than updating every single workflow that uses it.
  • Simplicity: Use simple placeholders like {{API_KEY}} in your workflows instead of copying and pasting long strings.

Creating a Constant

  1. Navigate to the Constants resource in your workspace - https://nviti.ng/workspace/constants
  2. Click Create Constant.
  3. Key: Enter a unique name for the constant (e.g., OPENAI_API_KEY, CRM_BASE_URL). This is what you will use to reference it.
  4. Type: Choose the appropriate type:
    • String: For standard text values.
    • Number: For numeric values.
    • Email: For email addresses.
    • Secret: For sensitive information. Values are encrypted and masked in the UI.
  5. Value: Enter the value for the constant.
  6. Click Create.

Using Constants in Workflows

You can use constants in your Workflow API actions by wrapping the constant's Key in double curly braces: {{KEY}}.

Where can you use them?

  • URL: https://api.example.com/v1/resource?key={{MY_API_KEY}}
  • Headers:
    • Key: Authorization
    • Value: Bearer {{ACCESS_TOKEN}}
  • Tokens: In the authentication token field.

Example

Imagine you have a Constant with the key CRM_TOKEN and the value abc-123-secret.

If you configure an API action with the header: Authorization: Bearer {{CRM_TOKEN}}

When the workflow runs, the system will automatically replace {{CRM_TOKEN}} with abc-123-secret, sending the header: Authorization: Bearer abc-123-secret