Dec 11, 2019 11:38:37 PM Thomas Dumont avatar   363

Integrate a BotPress chatbot


BotPress Logo

Introduction

This guide presents how to integrate a Chatbot powered platform BotPress into a Lutece site.

bot view

Three modes of integration are possible:

  • mode 1 : The cat is in the form of a web page (classic XPage)
  • mode 2 : The cat comes in a popup that opens with a button at the bottom right of any page of the site
  • mode 3 : The cat is integrated in iframe in another site

To integrate a BotPress bot the only information needed is its identifier and the address of the server

Include the feature

Required components

The necessary plugins are :

  • The ChatBot plugin which offers the conversational user interface in webpage, popup or content mode to integrate in iframe. This interface is not related to Botpress. It can be used with other chatbot technologies and allows a great flexibility of customization.
  • The plugin BotPress which allows to instantiate bots on the interface of the ChatBot plugin and to communicate with BotPress servers via the Converse API. Different types of response such as QuickReplies can be handled by this plugin.

New dependencies in the site POM

Add the plugins dependencies in the site POM ::

<dependency>
    <groupId>fr.paris.lutece.plugins</groupId>
    <artifactId>plugin-botpress</artifactId>
    <version>1.0.1</version>
    <type>lutece-plugin</type>
</dependency>
<dependency>
    <groupId>fr.paris.lutece.plugins</groupId>
    <artifactId>plugin-chatbot</artifactId>
    <version>1.0.4</version>
    <type>lutece-plugin</type>
</dependency>

Administration and use

Declare a BotPress bot in the Lutece Back Office

In the Back Office of Lutece click on the menu Manage BotPress Bots then on Add Bot and fill in the following fields :

Bot statement

Bot usage

Mode 1: web page

Access to the web page is via the following URL :

https://myhost/jsp/site/Portal.jsp?page=chatbot

Mode 2: Integration via a popup

This integration is done by adding the bookmark of the PageInclude proposed by the ChatBot plugin in the HTML template of the site (file WEB-INF/templates/site/page_frameset.html).
You must add the following line in this file before closing the body tag :

${chat_popup_include}

Mode 3: IFRAME integration

The URL to source the IFRAME is :

https://myhost/jsp/site/Portal.jsp?page=chatbot&view=bot&bot=mybot&standalone=true&lang=en