Official Content

In some cases, especially in multi-tenant applications, it may be necessary to make minor adjustments to the Conversational Flows object, to adapt them to each tenant (and avoid defining a different instance for each one); for example, changing the texts of the dialogues.

This document explains how to create dynamic Scripted Chatbots in that scenario.

For Scripted Chatbots, a Data Provider (ChatbotDefinition) is automatically generated. To understand this better, read Scripted Chatbots : Generated objects before continuing with this document.

How to configure a chatbot for each tenant

The ChatbotDefinition Data Provider can be edited and saved using a different name. You can make the necessary changes for any tenant.

Basically, you can change response messages, and add a Flow (considering some limitations which are detailed below (1)).

Afterwards, by editing the Custom Chatbot Definition property of the Conversational Flows instance, you assign your own Data Provider.

image_2020325172936_1_png

After doing this, your Data Provider won't be modified, even if you Generate your chatbot. 

The GXCF_Chatbots.config file will have a new entry, as shown below. Note the tag property with Name = CustomChatbotDefinition:

<?xml version="1.0" encoding="utf-8"?>
<Services>
  <Service>
    <Name>CitizenEnergyService</Name>
    <Type>Chatbot</Type>
    <ClassName />
    <AllowMultiple>true</AllowMultiple>
    <Properties>
      <Property>
        <Name>Provider</Name>
        <Value>None</Value>
      </Property>
      <Property>
        <Name>CustomChatbotDefinition</Name>
        <Value>CitizenEnergyServiceChatbot.ChatbotDefinitionCustom1</Value>
      </Property>
      <Property>
        <Name>BaseModule</Name>
        <Value>CitizenEnergyServiceChatbot</Value>
      </Property>
    </Properties>
  </Service>
</Services>

BaseModule is the Module where the Instance objects are generated.

What to do to support more than one instance

You won't define more than one instance but a Data Provider for each tenant.

Each of them has to be added to the GXCF_Chatbots.config file with a different Service name, e.g:

<?xml version="1.0" encoding="utf-8"?>
<Services>
  <Service>
    <Name>CitizenEnergyService</Name>
    <Type>Chatbot</Type>
    <ClassName />
    <AllowMultiple>true</AllowMultiple>
    <Properties>
      <Property>
        <Name>Provider</Name>
        <Value>None</Value>
      </Property>
      <Property>
        <Name>BaseModule</Name>
        <Value>CitizenEnergyServiceChatbot</Value>
      </Property>
    </Properties>
  </Service>
  <Service>
    <Name>CitizenEnergyService2</Name>
    <Type>Chatbot</Type>
    <ClassName />
    <AllowMultiple>true</AllowMultiple>
    <Properties>
      <Property>
        <Name>Provider</Name>
        <Value>None</Value>
      </Property>
      <Property>
        <Name>CustomChatbotDefinition</Name>
        <Value>CitizenEnergyServiceChatbot.ChatbotDefinitionCustom2</Value>
      </Property>
      <Property>
        <Name>BaseModule</Name>
        <Value>CitizenEnergyServiceChatbot</Value>
      </Property>
    </Properties>
  </Service>
</Services>

To use one Service or the other, call the PanelChatWeb (in the case of Web applications) with the corresponding Service name in the &Instance variable.

Note

The Data Providers you define must be called from a main object to be compiled.

Summary

Basically, you have to edit the Data Provider generated for your instance and make the necessary changes for each tenant. Then, edit the configuration file GXCF_Chatbots.config to add an entry for each one of these Data Providers. In the configuration file, you use a different Service name for each.
The Service name will be used to call the main objects (PanelchatWeb and PanelChatSD) to be able to launch the correct chatbot.


(1)What changes are not supported?

  • Redirections. Although you can define a new flow, you cannot define a redirection to or from it.
  • User input conditions
  • Flows with Conversational objects

Availability

Since GeneXus 16 upgrade 10

  

 

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant