Integrate a Recast chatbot into a Lutece site
- Integrate a Recast chatbot into a Lutece site
Your code here...
This guide shows how to integrate a Chatbot powered platform Recast.ai into a Lutece site.
Three modes of integration are possible:
- mode 1: The chat is in the form of a web page (XPage classic)
- mode 2: The chat comes in a popup that opens with a button at the bottom right of any page of the site
- mode 3: The chat is integrated in iframe in another site
To integrate a Recast bot the only information needed is the Access Token of it.
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 Recast and can be used with other chatbot.
- The plugin Recast which communicates with the Recast platform by encapsulating calls to the DIalog API in particular. In addition, this plugin is used to interpret all types of response messages specific to Recast: card , quickReplies , picture , video , ...
- The Recast Bots that allows to create instances of bots and publish them on the interface of the ChatBot plugin.
Creating the site POM
To create the site POM, you can use the LuteceTools service https://dev.lutece.paris.fr/incubator/jsp/site/Portal.jsp?page=createsitepom
Add the following plugins:
plugin-chatbot plugin-recast plugin-recastbots
Generating the WebApp of the site
In the directory containing the POM of the previously created site. Start the build of the site with the following Maven command:
Setting up and launching the WebApp
In the WEB-INF/conf/db.properties file, configure the database name, and the user / password information to access it.
Then launch the Maven command to play the database creation script:
Set up your Tomcat to point to the WebApp and launch it.
Administration and use
Declare a Recast bot in the Lutece Back Office
In the BackOffice of Lutece accessible at the following address:
and using the default account admin / adminadmin.
Select from the "Manage Recast Bots" menu and click on Add Bot and fill in the following fields:
Mode 1: web page
Access to the web page is via the following URL:
http: //myhost/jsp/site/Portal.jsp? page = chatbot
Mode 2: Integration via a popup
This integration is done by adding the bookmark of the PageInclude offered 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.
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