Using the new AI on the Certainly Platform

The Certainly Platform offers a new AI service that will allow your bots to recognize user intent in a more natural way. This updated version uses AI to predict languages, sentiments, entities (both default and custom), and intents directly within the Module actions, without needing to employ dedicated Webhooks.

Each time a user reply is received, all this metadata is extracted seamlessly under an object called nlu. You can then access the NLU object and use the information collected to obtain user information or direct the conversation flow in specific ways.

We'll go more in-depth as to how we can use the new AI version in real bot conversations. Please note that you can use both AI versions at once in a single bot. Activating the new version will not render the traditional AI useless. Below, we'll cover:

Activating the new AI

By default, this version of the AI is not active on newly-created bots. However, you can send a request to our Customer Success team for this feature to be enabled in your bot for free. Please contact us at to request access.

Once activated, both AI versions will work in tandem. The AI Manager, accessed via the right sidebar menu of your bot canvas, will remain unchanged, and all your previously built Domains and Intents will still be saved and fully functioning.

This means that activating the new AI will not impact the current functioning of the bot, and it does not require reconfiguration of existing flows in order for it to continue working.

Introduction to the NLU object

As noted above, all the metadata extracted from a user's reply is stored in an object called nlu. This object can then be operated on through the use of Jinja templates to extract all the information that is relevant in a particular situation.

To view all the metadata stored in the nlu object at any point in the conversation flow, we can set up a simple variable inside the bot and use it to store the nlu object. Here, you can see an example of this setup:


The bot will populate the Custom Variable with the whole value of the nlu metadata object.


Once organized, the nlu object follows the basic structure outlined below:

The object provides four different types of predictions: languages, sentiments, entities, and intents. 

  • Languages: Automatically detects to a certain degree of confidence (0 ≤ confidence value ≤ 1) the language in which the end user typed their reply. Can be used to configure multi-language bots or to inform the user that a bot is capable of speaking in only one language.

  • Sentiments: The AI analyzes the overall emotion of the user's input within a range of -1 to 1. A neutral user reply is represented by a value of 0. If a user's emotion is understood as positive, the key sentiments in the nlu object have a positive value (0 < sentiments value ≤ 1). A negative user reply translates to a negative value (-1 ≤ sentiments value < 0).

    This measurement is based on publicly available datasets of words that have been manually annotated with positive or negative scores. As such, there are limitations that should be considered. For instance, the AI is not capable of distinguishing irony, and we cannot provide absolute guidance as to what a specific negative or positive value signifies. We recommend combining sentiments with intents when configuring your bot to get the best results possible.

  • Entities: Must be defined inside your AI Manager as specific categories. The bot owner needs to define what entities they want to use, in addition to what values these could have. The AI comes with some prebuilt entities specifically designed for ecommerce that will help you set up your bot in record time.

  • Intents: Can be defined as the overall intention behind a chatbot user's reply. The AI evaluates to a certain degree of confidence (0 ≤ confidence value ≤ 1) if the user's reply belongs to one of the configured intents in your AI Manager.

Supported prebuilt entities

The new AI service supports the following prebuilt entities:

Country information

Entity LabelExample Entity ValueEntity String


US, the Netherlands



Birmingham, Copenhagen


Postal code

1050, 28806


Temporal expressions

Entity LabelExample Entity ValueEntity String


Tomorrow, 1st of April, next weekend, this Sunday



4 days, 2 hours and 3 minutes



Christmas, New Year's Eve, May fourth



January, July, May



Monday, Saturday, Friday



Entity LabelExample Entity ValueEntity String


Seventeen, 1.5, 0,7, 212



3rd, fourth, eighteenth



300 ml, 2 liters, one gallon



8 miles, 4 feet, 42,195 km



80 °F, 72° Fahrenheit, thirty three Celsius, 90 degrees


Amount of money

20 dollars, 5 bucks, $12


Personal information

Entity LabelExample Entity ValueEntity String

First name

Susan, Casper, Joana




Phone number





Credit card

DinersClub, MasterCard, Visa



Mozilla Firefox, Edge, Chrome



Entity LabelExample Entity ValueEntity String

Shipping provider

DHL, FedEx, US Postal Service


Fashion: Sizing

Entity LabelExample Entity ValueEntity String


XS, medium, 42, 104


Size jeans

28/28, 32*30, 34l


Size shoes

45, 7, 40



normal, short, thigh length, 3/4 length



oversized, relaxed, slim


Fashion: Clothing

Entity LabelExample Entity ValueEntity String


dress, beachwear, suit, belt



shoulder bag, clutch, computer sleeve



Ballgown, maxi dress, cocktail dress



cap, fedora, tam o' shanter



