This alexa skill is a small demo template which serves as a frontend for the PokeAPI to demonstrate how to interact with a third party API from within an Alexa Lambda Function. It consists of the basic Launch, Help, Cancel intents, as well as a GetPokemon intent which interprets a slot from the user utterance to request information about the requested pokemon.
This template is a fork of the how to skill template tested in es-MX locale, with a script which improves workflow of publishing and testing the skill and with a working demo of a request being made to a third party service.
This is now updated to work with the python decorators approach to intents to reduce boilerplate code.
Here is a link to more detailed instructions on setting up the skill, but basically:
Be sure to create and work your items in the same region, you can see the region you are working as a get parameter in the aws console links: https://console.aws.amazon.com/lambda/home?region=us-east-1#/
.
During the aws configure
you will use this region in this case us-east-1
- Create an AWS account
- Create an AWS IAM group with admin permissions and user to get aws-cli credentials
- Create an Amazon Developer account
- Create the skill, set an invocation name (make it conversational) and follow the steps in order to build the model
- Create an AWS Lambda function to support the service for the skill:
- From 0
- Python 3.6
- Role from template
- Permission for simple microservices
There are some templates or blueprints in there if you search for
alexa
, but this is what worked for me because this way I am able to work on my editor instead of the amazon lambda editor
- Change
<AWS_LAMBDA_FUNCTION_NAME>
inpublish.sh
to yours, also update<AWS_CREDENTIALS_PROFILE>
or remove if you have not configured multiple profiles. - In the
Endpoint
tab in the developer console link your skill with your service by providing the ARN of your lambda function.
At this point you should be able to see your skill listed as a dev skill under the
Skills > Your Skills > Dev Skills
menu in the Alexa Console.
- After succesfully setting an invocation name, saving and building the model and saving the endpoint, run
publish.sh
and head over to the test tab so we can interact with alexa in the developers console. - Talk or write:
alexa <activate_word> <invocation_name>
in where<activate_word>
can be replaced for words like:open
,abrir
,preguntar
and others. - Copy the json input that your call produces and paste it on the lambda console under the
Configure test event > New test event
option this way, you have a way to easily test and debug your function for this specific intent. - Share your skill and any improvements to this template :))