Standard Context Variable Web Hook
Connect connects Conversational AI Cloud with all of the services offered through the marketplace. It does this by providing a standardised web hook for the context variable web hook, and for transactional dialogs. This article explains the behaviour of the transactional dialog script, and how to use it.
Introduction
Conversational AI Cloud's context variable web hook allows customers to create a web hook to, for each interaction containing contextual answers, set the context for that particular interaction. This web hook allows for greater flexibility when defining the context for a particular interaction, as it allows customers to fetch data from sources external to the CM.com platform to determine context.
Behaviour
Connects standardised context variable web hook is a simple opinionated implementation that contains the follow logic:
- Maps values set on the Conversational AI Cloud session (conversation variables) to identically named context variables
- Makes conversation variables and context variables case insensitive when mapping
An example:
- The customer has a context variable called "order_status", with 4 allowed values:
- processing
- cancelled
- completed
- The customer has a conversation variable called Order_Status that's dynamically set throughout the conversation
- An event is triggered that contains:
- A default answer, and;
- 3 contextual answers, one for each of the order_status' allowed values
The context variable web hook is called with the following (partial) request body:
{
"session": {
"Order_Status": "Processing"
},
"contextVariables": [
{
"allowedValues": [
"cancelled",
"processing",
"completed"
],
"key": "order_status",
"value": ""
}
]
}
The web hook will (in order):
- Map the values on the session (conversation variables) to the context variables in a case-insensitive way
- Return the identically named conversation variable value if it is contained in the context variables allow values list
The response from the (partial) call in the above example would be:
{
"order_status": "processing"
}
Updated about 1 month ago