Use Built-in Context Variables for Guides

Prev Next

Gladly AI now provides built-in context variables that are automatically available in your Guide Rules. These variables give you access to real-time session information, enabling you to create smarter, more personalized automations.

Available variables

The following variables are automatically populated at the start of each Conversation:

  • isAuthenticated: Indicates whether the Customer is logged in (e.g., true, false).

  • channelType: The communication Channel being used (e.g., CHAT, EMAIL, SMS, PHONE_CALL).

  • sidekickProfileId: The unique ID (UUID) of the Gladly Agent handling the Conversation.

Use variables in Guide Rules

You can create conditional logic in your Guides based on these variables to tailor the Customer experience.

Personalized responses by Authentication Status

You can branch your Guide logic based on whether a Customer is logged in or not:

  • If isAuthenticated is true: Offer account-specific options like order history or saved preferences.

  • If isAuthenticated is false: Prompt the Customer to log in or provide general assistance.

Customize behavior by Channel

Use the channelType variable to adjust logic for specific Channels, such as showing different prompts for CHAT versus PHONE_CALL.

Use variables in Action Adapters

Reference these variables in your Action Adapter steps using the $ prefix (e.g., $.isAuthenticated, $.channelType, or $.sidekickProfileId).

These variables cannot be overwritten by custom steps in the Action Adapter

In order to ensure consistent behavior, these variables are protected.

Example use cases:

  • API Endpoints: Call different API endpoints based on authentication status.

  • Analytics: Include the Channel type in logging or analytics payloads.

  • Routing: Route requests to Channel-specific backend services.

Test with context variables

Testing ensures your conditional logic handle session data correctly.

Guide Tester

When testing Guides with the Chat Channel selected:

  1. Locate the Auth dropdown in the Guide Tester header.

  2. Select Authenticated or Not Authenticated.

  3. Send test messages to verify your conditional logic.

Action Adapter test dialog

When testing Action Adapters, open the test dialog and configure the Channel Context fields:

  • Channel Type: Select Chat or Voice.

  • Is Authenticated: Toggle on or off (Chat only).

  • Sidekick Profile ID: Enter a test profile ID.

FAQs

Is $isAuthenticated available for all channels?

The authentication status is primarily relevant for Chat, where Customers may be logged into your website. For other Channels, this value may not be set.

Can I override these context variables?

No. Built-in context variables are protected and cannot be overwritten by Action Adapter steps to ensure consistent behavior.