Live Chat - Odoo 20 Community Book

Chatbots

A chatbot answers the first questions of a visitor before a person is needed, which helps a team that cannot be online all day. Configuration > Chatbots lists the scripts of the database: Jobs Bot, Lead Generation Bot, Odoo, Support Bot and Welcome Bot.

odoo Development

The form of a chatbot has its name, a picture, a button Test to try the conversation, and the smart button Channels with the number of channels that use it. The tab Script is a table of steps, and a handle at the left of each line changes the order. Each step has a Message, a Step Type, the Answers that a visitor may choose and the condition Only If, which limits the step to the visitors who chose a given answer earlier. The Support Bot of the example welcomes the visitor and asks whether the question is about Troubleshooting or Setup. A visitor who chose Troubleshooting is asked for the browser, and then all visitors are asked which module interests them. A text step announces that the bot will look for the right expert, and a step Forward to Operator hands the chat to a person.

odoo Development

The button Test runs the script as a visitor would live it. It opens a page of the website with a banner that says You are currently testing Support Bot and a link Back to edit mode, and the chat starts with the first question, shown as buttons. In the example, a visitor chose Troubleshooting, then the browser Chrome, then the module Livechat. The bot asked the questions in the order of the script, and after the choice of the module it wrote Let me check if I can connect you with the right expert. The conversation then ended, and a link Continue appeared at the bottom of the window.

odoo Development odoo Development odoo Development

The step types are Text, Question, Email, Phone, Forward to Operator, Free Input, Free Input (Multi-Line) and Create Lead. A Text step only posts its message. A Question step shows its answers as buttons, and the answer decides which later steps are shown, through the column Only If. A Free Input step lets the visitor type an answer in one line or in several lines, and the multi-line kind suits a question such as What do you need? The Email step checks the answer and refuses an address that is not valid, with the message that the text is not a valid email, and it does not move on until the visitor writes a good one. The Phone step does the same for a telephone number, using the country of the visitor to read it. The details are kept for the steps that follow, and for a visitor who is signed in they are also saved on the contact when the contact has no email or phone yet.

The step Create Lead belongs to the connection with the CRM application. It creates a lead from the email and phone that the visitor typed, or from the contact of a signed in visitor. The name of the lead is the first free input of the visitor, cut to 100 characters, or, when there is none, a name made from the title of the chatbot. The whole conversation is saved in the description of the lead, which is why a multi-line question before this step is a good way to let the visitor explain the need. The step has a field Sales Team, which assigns the lead to a team, and the lead is marked with the chatbot as its source.

The step Forward to Operator ends the bot and hands the visitor to a person. The step has a field for the expertise of the operator, and the chatbot then prefers an available agent with these subjects, using the order of section 2.5. The message of the step is posted, the agent joins the conversation, and the bot leaves it. When no agent is available, nothing is posted and the bot goes on, so later steps can ask for an email and create a lead. The same happens when the only agent who is available is the person who is testing, which is why the test of the example ended with the line that the conversation had ended and not with an agent.

A chatbot is attached to a channel in a rule of the tab Rules, where the field Chatbot is filled, so that the bot answers on the pages that the rule covers.

WhatsApp