Question

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****

Correct Answer
September 9, 2019 - 5:25am

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

Comments

Keep up to date on this post and subscribe to comments

Pega
September 5, 2019 - 5:43am

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:

  1. --2019-09-05 11:40:00-- https://rpisupat-xpw3.localhost.run/prweb/PRRestService/alexachannel/srv/alexa
  2. Resolving rpisupat-xpw3.localhost.run (rpisupat-xpw3.localhost.run)... 35.193.161.204
  3. Caching rpisupat-xpw3.localhost.run => 35.193.161.204
  4. Connecting to rpisupat-xpw3.localhost.run (rpisupat-xpw3.localhost.run)|35.193.161.204|:443... connected.
  5. Created socket 3.
  6. Releasing 0x000000000212cfb0 (new refcount 1).
  7. Initiating SSL handshake.
  8. SSL handshake failed.
  9. Closed fd 3
  10. 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.

September 5, 2019 - 10:36am
Response to skowp

Perfect!! Thanks for the long explanation on the issue. Let me work on this and will get back to you with more findings.

 

September 5, 2019 - 10:51am

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.

September 6, 2019 - 1:20am
Response to KevinZheng_GCS

Sure Kevin. Started using ngrok tool to tunnel the localhost in this context and will keep you guys posted on the progress.

September 8, 2019 - 11:57pm

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.

 

Pega
September 9, 2019 - 5:25am
Response to Ravi Kumar Pisupati

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

September 9, 2019 - 10:17am
Response to skowp

Thank you for the suggestions. Let me check the logs and will get back with my findings.

September 10, 2019 - 1:56am
Response to skowp

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.

Pega
September 12, 2019 - 7:22am
Response to Ravi Kumar Pisupati

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

September 17, 2019 - 2:49pm
Response to skowp

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.