This is an alexa skill which gives you a Yoda quote when you ask for it. It can also be used a a boilerplate for building alexa skills.
You can test out this skill using an Amazon Echo device or at Echosim. The workflow is as follows:
- You invoke the skill saying "Alexa, say Yoda Quote."
- Alexa will give you a yoda quote and ask if you want more.
- If you say yes, it would again give you a yoda quote and ask if you want more. If you say no, it will exit out of the skiil.
- It also supports Help intent, which gives the user an introduction to what the app is all about and help them get started with the skill use.
This skill is written in Python using Flask and the python library Flask-Ask. The Implementation is as follows:
- When you invoke the skill, one of the Yoda quotes is fetched from the database (this data comes along with this project. Don't worry about adding it yourself)and spoken out by Alexa along with a question if you want more of yoda quotes.
- If you say yes, first step repeats.
- If you say no, Alexa echoes "Bye" and exits out of the skill.
This skill gets deployed instantly. Also, Hasura automatically generates SSL certificates for you. Just run the following commands to deploy your skill.
(Make sure you have hasura-cli)
$ hasura quickstart /alexa-yoda-bot
$ cd alexa-yoda-bot
$ git add . && git commit -m "Initial Commit"
$ git push hasura master
To link it with your Amazon Echo Device, go to your Amazon developer console.
-
Create a new skill. Call it
Yoda Quote
. Give the invocation name asyoda quote
. Click next. -
Add this intent schema
{
"intents": [
{
"intent": "YesIntent"
},
{
"intent": "NoIntent"
},
{
"intent": "HelpIntent"
},
{
"intent": "StopIntent"
},
{
"intent": "CancelIntent"
}
]
}
Leave custom slot types empty. Add the following sample utterances
YesIntent yes
YesIntent sure
YesIntent yeah
YesIntent ok
NoIntent no
NoIntent no thanks
NoIntent nope
HelpIntent help
HelpIntent whats this skill about
StopIntent stop
CancelIntent cancel
Click next.
-
For the service endpoint, check the
HTTPS
radio button.Put the default URL as
https://bot.<cluster-name>.hasura-app.io/yoda_quotes
. (Run$ hasura cluster status
from root directory to know your cluster name).Note: For quick testing, we have one skill service live at https://bot.drover65.hasura-app.io/yoda_quotes. (This test service will work only if you have followed 1 and 2)
Click next.
-
About SSL certificates, Hasura services have auto generated
LetsEncrypt
Grade A SSL certificates. This means, you have to check the radio button that saysMy development endpoint has a certificate from a trusted certificate authority
Click next.
-
Your skill is live on the ECHO device associated with your account. Test it by saying Alexa,
load yoda quote
. And Alexa will give you Yoda wisdom :)
The source code lies in the microservices/bot/app/src
directory. This is a simple application, so the entire code lies in server.py
.
You might want to go through the Flask-ask docs (a very quick read).
If you happen to getstuck at any point, feel free to mail me at [email protected]. Also, if you find an error or a bug, please raise an issue here.