Other Variables Types
Besides flow variables and global variables, you can use user-scope, profile, and system variables.
Profile-Scope Variables for User Context
You can access values for a user’s name, locale, and local time using profile-scope variables, which access the profile settings from the chat client.
"Hello ${profile.firstName}, how can I help you today?"
Use these pre-defined variables to output context-specific for the skill user.
To do this... | Use this... |
---|---|
Get the first name of the bot user. | ${profile.firstName} |
Get the last name of the bot user. | ${profile.lastName} |
Get the bot user’s locale. | ${profile.locale}
|
Get the user’s time zone (offset in milliseconds). | ${profile.timezoneOffset} |
These pre-defined variables are set automatically from values that the messaging platform passes in. The values differ by messaging platform and some messaging platforms may not provide them. For digital assistant as agent integrations, for example, the profile.firstName
, profile.lastName
, and profile.email
have values only if the user was signed in to Oracle Service Cloud, or if a user filled out fields for the first name, last name, and email address on the Oracle Service Cloud chat launch page before requesting a chat. For the Oracle Web Client, these profile values must be set with the initUserProfile
property or the updateUser
method.
Save User-Specific Values for Return Visits
You can create user-scope variables to persist across sessions.
In general, when a user conversation with a skill or digital assistant ends, the variable values that were set from the user input are destroyed. However, you can also define user-scope variables to retain user input from previous sessions to enhance new conversations. You create user-scope variables directly in the components themselves.
To create a user-scope variable:
- In the Variable field of the property inspector of the component where you want to create it, select User Scope Variable from the dropdown.
- In the Scoped Variable Name field that appears, enter the
variable name.
Enter the name without the
user.
prefix. (Though you use that prefix when referencing a user-scope variable, you don't use it when defining it.)
To reference a user-scope variable, you use an expression like
${user.VAR_NAME}
.
For example in the Pizza Skill - Visual Flow Designer sample skill,
the lastOrderNumber
user-scope variable is set after the user places
the order in the service.reg.placeOrder
flow. This variable is
referenced by the expression ${((user.lastOrderNumber)?has_content)}
in
the first state of the flow that is called whenever the skill starts
(handler.startSkill
) to determine if the user has made any previous
orders.
The values of user-scope variables are channel specific. For example, if a user access a skill on a web channel and then later access the skill via a Microsoft Teams channel, the Teams channel will have its own instances of the user variables and won't recognize the values from the previous conversation in the web channel.
System Variables
Variable | Type | Description |
---|---|---|
system.nlpresult |
NLP Result | Used to store the NLP result for the user utterance. To get the full NLP result,
you can use the expression
${skill.system.nlpresult.value} .
|
system.intent.utterance |
String | When this variable has a value, it will be used for intent matching instead of
the last user message. To access this variable,
you can use the expression
${skill.system.intent.utterance} .
|
system.event |
Map | When one of the built-in events is mapped in the main flow or a sub flow, this
variable holds event properties you can use to
handle the event. For example, to get an event
payload, you'd use an expression in the form
${skill.system.event.value.EVENT_NAME} .
|
system.rb |
resource bundle | Used to access language resource bundle entries. To access a resource bundle
entry, you can use an expression in the form
${skill.system.rb.RB_ENTRY_NAME} .
|