AI actions

You can create AI actions in our dashboard, these actions can do a range of tasks, including but not limited to:

  • showing a followup question
  • Execute custom javascript
  • Call an API endpoint
  • Start a live chat

By default these actions show as buttons in our AI component for the end-user to use. There is also an option to immediately execute an action. In that case, the action won't be shown to the user first but will immediately execute.

Variables

Actions can require variables to execute. The variable you set on an action will show in a form to the end-user. The user has to fill out the form with the required field before the action can be executed. These can be any questions like requesting a name, email, selecting a category, etc.

Variable can also be dependent on each other. This means that the value of the first variable will determine if a second variable will be shown or skipped. This way you can create a tree-like structure in the form questions the user will have to fill in.

Variables will be stored in the conversation and shown in the conversation details in the Unless dashboard. If a variable is already set, the AI won't ask for it again in the form. So if the email is already known, the form will not prompt the user to fill in their email. If you want the user to fill in the variable even if it is already known, then you can use the "Re-ask every time" switch on the variable details to turn that on.

📘

Variables set using the Txt.setChatMetadata() function are also available to the AI. Anything set via the API will not be re-asked unless specifically switched on.

Finally, you can use a variable in the action by using our placeholder syntax: {{variable_name}}. For example, if you have a custom-javascript action you can create something like this:

// if statement depending on the variable value
if ('{{type_select}}' === 'opening_times') {
  // send a prompt to the AI.
  Txt.sendMessage('What are the opening times')
} else {
  // just showing here you can insert the variable anywhere.
  window.location.href = 'https://google.com?q={{type_select}}'
}

Triggers

To show an AI action to the user you need to set a trigger condition, you can do this in the triggers tab. Actions can be shown when:

  • When a specific document is used to answer a question
  • On negative feedback (thumbs down)
  • After an unanswered question
  • After every single response
  • After the user is detected inactive

There is also a special condition called "Display only if rule matches". Here you can add your own custom javascript that will determine if the action will be shown to the end-user. For example, you can create a "start live chat" action that triggers on negative feedback. However, you don't want it to show outside of business hours, so you can write a simple line of javascript that checks if the current time is within the business hours or not.