Skip to main content
Version: 2.0

Detecting emotions in chatbot conversations


Why should you detect emotions in chatbot conversations?

A sentiment and emotion analysis tool can detect the polarity of an exchange as well as the possible emotions present. It is a key tool for giving value to the information coming from customer interactions, especially when these exchanges take place with a chatbot.

Some human-machine interactions cannot be automated because they require empathy from a customer service department, an attentive ear and, above all, speed in processing requests. Unfortunately, some teams lack the resources and time to make use of this information in a timely manner. And very often this frustration with the chatbot can increase the risk of attrition (churn rate).


Looking to analyze the sentiments and emotions of user responses in a healthcare chatbot. These responses can help healthcare providers understand what resources may need to be added or changed based on the overall feelings of the users.


Use the get_sentiment and get_emotion SDK tools to quickly analyze chatbot conversations.

Sentiment analysis will automatically analyze the interactions with the chatbot and identify the customers who need special attention. By polarizing the opinions of chatbot users, our API provides key information to sales and customer relationship teams to prioritize and better target their actions.

Emotion analysis identifies the emotions that are present. The emotion results will return one of the six emotions; happiness, sadness, anger, surprise, disgust, or fear. This information could help guide you on how to manage your users experience by adding additional support, modifying the chatbot scripts, or implimenting a user satisifaction survey to find what could be improved.

Code set

import lettria

api_key = 'personal API key'
nlp = lettria.NLP(api_key)

with open("chatbot_data.csv", "r") as f:
emotion_data = f.readlines()


get_sentiment = nlp.get_sentiment
get_sentiment(granularity = 'sentence')

get_emotion = nlp.get_emotion
get_emotion(granularity = 'sentence')