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 Passing Rule, and if all the conditions are met, it's Story is returned as the bot's response.

Types of User Context

User Context options

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.

Memory

At times, a rule does not respond to user's direct message, rather it responds from the interaction history.

Example: If we go to the "hey!" story, we can add an "action" response to make the bot remember this. Let's set the action as follows:

Now when the bot replies to a user with "hey!", the bot actually set a property called "said-hey" to true on chat's session memory.

Add a NEW rule with a NEW condition:

and let's assign this to a new story called "You Just Said Hello"

Now, the chat will go as follows:

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.

Below will be a list of the the functions that are available as well as examples of the complementing functions that is available when setting conditions.

Function
Description

has keyword

This function checks if the message contains a specific keyword or phrase.

does not have keyword

This checks if a specific keyword or phrase is not present in the message.

equals

This checks if the message exactly matches a specific value or keyword.

does not equal

This checks if the message does not match a specific value or keyword.

matches regex

This checks if the message matches a regular expression pattern.

exists

This checks if a specific property or value exists in the userโ€™s data.

does not exist

This checks if a property or value does not exist in the userโ€™s data.

less than

This checks if a number is less than another value.

greater than

This checks if a number is greater than another value.

has tags

This checks if the user's message has tagged entities.

does not have tags

This checks if the user's message does not have tagged entities.

is exactly

This checks if the message exactly matches a specific keyword, as opposed to containing it.

is not exactly

This checks if the user's message does not exactly match a given keyword or phrase.

has exact tag

This checks if the user's message "is exactly" a tagged entity.

does not have exact tag

This checks if the user's message is not "is exactly" a tagged entity.

is emoji

This checks if the user's message is exactly an emoji.

For has tags, does not have tags, has exact tag, and does not have exact tag it is dependant on the tags created under the Tags Dashboard. You may visit Tags to learn more about the properties of tagging.

Examples

has keyword

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

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

does not have keyword

The opposite of the has keyword function. Checks if a property does not have a keyword from the list of declared keywords.

equals

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

does not equal

The opposite of the equals function. Checks if a property does not equal a value

matches regex

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

exists

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

does not exist

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

less than

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

greater than

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

has tags

This checks if the user's message has tagged entities. For a deeper understanding of how tags work, including examples and their use cases, refer to the Tags section.

does not have tags

This checks if the user's message does not have tagged entities. For a deeper understanding of how tags work, including examples and their use cases, refer to the Tags section.

is exactly

This checks if the message exactly matches a specific keyword, as opposed to containing it.

is not exactly

This checks if the user's message does not exactly match a given keyword or phrase.

has exact tag

This checks if the user's message is exactly a tagged entity. For a deeper understanding of how tags work, including examples and their use cases, refer to the Tags section.

does not have exact tag

This checks if the user's message is not exactly a tagged entity. For a deeper understanding of how tags work, including examples and their use cases, refer to the Tags section.

is emoji

This checks if the user's message is exactly an emoji (no text, just an emoji).

Last updated