I have been trying to use the self-hosted HTTPS version for months (with the valid-request PHP code to handle certificates, etc.) and have never been able to get it to complete their validation/submission process.
I even attended a Q&A session with Amazon Developers and nothing was ever solved. They said they would look into it but nothing has changed. I would recommend switching to the Lambda option.
After switching everything was much faster. So here are some tips and even the exact code I used to make the Skill.
1. Follow the example to get the Lambda setup
They have a good example to set up the function and get your accounts linked. I would recommend following their instructions on creating the Lambda function in AWS.
Notes on process:
- I used node.js so my sample code will be that.
- I used alexa-skills-kit-color-expert as the blueprint.
- I got a little tripped up with having different options of the Role/Policy stuff. In the end, I used ‘Create new role from template’ and selected ‘Simple Microservice Permissions’
2. Example Code
I built the Alexa skill for BibleTalk.tv and you can access the entire node.js function and the PHP code here:
I used most of the alexa-skills-kit-color-expert example simply changing out my welcome message and adding my intents.
I created an extra function ‘pingBTforData’ that calls my API for data. I simply return JSON properly formatted so there is no extra work in the lambda function needed.
The PHP functions calling the intent (
intent_latest('sermon') for example) returns a simple Object:
$rtn = new stdclass; $rtn->speech = "This is what is said"; $rtn->item = "Item object used to fill the Card in the Alexa App";
The API endpoints are very simple.Here is an endpoint on the site https://bibletalk.tv/api/alexa.php?intent=LatestSermon which looks like this:
Here are a few of the other intents just to see how data is returned:
A few hiccups
My first submission failed for the following reason:
The skill does not exit appropriately when users say “stop” and “cancel”.
So if a user would say ‘Launch BibleTalk’ my response would end with “What do you want to do?” and if the user said ‘Cancel’ it would launch the LaunchRequest again instead of the CancelRequest.
To fix this I needed to include the built-in Help, Cancel and Stop Intents to my Intent Schema:
I hope this helps you get your Alexa Skill made. It can be fun to experiment with new technology but when it never works properly, it can turn sour quick. Thanks for reading!