Question
GovCIO
US
Last activity: 17 Sep 2019 14:49 EDT
Unsuccessful Alexa integration using Pega PE V8.x/7.4 (localhost:8080) running on Tomcat
Hi Pega Experts,
I see there are some of the folks who were successful in Alexa integration using Pega. But I didn't see any posts for a successful integration with Pega PE version. I tried to implement the integration functionality mentioned in the article:https://community.pega.com/knowledgebase/articles/intelligent-virtual-assistant/configuring-iva-alexa but I was unsuccessful to receive the response back to my local host after tunneling of it using ssh command (ssh -R 80:localhost:8080 ssh.localhost.run) from command prompt. Not sure where I went wrong but I noticed that Alexa tried to call our REST service as per the article using my server URL setup done in Alexa integration settings. The interesting part I noticed is that the Pega REST service URL is not yet all accessible globally from the site: https://www.uptrends.com/tools/uptime. Here is my REST service URL in terms of local host perspective.
Before tunneling: https://localhost:443/prweb/PRRestService/alexachannel/srv/alexa
After tunneling: https://rpisupat-xpw3.localhost.run:443/prweb/PRRestService/alexachannel/srv/alexa
Please don't say that Alexa integration won't work on local host and works on a Pega platform setup done and all :)
Thanks and Regards,
Ravi Kumar Pisupati.
***Edited by Moderator Marissa to update platform capability tags****
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
PL
Hi,
1) You won't be able to use browser to verify whether the Alexa service works as the service expects to be accessed by legit amazon requests (Amazon Alexa requires we must verify certificates coming from the requests). That's why in the browser you see 401 - you can take a look in pega logs and observe log entries stating sth along the lines above.
You may want to use browser to access /prweb to verify whether both tunneling + https work (but you should use https and external url). If /prweb works then all the services underneath should work, too. Of course in Alexa console you must provide external url.
2) The service endpoint you see in REST configuration is just a hint how you should access the service. The system itself doesn't know how you reconfigure the outside world to access the system.
Hope it helps
Pegasystems Inc.
PL
Hi Ravi,
Amazon servers must be able to access your instance, as I can see you know that because you made a ssh tunnel to expose the port on public IP and domain. What worries me is that you tunneled port 80 which is not SSL, I assume it is either a mistake or you have openssl on that 80 to expose SSL on 443 (or localhost.run has this functionality).
First of all, you need to verify if exposed service is visible on the internet ("The interesting part I noticed is that the Pega REST service URL is not yet all accessible globally from the site" - this tells me it is not). This is something you need to check and solve any network configurations problems related to port exposure.
The other thing is that you need to have a proper and valid SSL certificate for the domain you expose the service on, otherwise Amazon Alexa will refuse to connect (https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-a-web-service.html). I don't know how localhost.run service works and whether they provide valid SSL certificate or not. Try to access the exposed service using wget (-d -v to see cert logs) or simply via browser and observe SSL status (click on the lock icon).
I run wget on your endpoint and I see SSL errors:
Hi Ravi,
Amazon servers must be able to access your instance, as I can see you know that because you made a ssh tunnel to expose the port on public IP and domain. What worries me is that you tunneled port 80 which is not SSL, I assume it is either a mistake or you have openssl on that 80 to expose SSL on 443 (or localhost.run has this functionality).
First of all, you need to verify if exposed service is visible on the internet ("The interesting part I noticed is that the Pega REST service URL is not yet all accessible globally from the site" - this tells me it is not). This is something you need to check and solve any network configurations problems related to port exposure.
The other thing is that you need to have a proper and valid SSL certificate for the domain you expose the service on, otherwise Amazon Alexa will refuse to connect (https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-a-web-service.html). I don't know how localhost.run service works and whether they provide valid SSL certificate or not. Try to access the exposed service using wget (-d -v to see cert logs) or simply via browser and observe SSL status (click on the lock icon).
I run wget on your endpoint and I see SSL errors:
--2019-09-05 11:40:00-- https://rpisupat-xpw3.localhost.run/prweb/PRRestService/alexachannel/srv/alexa
Resolving rpisupat-xpw3.localhost.run (rpisupat-xpw3.localhost.run)... Proprietary information hidden
Caching rpisupat-xpw3.localhost.run => Proprietary information hidden
Connecting to rpisupat-xpw3.localhost.run (rpisupat-xpw3.localhost.run)| Proprietary information hidden|:443... connected.
Created socket 3.
Releasing 0x000000000212cfb0 (new refcount 1).
Initiating SSL handshake.
SSL handshake failed.
Closed fd 3
Unable to establish SSL connection.
If those things start to work then you can go to alexa console (https://developer.amazon.com/alexa/console/) to Endpoint section and verify the URL then choose a proper SSL configuration.
Hope that helps, good luck.
GovCIO
US
Perfect!! Thanks for the long explanation on the issue. Let me work on this and will get back to you with more findings.
Pegasystems Inc.
US
I concurred, great reply from @skowp! As far as I know, PE does not have any limitation versus the regular edition of Pega platform. Maybe https is not pre-defined, please check on that.
GovCIO
US
Sure Kevin. Started using ngrok tool to tunnel the localhost in this context and will keep you guys posted on the progress.
GovCIO
US
Hi,
Looks like I am unable to reach the Service-REST instance after tunneling it using ngrok. Here is the attached. Please guide me on how to work and resolve this endpoint URL issue.
Accepted Solution
Pegasystems Inc.
PL
Hi,
1) You won't be able to use browser to verify whether the Alexa service works as the service expects to be accessed by legit amazon requests (Amazon Alexa requires we must verify certificates coming from the requests). That's why in the browser you see 401 - you can take a look in pega logs and observe log entries stating sth along the lines above.
You may want to use browser to access /prweb to verify whether both tunneling + https work (but you should use https and external url). If /prweb works then all the services underneath should work, too. Of course in Alexa console you must provide external url.
2) The service endpoint you see in REST configuration is just a hint how you should access the service. The system itself doesn't know how you reconfigure the outside world to access the system.
Hope it helps
GovCIO
US
Thank you for the suggestions. Let me check the logs and will get back with my findings.
GovCIO
US
Hi,
Finally I was successful in making a connection from Alexa to Pega V74. Here is the final console image. Thank you for all the help.
Pegasystems Inc.
PL
I'm happy that you made it work!
Could you write what was wrong with your setup or what was unclear in docs to help others having similar problem, especially with localhost tunneling and SSL?
Regards
GovCIO
US
Thanks for the reply. I was actually having some n/w issues with my laptop and is very slow. Not only that is the reason for my issue. There was a place where I did not select the proper configuration from Alexa’s Endpoint configuration. After your suggestions, I went line by line and corrected the setup using a new skill created. By the way, I didn’t bother about ports -> 8080 or 443 or 8043 as it is mentioned in the article. I just ran ngrok and took the https URL and called PRRestService accordingly. Whole testing from console, I started seeing the REST service method calling steps from the tracer. That made me confident on the successful of this POC. This is just a starting point for me and I need to learn more in this space.