PURPOSE This commit introduces a chatbot operator that works based on a user-defined script with various steps. SPECS A im_livechat.chatbot.script can be defined on a livechat rule. When a end-user reaches a website page that matches the rule, the chat window opens and the script of the bot starts iterating through its steps. The chatbot code is currently directly integrated with the existing livechat Javascript code. It defines extra conditions and layout elements to be able to automate the conversation and register user answers. AVAILABLE STEPS A script is defined with several steps that can currently be one of the following types: "text" A simple text step where the bot posts a message without expecting an answer e.g: "Hello! I'm a friendly robot!" "question_selection" The bot will ask a question and suggest answers, the end-user will have to click on the answer he chooses e.g: "How can I help you? -> Create a Ticket -> Create a Lead -> Speak with a human" "question_email" That step will ask the end user's email address (and validate it) The result is saved on the linked im_livechat.im_livechatchatbot.mail.message "question_phone" Same logic as the 'question_email' for a phone number We don't validate the input this time as it's a complicated process (requires country, ...) "forward_operator" Special type of step that will add a human operator to the conversation when reached, which stops the script and allow the visitor to discuss with a real person. The operator will be chosen among the available operators on the livechat.channel. If there is no operator available, the script continues normally which allows to automate an "answering machine" that will redirect the user in case no operator is available. e.g: "I'm sorry, no operator is available right now, please contact us by email at 'info@company.com', we will try to respond as soon as possible!". (Or even something more complex with multiple questions / paths). "free_input_single" Will ask the visitor for a single line of text. This text is not saved anywhere else than in the conversation, but it's still useful when combined with steps that create leads / tickets since those print the whole conversation into the description. "free_input_multi" Same as "free_input_single" but lets the user input multiple lines of text. The frontend implementation is made by waiting a few seconds (currently 10) for either the next submitted message or the next character typed into the input. This lets visitors explain their issue / question with multiple messages. Which is very useful since new messages are sent every time you press "Enter". LINKS Task-2030386 Part-of: odoo/odoo#84000 Co-authored-by: Patrick Hoste <pko@odoo.com> Co-authored-by: Aurélien Warnon <awa@odoo.com>
33 lines
1.1 KiB
XML
33 lines
1.1 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<odoo><data>
|
|
|
|
<record id="chatbot_script_answer_view_form" model="ir.ui.view">
|
|
<field name="name">chatbot.script.answer.view.form</field>
|
|
<field name="model">chatbot.script.answer</field>
|
|
<field name="arch" type="xml">
|
|
<form>
|
|
<sheet>
|
|
<group>
|
|
<field name="name"/>
|
|
<field name="script_step_id" invisible="1"/>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="chatbot_script_answer_view_tree" model="ir.ui.view">
|
|
<field name="name">chatbot.script.answer.view.tree</field>
|
|
<field name="model">chatbot.script.answer</field>
|
|
<field name="arch" type="xml">
|
|
<tree editable="bottom">
|
|
<field name="sequence" widget="handle"/>
|
|
<field name="script_step_id"/>
|
|
<field name="name"/>
|
|
<field name="redirect_link" string="Optional Link"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
</data></odoo>
|