June 15, 2022 / by Prashant Gupta / In /

How to create a web chat bot in Pega?

In this article I will be explaining how to create a simple webchat bot using Pega Personal edition 8.7

Pega Web Chat Bot

I have listed down all the necessary steps below:

  1. First we have to create a new case type for web chat bot.
  2. Create a digital messaging channel (WebChatbot) in App studio.
  3. Download Pega AppFactory from Pega marketplace and import it in your application.
  4. Add AppFactory as a built on application in your application.
  5. Save-as the section AppFactoryChatBot in your application ruleset.
  6. Save-as the section EmbeddedAFChatBot in your application ruleset.
  7. Update the section EmbeddedAFChatBot with your bot ID.
  8. Add section AppFactoryChatBot in you portal section at the bottom.
  9. Log off and log in back to see the chat icon at the bottom right corner of your portal screen.

Create a case type

case type : WebChatBot

Here, I have created a subprocess and added question shape in the flow diagram which comes in automations category. We can add as many questions as we want. For each question shape we will be creating question rule as shown below for Account Type question:

Stage 1 subprocess
Question rule
Question rule

Similarly, we can configure all other questions as well.

Create a Digital Messaging Channel

Now go to App Studio and create a digital messaging channel.

app studio : channels
creating a digital messaging channel

Now in configuration tab click on + Add case type in create case command

Creating a digital messaging channel

Select the case type from the drop down and add a create case command. Switch to Text analysis tab, so you can add keywords to create case command as shown below:

Creating a digital messaging channel
Creating a digital messaging channel
Creating a digital messaging channel

All the remaining tabs including Behaviour, Connection and Training Data can be kept as-is.

Now let’s test this from preview console:

Console preview of channel WebChatbot

So when I typed the statement “I want to open a current account” it starts the flow and the keyword open is matched from text analysis. The chat bot is configured to respond with the text “Select the account type you want to open”

Now to use this chat bot on a portal we have to make few more changes.

Configure the chat bot in portal

Go to your application rule and click on manage components

Application rule

Browse for AppFactory on Pega marketplace.

Download and import it in your Pega application. After importing it, add AppFactory as a built on application in your application and save the application rule.

Application rule
AppFactory application rule

Then search for the section AppFactoryChatBot in AppFactory:01-02 RSV. Click on Save as to save this section rule in your application Ruleset.

section : AppFactoryChatBot
section : AppFactoryChatBot

Search for another section EmbeddedAFChatbot in AFChatBot:01-02 RSV. Click on Save as to save this section in your application ruleset.

section : EmbeddedAFChatbot

Now go back to app studio and open the WebChatbot channel and check the bot ID from the clipboard. We have to make sure that web chat is open from console.

Open the section EmbeddedAFChatbot from your application ruleset and replace the bot ID here.

section : EmbeddedAFChatbot

Then launch the user portal, start Live UI and check for the portal section.

Click on Save as to save this section in your application ruleset and add section AppFactoryChatBot at the bottom.

Save this section rule. Log off and then log back in to launch user portal.

You will see a green chat icon at the bottom right corner.

Now let’s test this chat bot from portal. Click on the green chat icon.

as soon as I typed the statement “I want to open a current account.” as per the text analysis it opened the case WebChatBot and started asking the questions that I have set for this bot.

This is the end of the article and I am hoping you have understood the concept very well. In case you have any doubts or queries please drop a note in comments section.