Conditions

A condition is a true/false check on the user’s question.

A condition is a TRUE or FALSE check on the user’s question. A rule has many conditions. The rule’s story is selected as the answer if all the conditions are met. A message can be tagged with multiple conditions, you may select the conditions according to your bot.

Types of User Context

The user context is the data that is specifically assigned to a Rule. It determines the context of the message that the users might ask.

  • Message - what a user sends directly to the bot

  • Memory - what a bot remembers previously about the current chat session

  • User attribute - what a bot remembers about a user

  • Natural language Processing (NLP) - what the bot’s NLP engines evaluate a message with.

Attribute

With every User Context chosen, there will be an attribute (text, image, video, etc.).

The first step to implementing a condition is to select an attribute. The next step is to select a condition that complements the attribute.

Functions complementing the attribute

Every attribute comes with complementing functions.

Checks that a numeric property is greater than the value. Used for number comparison checks.

has keyword

"has keyword" is one of the most commonly used functions for the text attribute. It is extremely helpful in FAQs.

For example, if the FAQ is "What is the cost of shipping?" The keyword can be "shipping". If the users ask " How much is shipping?" the correct answer will be triggered based on the word "shipping"

'has keyword' is the only function that supports multiple values. (more than 1 keyword)

equals

Equals function prompts the chatbot to find the exact match of the word input. It checks an EXACT match. Used for direct checks.

"hello" $equals "hello" === true
"HELLO" $equals "hello" === false
"bye" $equals "hello" === false

matches regex

This is the most powerful check. Knowledge of regular expressions is required to use this function. Used for pattern-matching checks.

"5" $greater_than 10 === false
"5" $greater_than 3 === true

exists

Checks that a property exists. Does not require a value. Used for presence checks.

if a user sends an image, image_url $exists === true
if a user sends a text message, image_url $exists === false

does not exist

Checks that a property does not exist. opposite of $exists. Does not require a value. Used for negation checks.

if a user sends an image, image_url $does_not_exist === false
if a user sends a text message, image_url $does_not_exist === true

less than

Checks that a numeric property is less than the value. Used for number comparison checks.

"5" $less_than 10 === true
"5" $less_than 3 === false

greater than

"5" $greater_than 10 === false
"5" $greater_than 3 === true

Last updated