Dec 11, 2019 11:39:45 PM Thomas Dumont
Integrate a Recast chatbot
Introduction
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.
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 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.
New dependencies in the site POM
Add the plugins dependencies in the site POM :
<dependency> <groupId>fr.paris.lutece.plugins</groupId> <artifactId>plugin-chatbot</artifactId> <version>1.0.4</version> <type>lutece-plugin</type> </dependency> <dependency> <groupId>fr.paris.lutece.plugins</groupId> <artifactId>plugin-recast</artifactId> <version>1.0.2</version> <type>lutece-plugin</type> </dependency> <dependency> <groupId>fr.paris.lutece.plugins</groupId> <artifactId>plugin-recastbots</artifactId> <version>1.0.2</version> <type>lutece-plugin</type> </dependency>
Administration and use
Declare a Recast bot in the Lutece Back Office
In the BackOffice of Lutece click on the Manage Recast Bots menu, then on Add Bot and fill in the following fields :
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 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 :
${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