Compartir vía


Healthcare agent service instance variables 

During the scenario execution, the scenario author can store and retrieve variable values. There are also variables that are prepopulated by the framework. All variables are contained in our secure storage during the session of the conversation. This means that even if the connection is lost during the conversation or something happens to our servers, all the variables are restored when the conversation is resumed. User data is maintained between conversations.

There are five types of variables you can use inside the action and other expression fields:

  1. Session variables are prefixed with a session. Session variables contain different helper methods to support you in creating your scenarios. THis can be string formatting, generating UUID, logging or sending channel data.

  2. Scenario variables are prefixed with a scenario . For example myVar would be accessed using the syntax scenario.myVar. Scenario variables live throughout the lifespan of a scenario. When a scenario ends and returns to the calling scenario, the variables are removed. This means you can write reusable scenarios.

  3. Conversation variables are prefixed with a converstion sign. For example myVar would be accessed using the syntax denoted by conversation.myVar. Conversation variables can persist across several scenarios throughout the lifespan of the conversation session.  

  4. User variables are prefix with an user. For example, myVar would be accessed using syntax denoted by user.myVar. They persist indefinitely across conversations with the same user. User variables are deleted when the user makes an explicit request to be forgotten.

  5. Global variables Variables set in this way maintain their context and are persistent in all scenarios and for all users.

Warning

The old variable notations ($, @, &) are still supported along side the new notations, but will be deprecated in the future. It's highly recommended using the new notations.

Session Variables

This section contains information regarding the session. variable.

Variable description
session.btoa Create a base64 encoded string from a string 
session.atob Create a string from a base64 encoded string 
session.randomUUID Generate a random UUID
session.hash Hash a string using a key
session.trace Log a trace message that is visible while debugging the bot in this editor.
session.saveFeedback Log a user feedback (text and score). You can then see the logged feedback in the Analytics => Feedback page
session.send This function sends a message from the bot to the user.
session.logOutcomeEvent Logs event that describes the outcome of a scenario
session.logCustomEvent Logs event that describes the outcome of a scenario
session.sendChannelData This function sends text and other data in the current channel.
session.getCustomLocalizedValue This function retrieves the value of a custom localized string by its ID. If fallbackToDefaultLocale is set the false, it returns undefined in case the current conversation language doesn't have a translation for that string. Otherwise, it retrieves the English US version of this string.
session.getSystemLocalizedValue This function retrieves the value of a system localized string by its ID.
session.message Access to the current message properties sent to the bot from the user
[DEPRECATED] session.privateConversationData This value shouldn't be used. Use conversation instead.
[DEPRECATED] session.userData This value shouldn't be used. Use 'user' instead
[DEPRECATED] session.context This value shouldn't be used.
[DEPRECATED] session.bot This value shouldn't be used.
[DEPRECATED] session.any This value shouldn't be used.

Conversation Variables

This section contains information about the conversation. variable.

Variable description
conversation.resourcesUrl Use this parameter to get the location of your uploaded resources in the bot. For example if you uploaded an image in the healthcare agent service Resources, you can access this via conversation.resourcesUrl + /image.png

Scenario Variables

This section contains information about the scenario. variable.

Variable description
scenario.scenarioArgs You can use the scenarioArgs to get the variables when you are 'setting the run arguments' in the sceniario editors

User Variables

This section contains information about the user. variable. The user section can contain information you define by setting the variable. For example setting user.street to main-street would then be available anywhere to get that value linked to the user.

Global variables

Instance variables are scoped to a specific user or conversation. Global variables are available to all users and can be accessed from any scenario. Global variables are managed via the special step in the visual editor or programatically using a special syntax. Learn more about global variables.

Next steps

Author Cards