Question
Areteans Technology Solutions
IN
Last activity: 27 Jan 2017 1:27 EST
Pega Facebook Chatbot Integration
Hello Everyone,
We are planning to do a POC for Pega Facebook chatbot integration.
For this we are searching for relevant documentation to do this. We are expecting if such documentation exists then it will have the following
1. How to get the facebook chatbot plugin API, is it free or licensed one.
2. Are there prerequisites to have this integration done e.g and particular version version of pega has to be installed, do we need pega Customer service and Pega CHAT to be installed (probably not) etc, does pega mobile has to be used for this?
3. What specfic steps we have to follow to do the integration..
We need this on urgent basis, so any help will be much appreciated.
Regards
Abhi
***Updated by Moderator: Vidyaranjan. Removed user added Ask the Expert tag. Apologies for confusion, shouldn't have been an end-user option***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Areteans Technology Solutions
IN
We were eventually successfully in solving the above mentioned inbound mapping issue, after some research we figured it was a pega bug of not able to handle a dot character i.e "." in the request query params which facebook send e.g hub.challenge etc. while trying to verify webhook. Pege provided a hotfix HFIX 29041 for pega 7.2, we applied and able to fix that, verified the webhook, genereated PAGE_ACCESS_TOKEN subscribed it to the app page, and subsequently create a POST rest service which is able to map jSON post request of this structure on the clipboard, we tested it by running the service simulator.
{"object":"page","entry":[{"id":"16860930805051450","time":1474415071481,"messaging":[{"sender":{"id":"10450390118891604"},"recipient":{"id":"16860930850051450"},"timestamp":14744150701429,"message":{"mid":"mid.14744150071421:77fb7c739ddc2a2f50","seq":370,"text":"hi"}}]}]}
We were eventually successfully in solving the above mentioned inbound mapping issue, after some research we figured it was a pega bug of not able to handle a dot character i.e "." in the request query params which facebook send e.g hub.challenge etc. while trying to verify webhook. Pege provided a hotfix HFIX 29041 for pega 7.2, we applied and able to fix that, verified the webhook, genereated PAGE_ACCESS_TOKEN subscribed it to the app page, and subsequently create a POST rest service which is able to map jSON post request of this structure on the clipboard, we tested it by running the service simulator.
{"object":"page","entry":[{"id":"16860930805051450","time":1474415071481,"messaging":[{"sender":{"id":"10450390118891604"},"recipient":{"id":"16860930850051450"},"timestamp":14744150701429,"message":{"mid":"mid.14744150071421:77fb7c739ddc2a2f50","seq":370,"text":"hi"}}]}]}
As per various article avaialable over internet that should do it, however when we are trying it from facebook i.e trying to chat with the app over messenger, it is not hitting the server with any post request, nothing in the logs. As per the article (https://blog.hartleybrody.com/fb-messenger-bot/) there is a step "make sure you set both the PAGE_ACCESS_TOKEN
and VERIFY_TOKEN
config values in your Heroku application, and you should be good to go", not sure how to do the same in pega, I mean does it has to be added as environment variable in the tomact app server? the facebook documentation doesn't say any such thing though. Any pointer in this regard will be very helpful, we need to complete this POC urgently.
Regards
Abhi
Pegasystems Inc.
IN
I found below two URLs useful to integrate facebook chatbot to any application.
Though, it has been coded in python, one can easily understand the logic and code it in different languages and can integrate.
Integration Details::
https://blog.hartleybrody.com/fb-messenger-bot/
Send_Message() to Bot logic::
https://github.com/hartleybrody/fb-messenger-bot/blob/master/app.py
Pegasystems Inc.
US
Abhi,
Here one of approaches.
- Setup a facebook page. This is the Page of the company/organization which is consumer facing.
- Setup the Facebook Messanger app for the above Page.
- You need to cnfigure messenger app for the above page. To set this up you need to login to the favebook developer portal. There a bunch of articles on how to do this.
- In the messenger app, you need to setup the webhook. Webhook points to the Bot URL which listens to the messenger (The URL is where you are going to deploy your Pega App.)
- In the messenger app congfiguration, make sure you subscribe to the facebook page..
- In the Pega app you can have a service defined and expose the service. You can have a HTTP service. The format of the message you will receive from the facebook will be like "{"object":"page","entry":[{"id":"16860930805051450","time":1474415071481,"messaging":[{"sender":{"id":"10450390118891604"},"recipient":{"id":"16860930850051450"},"timestamp":14744150701429,"message":{"mid":"mid.14744150071421:77fb7c739ddc2a2f50","seq":370,"text":"hi"}}]}]}"
Narsi.
Coforge
IN
For Step 2. In the messenger app, you need to setup the webhook. Webhook points to the Bot URL which listens to the messenger (The URL is where you are going to deploy your Pega App.)
While setting up webhook for the deployed pega application from facebook messenger, it gives internal server error. Although the same 'Rest Service' is working fine while running from the browser explicitely.
In log file for facebook messenger, it gives Inbound data mapping failed:com.pega.pegarules.pub.services.ServiceException: Inbound data mapping failed .
Here i am attaching the log file for the error message while setting up webhook from facebook messenger and browser message while running Rest Service explicitely from browser along with facebook messenger 'internal server error' message.
Areteans Technology Solutions
IN
Hello VULIN,
Any resolutions for the error which sumit has posted, we both are working on it, and having difficulty to proceed due to this issue.
Thanks & Regards
Abhi
Areteans Technology Solutions
IN
Hello VULIN,
We are currently stuck at step 2 of the solution you gave. We have successfully created a REST GET service in pega and checked it works fine when called directly over IE. Subscribed to facebook page as well for our appication, how ever while trying to verify the REST GET service URL from facebook,it is throwing internal server error, on pega logs we can see the request is hitting pega server but throwing inbound data mapping issue. We have already shared the logs, error message screen shots.
Any help will be appreciated, let us know the precise steps of how you created rest service on pega side and got it successfully verified from facebook.
Regards
Abhi
Accepted Solution
Areteans Technology Solutions
IN
We were eventually successfully in solving the above mentioned inbound mapping issue, after some research we figured it was a pega bug of not able to handle a dot character i.e "." in the request query params which facebook send e.g hub.challenge etc. while trying to verify webhook. Pege provided a hotfix HFIX 29041 for pega 7.2, we applied and able to fix that, verified the webhook, genereated PAGE_ACCESS_TOKEN subscribed it to the app page, and subsequently create a POST rest service which is able to map jSON post request of this structure on the clipboard, we tested it by running the service simulator.
{"object":"page","entry":[{"id":"16860930805051450","time":1474415071481,"messaging":[{"sender":{"id":"10450390118891604"},"recipient":{"id":"16860930850051450"},"timestamp":14744150701429,"message":{"mid":"mid.14744150071421:77fb7c739ddc2a2f50","seq":370,"text":"hi"}}]}]}
We were eventually successfully in solving the above mentioned inbound mapping issue, after some research we figured it was a pega bug of not able to handle a dot character i.e "." in the request query params which facebook send e.g hub.challenge etc. while trying to verify webhook. Pege provided a hotfix HFIX 29041 for pega 7.2, we applied and able to fix that, verified the webhook, genereated PAGE_ACCESS_TOKEN subscribed it to the app page, and subsequently create a POST rest service which is able to map jSON post request of this structure on the clipboard, we tested it by running the service simulator.
{"object":"page","entry":[{"id":"16860930805051450","time":1474415071481,"messaging":[{"sender":{"id":"10450390118891604"},"recipient":{"id":"16860930850051450"},"timestamp":14744150701429,"message":{"mid":"mid.14744150071421:77fb7c739ddc2a2f50","seq":370,"text":"hi"}}]}]}
As per various article avaialable over internet that should do it, however when we are trying it from facebook i.e trying to chat with the app over messenger, it is not hitting the server with any post request, nothing in the logs. As per the article (https://blog.hartleybrody.com/fb-messenger-bot/) there is a step "make sure you set both the PAGE_ACCESS_TOKEN
and VERIFY_TOKEN
config values in your Heroku application, and you should be good to go", not sure how to do the same in pega, I mean does it has to be added as environment variable in the tomact app server? the facebook documentation doesn't say any such thing though. Any pointer in this regard will be very helpful, we need to complete this POC urgently.
Regards
Abhi
Pegasystems Inc.
US
For our POC, we only enabled the following subsciption fields.
- Messages
- Messaging_optins
- messaging_account_linkings
Areteans Technology Solutions
IN
Dear VULIN,
We have already tried this while verifying the webhook, but post successful verification , while doing the chat no POST request is hitting our Server.
Regards
Abhi
LTIMindtree
GB
Guys,
need help create a chatbot in Pega.
Accenture
NL
Hi all,
We want to add "Get started" button in the facebook messanger for the chatbot, looks like we need pass some curl command from pega end, does anyone implemented this, please share if any suggestions.
This comment has been branched out as a new node and the new thread can be followed here
Pegasystems Inc.
IN
Hello!
Since this post looks to be Answered. We have created a new post where you could continue your troubleshooting.
Question on adding the "Get started" button in the Facebook messenger for the chatbot
Regards,
Lochan | Community Moderator | Pegasystems Inc.