Context
Utilizing Context Variables for Dynamic Dialog Management
Context variables cover a broad range of conversational parameters beyond single interactions. Parloa currently supports the following context variables:
Key | Type | Description |
---|---|---|
| string | The user's access token is only provided for requests made by users who have linked their account with your project. |
| boolean | Indicates whether the current user has successfully performed account linking in the past, but does not ensure that the user's account is still linked. If a user revokes the permission in their linked account, the placeholder will still resolve to |
| boolean | Indicates whether a new conversation is starting with the current request. |
| date | The date of the last interaction between a user and your project. Note: This value is null during the first interaction. |
| string | In the event of a failed service call, the error message that is returned can be:
|
| number | The HTTP Status code received from a Service in the last service request performed. If the last service call returned an error, this variable will be |
| string | Contains the language code of the release in BCP 47 format, such as de-DE or en-GB. |
| string | The platform is currently being used. Possible values:
|
| string | The SSML prompt sent with the last response. |
| string | The prompt displayText sent with the last response. |
| string | The SSML prompt sent with the last response. |
| string | The prompt displayText sent with the last response. |
| string | The reason why the last conversation ended. Possible values are:
|
| number | Track of the number of back-and-forth interactions a user has had per release. The count starts at 1 for the initial interaction and increases with each subsequent exchange. It resets with different releases, only measuring the turn count for the current release. On the other hand, context.sessionCount counts the total calls a user has made to this release. |
| number | Tracks the number of conversation turns in the current session. A turn consists of a user input and a bot response. For example, a phone call initiated by the user and the bot's greeting count as one turn. The count starts at 1 and increments with each turn. It resets to 1 with each new phone call. |
| number | A random float value in the range [ |
| number | The number of conversations a user has had with a specific release, starting at 1 for the first conversation and incrementing with each new conversation. Different versions within the same release do not reset this counter, but different releases will have separate counts, essentially tracking the user's phone call count per release. |
| string, number | This object contains the usage count for each text snippet. It can be accessed as follows: |
Key Features of Context Variables
They enable dynamic responses based on the conversation history.
Context variables can be used to repeat or reference previous interactions.
Some context variables are specifically intended for use within JavaScript fields to allow for advanced scripting and customization of the dialog flow.
Interaction with Context Variables
In the non-JavaScript fields of Parloa's platform, you might encounter a limited set of context variables available via the autocomplete feature. This is due to certain variables being designed exclusively for JavaScript contexts where more complex logic can be applied.
It's crucial not to confuse these context-specific variables with those used for service calls, which are designed for external interactions, such as API requests.
Example of Context Variable Usage
The example provided showcases the use of context.previousPrompt
and context.previousPromptText
within a dialogue block. These particular variables enable the system to repeat the last prompt heard by the user. This functionality is invaluable when the user has not understood or responded appropriately, requiring the system to reiterate the previous message.
The
context.previousPrompt
variable will repeat the last SSML (Speech Synthesis Markup Language) content, which might include specific intonation or speech pacing instructions.The
context.previousPromptText
variable repeats the plain text version of the last message, which is useful for text-based platforms or debugging purposes.
Last updated