wool coat, leather jacket, windbreaker



hoodie, cashmere sweater, pullover



chinos, jeans, shorts, jumpsuit



blouse, T-shirt, tunic



dress shoes, heels, boots, mule sandals



bathing shorts, tankini, swimsuit


Fashion: Attributes

Entity LabelExample Entity ValueEntity String


cotton, jersey, bamboo



casual, festive, cocktail party



birthday, wedding, Mother's Day, anniversary



blue, red, green


Training the AI with custom entities

You can train your bot's AI with a number of custom entities. Custom entities can refer to order numbers, product names and categories, and so on. Here, you can see the notation to follow when declaring an entity in an Example Sentence:

"Where is my order [23467,24547,76546,476876,347658,45756|order_number]?"

The Example Sentence shown above will result in your bot's AI learning about a custom entity type "order_number", which could look like any of the examples prepended to it. Keep in mind, you do not have to specify all possible values of the entity. Certainly will use machine learning to abstract a wider range of possibilities given the examples you supply in the AI Manager.

Here, you can see an instance where this Example Sentence has been added in a bot's AI Manager:


You may want to use a specific custom entity in several sentences inside the bot's AI Manager. In this case, it is possible to reference the entity in each sentence in which you're going to use it, and declare it only once in the AI Manager.

This can be seen in the image below, where the entity has been declared in the last Example Sentence:

When training your AI Manager with custom entities, please keep these guidelines in mind:

Best Practices Examples

When providing values for an entity, make sure to train the bot with both singular and plural values. Note: The AI is case-sensitive.

Instead of: [shoe,boot|storeProduct]
Use: [shoe,shoes,boot,boots|storeProduct]

When declaring the entity, do not include any spaces between the different values and the entity name.

Instead of: [coat, coats | storeProduct]
Use: [coat,coats|storeProduct]

When creating a sentence with an entity, it should not be prefixed or suffixed with an alphanumeric character.

Instead of: I want to find a[storeProduct]
Use: I want to find a [storeProduct]

Instead of: I’m looking for [storeProduct]s
Use: I’m looking for [storeProduct]

When multiple entities are referenced next to each other in one sentence, separate them with a space.

Instead of: I want [size][storeProduct]
Use: I want [size] [storeProduct]

When the sum of the number of values for all declared entities in a sentence is above 10, reference the entities in different sentences.

For instance, when you’ve declared the following entities as such:


Sum of the number of values = 11

Instead of: I want a [size] [storeProduct]


I want a small [storeProduct]
I want a [size] shirt

Using Jinja to extract entities from the NLU object

We'll now explore how to process the nlu object in order to extract the necessary entities and store the information in variables. We can use this method to extract both custom and default entities. Below, you'll find the following topics:

Extracting default entities

You can use the default entities listed above to extract information such as the user's email address, user name, phone number, and more from the user's replies. As we mentioned previously, the information comes from inside the nlu object, so we need to use Jinja templates to extract the relevant information.

This is an example of the setup required to extract the user's email from the nlu inside a Module's Connections:


Jinja template breakdown

Now we'll break down the Jinja snippet in order to get a better understanding of how the extraction works.

We first take the entire nlu object and iterate through all the entities that are recognized by the AI in the user's message. We do this through the use of a for-loop:

Inside this for-loop, we are also using an if statement to evaluate if any of the entities match the entity string we want. In the example setup above, "entity/common/email" is used to obtain the email.

Once we've identified that the entity is indeed present inside the nlu object, the next step is making sure it is the entity recognized with the highest confidence. For this, it's important to know that the entities inside the nlu object are ordered by confidence. Entities recognized by the AI appear first in the nlu, whereas entities with lower confidence will be placed later.

Noting this, we can set up another if statement in our flow, where loop.index represents the current iteration of the loop.

By saying, we are making sure the condition will be met only if the entity we're interested in is the first iteration of the loop. Since the first entity in thenlu object will be the one with the highest confidence, we can use this to ensure the entity value we store in our Custom Variable is the one with the highest confidence.

If all the conditions mentioned are fulfilled, we can go ahead and print the value for that entity inside the Custom Variable. We can then use this Custom Variable throughout the conversation.

Using the example described above, this would be the result of the setup we configured:


Extracting custom entities

For custom entities, it's important to train the AI model with the custom entities and configure the bot to use the new model.

In this example, we'll look closely at a setup that extracts two custom entities (item and person) from a visitor's message:


Jinja reference snippet:

The process of extracting the entities from the nlu object is very similar to the one used for extracting default entities. For an in-depth explanation of the Jinja templates, please refer to the Jinja template breakdown section above.

The overall result of this setup will be as follows: