Authentication in Web Chatbot
Authentication in Web Chatbot
By building Pega Intelligent Virtual Assistant (IVA) for Web Chatbot you can embed a chatbot on your website using the Pega Web Mashup mechanism, so that users can interact with your application. The system must authenticate the user before it can display the application mashup on an external web page. For more information about implementing an IVA for Web Chatbot, see Creating a Web Chatbot channel.
Configuration
The Web Chatbot channel has a similar configuration to the other conversational channels, for example, the Unified Messaging channel. However, the Web Chatbot channel configuration contains the additional Mashup tab, on which the system displays the current Web Chatbot server URL and the generated mashup HTML code. You can copy and paste the generated HTML code on an external webpage so that users have access to your IVA for Web Chatbot and can begin a conversation with the chatbot from this webpage.
In the sample snippet, for the data-pega-url
attribute, you define a URL that references our Authentication Service rule, which you set in the servlet
definition in the web.xml
file. Currently, for the IVA for Web Chatbot, you define the PRChat
servlet for the PRChatAuthentication
service.
1<servlet>
2 <servlet-name>PRChat</servlet-name>
3 <display-name>PRChat</display-name>
4 <description>Web Chat component, using custom authentication techniques</description>
5 <servlet-class>com.pega.pegarules.internal.web.servlet.WebStandardBoot</servlet-class>
6 <init-param>
7 <param-name>PegaEtierClass</param-name>
8 <param-value>com.pega.pegarules.session.internal.engineinterface.service.HttpAPI</param-value>
9 </init-param>
10 <init-param>
11 <param-name>AuthenticationType</param-name>
12 <param-value>PRCustom</param-value>
13 </init-param>
14 <init-param>
15  <param-name>RuntimeServletName</param-name>
16  <param-value>PRChat</param-value>
17 </init-param>
18 <init-param>
19 <param-name>AuthService</param-name>
20 <param-value>PRChatAuthentication</param-value>
21 </init-param>
22</servlet>
23
24<servlet-mapping>
25 <servlet-name>PRChat</servlet-name>
26 <url-pattern>/PRChat</url-pattern>
27</servlet-mapping>
28<servlet-mapping>
29 <servlet-name>PRChat</servlet-name>
30 <url-pattern>/PRChat/*</url-pattern>
31</servlet-mapping>
Authentication Service algorithm
The figure shown below describes how the authentication service works for an IVA for Web Chatbot:
Authentication API
- pyChatAuthentication – The main activity that is referenced in the PRChatAuthentication rule. This rule describes the entire logic for the authentication process for the chatbot.
- pyPopulateOperator - The system starts this activity in order to setup a newly created operator in the pxChannelAuth activity. The pxChannelAuth activity immediately creates a Pega Platform operator and then adds a mapping to an external channel user identifier.
- pyPostPopulateOperator – The system starts this activity after the system creates a new operator.