Intents allow a bot to categorize and respond to different text input from a user. Creating relevant intents is essential to creating a bot that can effectively serve your customer. Intents consist of a series of training phrases which cause it to be triggered. The more varied your training phrases, the better the performance of your bot. Intents can be created using the ServisBOT platform or CLI. In ServisBOT, you can also add fulfillment to your intents that will carry out specific botnet actions when that intent is matched. We offer a variety of botnet actions that can enhance your conversation
In order to create an intent in portal, navigate to bot army and select the bot you want to add intents to. From there, click on the intents tab and click to create a new intent.
There are three intent options that you can choose from
If you choose to create a new intent, you will be prompted to enter an intent name, alias, and utterances. Next you can use fulfillment by adding botnet actions.
You can also create, import, export, and update intents using the ServisBOT CLI.
sb-cli intent import <utterances> <actions> Begin import of intents for a bot
sb-cli intent create <json> Creates a intent from inline JSON or a file path
sb-cli intent update <json> Updates an intent from inline JSON or a file
sb-cli intent export <bot> exports the intents for the given bot.
Click here to watch a video tutorial of how to import and export intents by CSV using our CLI.
You can also delete, describe, or list intents using the CLI.
sb-cli intent describe <bot> <alias> Describes an intent
sb-cli intent delete <bot> <alias> <version> Deletes a particular intent
sb-cli intent list <bot> Get a list of intents for a bot
Finally, to bring in intents from an outside NLP, you can use the following command.
sb-cli intent lift shift
to see a video tutorial describing how to perform a lift shift click here.
BotNet actions that are run as part of the intent fulfillment phase can be triggered or ignored as a result of previous events that have occurred in the conversation. The ability to ignore or trigger an intent based on the history or state of the conversation is called Conditional Fulfillment.
An intent contains many fulfilment actions, each action can have a singular condition statement. An example of a conditional statement on an action is shown below:
sb-cli intent describe MyBot burger
{
"alias": "burger",
"displayName": "burger",
"bot": "MyBot",
"version": "$LATEST",
"utterances": [
{
"text": "I want a burger",
"enabled": true
},
{
"text": "I would like to order a burger",
"enabled": true
},
{
"text": "I would like to buy a burger",
"enabled": true
}
],
"fulfilment": {
"actions": [
{
"condition": "!state.history.includes('burger')",
"type": "message",
"value": "No problem, what toppings would you like on your burger?"
},
{
"condition": "state.history.includes('burger')",
"type": "message",
"value": "Great, you are already ordering a burger, what toppings would you like?"
}
]
},
"detection": {
"actions": []
},
"scope": "private",
"slots": []
}
In the above example, the initial fulfillment action will only fire if the burger
intent hasn’t been triggered before. The second action in the actions
array will only fire if the user has already asked for a burger.
"actions": [
{
"condition": "!state.history.includes('burger')",
"type": "message",
"value": "No problem, what toppings would you like on your burger?"
},
{
"condition": "state.history.includes('burger')",
"type": "message",
"value": "Great, you are already ordering a burger, what toppings would you like?"
}
]
This behavior is achieved via the condition
property on the action, e.g., state.history.includes('burger')
. The conditional statement supports basic Javascript
syntax and it is run with the conversation’s state within it’s scope. An example of the conversation state is shown below:
{
"state": {
"history": [
"burger",
"onions"
],
"input": {
"utteranceText": "i would like a burger",
"language": "en-US,en;q=0.9"
},
"isVa":true
},
"user": {},
"data": {}
}
A more advanced use case might be to trigger actions after numerous fulfillments of the same intent, if the dialog state is:
{
"state": {
"history": [
"burger",
"onions",
"onions"
],
"input": {
"utteranceText": "more onions please",
"language": "en-US,en;q=0.9"
}
},
"user": {},
"data": {}
}
An intent may have the following conditions:
sb-cli intent describe MyBot onions
"actions": [
{
"condition": "!state.history.includes('onions')",
"type": "message",
"value": "No problem, I have added onions to your order."
},
{
"condition": "state.history.includes('onions')",
"type": "message",
"value": "I have added extra onions."
},
{
"condition": "state.history.filter((item) => item === 'onions' ).length >= 2",
"type": "message",
"value": "You really like onions!"
}
]
Focusing on the third action’s conditional statement state.history.filter((intent) => intent === 'onions' ).length >= 2
, the user will be prompted with You really like onions!
if and only if we have trigger the onion
intent 2 or more times.
See the documentation for the Javascript Array API to assist in the creation of succinct conditional statements.
Conditions are met when the condition resolves to the Javascript
boolean
value of true
. The Javascript
type of boolean
is the only supported return type of action conditions, therefore conditions written to rely on the “Truthy rules of Javascript” that do not directly return a boolean
, e.g., state.history.length
will resolve to false
. A more direct statement of state.history.length > 0
is required.
Conditions can be set in the ServisBOT CLI by setting the condition
field of an intent action.
{
"condition": "!state.history.includes('burger')",
"type": "message",
"value": "No problem, what toppings would you like on your burger?"
},
See the introductory section above for an example inside the complete JSON of an intent.
Conditions can be set in Portal while editing and intent
and it’s action
cards.
Disambiguation is supported within the NLP worker via the following configuration.
{
"Data": {
"NluConfiguration": {
"DisambiguationConfig": {
"DisambiguationMessage": "Sorry I did not understand that, please select one of the following options",
"AmbiguityDistance": 0.7,
"MaxOptions": 5,
"UserSelectedNoneActions": [
{
"Type": "message",
"Value": "You have selected none."
},
{
"Type": "markup",
"Value": "<TimelineMessage><TextMsg>Please ask me another question.</TextMsg></TimelineMessage>"
}
]
}
}
}
}
DisambiguationMessage
- The message used to prompt the user to select an intentAmbiguityDistance
- The distance between the confidence values to determine if the the response from the NLU engine is ambiguous, e.g, with and AmbiguityDistance
of 0.2 and confidence score of .8 on intent A and 0.7 on intent B, the result is considered ambiguous.MaxOptions
- The max number of options to present to the user if classification confidence of multiple intents are within the AmbiguityDistance
UserSelectedNoneActions
- An array of botnet actions to execute if the user selects none of the presented intents. These are also executed if the user types a response to the bot.Note that the intent description
is displayed to the user for each intent, at time of writing, setting an intent description
is not supported on bulk API actions. If no description is present, the displayName
is shown.