In this POC, I will show you how to integrate Pega 8.5.1 with Meta (Facebook) messenger.
Demo Video:
The Steps are as follows:
- Will download Facebook Channel component from Pega Marketplace and install in our application.
- Will create a Case Type MyWebChat.
- Will Create a Facebook channel in Pega App studio
- Will configure the Facebook Channel properly with the details received Facebook developer console.
- Finally will test it.
Let’s Goooooooooooooooo !!!!
Pega set up:
In Pega platform go to application definition,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-146.png)
In the above screenshot it is added but in your case it will be blank.
Under Enabled Components –> Click Manage Components
Go to Browse Apps and components
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-147.png)
It will take you to Pega market place (formerly called as Pega Exchange).
Then search for Facebook Channel
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-148.png)
Meta (Facebook) Configuration:
Login to Facebook with your account id and password,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-102.png)
Keep it as is,
Now login to ‘facebook for developer’ console, it will automatically login as you have already logged in to Meta (Facebook user account)
Home page of Facebook for developers will be as below,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-103.png)
Click the My Apps on right top corner,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-104.png)
Click Create App – Green button
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-105.png)
Select Business — I have selected it. And then scroll down and click Next
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-106.png)
Provide a name for your App, Click Create App button,
You will get the below screen,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-107.png)
Now scroll down to Messenger
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-108.png)
Click Set up
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-109.png)
Scroll down to Access Tokens section,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-110.png)
Click Create new Page
Give a page name – Mypegademoapppage – Camel casing does not work 🙂
Category is mandatory – so give as per the options available. I chose Property.
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-111.png)
Click Create Page and then click Save.
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-112.png)
Now scroll a little bit
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-113.png)
You can see, Home Groups Events Reviews More. Click More and go to About
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-114.png)
Click About
Scroll down–
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-115.png)
Now go back to the Meta for developers tab on your browser. From where you clicked
‘Create new Page’ button
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-116.png)
Now at this point in time you may see lot of tabs are opened in the browser,
So log off from Facebook account, all the tabs will be logged off
Now login again in Facebook account
You will land up to your account 🙂
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-117.png)
Login to Facebook for developers,
You will see on the left top corner – your app name – MyPegaDemoApp
And on the top right corner – your account name – Pega Poc
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-118.png)
So Facebook account is – Pega Poc
In Meta (Facebook) for developers – App name – MyPegaDemoApp
Now click ‘Add or remove Pages’
Click ‘Continue as Pega Poc’
You can see your newly created Page – Mypegademoapppage
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-119.png)
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-120.png)
Click Next
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-121.png)
Click Done and then Click OK
You will come back to the main screen,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-122.png)
Your page has been added successfully,
So lets summarize here—
Login to Meta (Facebook) account – with your Userid/password – Pega Poc – Account Name.
Login to Meta for developers – same user id password will be taken automatically.
Create an app – MyPegaDemoApp
Create a Messenger Set up
Create a Page – Mypegademoapppage
Add the Page (Mypegademoapppage) in the App (MyPegaDemoApp) of the Account (Pega Poc)
Now click Generate Token
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-123.png)
Now click Done. Next is Webhooks.
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-124.png)
Add Callback URL
For this, you need a https:// — URL but am using Personal edition.
So I will use ngrok to convert my personal edition URL to https:// URL
Download and install ngrok from internet and convert your URL to https://
In case you face issue — let me know in comment section.
Now go to the Meta for developer screen again,
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-125.png)
Click Add Callback URL
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-126.png)
Click Verify and Save
You will get the below screen
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-127.png)
Now click Add subscriptions
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-128.png)
Click Save
You will see the webhooks added successfully
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-129.png)
Pega Configuration:
Login to Pega and go to App studio –> Go to Channels
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-130.png)
Create Facebook channel Mypegapoc.
Configuration Tab:
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-131.png)
Add a case type — I have added MyWebChat
Behavior tab:
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-132-1024x576.png)
Enter the correct Authentication URL (callback) – created above
Connection tab:
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-133.png)
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-134.png)
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-135.png)
Yes, I have entered ‘hi’ and a reply (Hi, I am your Pega Platform Chatbot. How can I help you today?) came.
Now lets test in Meta (Facebook) messenger.
Go to your account and click Home icon on the top of the page.
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-136.png)
On the left hand pane – click Pages
You will see all the pages
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-137.png)
Now click the page under Pages you manage – Mypegademoapppage (I want to chat in this page as I configured this page with Pega).
Now click the messenger icon on the top left corner of this page. You will get the chat pop up
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-138.png)
Type ‘hi’ — Pega will reply — Welcome to chatbot powered by Pega
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-139.png)
Type ‘case’ — Pega will initiate the MyWebChat case and ask the questions set in that case type
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-140.png)
Pega Case type to be included in the Facebook Channel:
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-141.png)
How to select questions — Steps – More – Automations – Question
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-142.png)
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-143.png)
Notes:
Ngrok will expire after sometime — So if the Pega is not replying in the Meta (Facebook) chat that means it is expired.
Then generate another https:// URL from ngrok
Change the same in the
![](https://mypegapoc.com/wp-content/uploads/2022/04/image-145.png)
Then go to Pega App studio, Open Facebook channel — go to behavior tab and UPDATE the Authentication URL (callback) with new ngrok URL
The is the End of this POC and I hope you will be able to do it by yourself as well.
If you have successfully done it. Then Pat on your back. ;-).
If you have faced any issue please let me know in the comment section. I will get back to you.
This is good and highly helpful.
Can you do a blog on “Mashup” ?
Thanks Sabarish for visiting my blog. I will definitely post something on Mashup.
Thanks for sharing. Quite descriptive.
Thanks Durga Teja.
The article is good. I will try it by myself.
Thanks Nitish. Please try by yourself and if you face any issue please let me know. I will help you to solve the same.
This is pretty nice one. Very helpful.
Thanks Arnab. Please do share with your friends.