-
1Sign up for an Amazon Alexa developer account
Sign up at https://developer.amazon.com/alexa/ and register your Alexa devices if you want to use it for testing.
-
2Create a new Skill in the Skill Console
Create a custom skill and name it whatever you like. The name is only important for storing everything related to your skill.
-
3Enter an invocation name for your skill
This is what you'll use to trigger the skill. I chose to call it "MacroFab", so I would say "Alexa, ask MacroFab to...."
-
4Add at least one intent and one sample utterance
Create a custom intent with a name that helps you find it. The intent is the part that comes after the invocation. I'm using "blink an LED at rate hertz". Here, "rate" is a variable so let's assign it an Intent Slot. Create an Intent Slot. I called it "rate" to match my variable. I want it to be a number, so I make the slot type an AMAZON.NUMBER. This ensures that what Alexa hears ("fourty"), gets converted to a number (40). Next, go back up to the utterance and highlight the variable ("rate") and select the slot. The Intent will now change to "blink an LED at {rate} hertz" to show that the variable has been assigned.
-
5Successfully build your interaction model
Click on "Save Model" and then "Build Model" and it will create the skill for you.
-
6Sign up for an account at Losant
Sign up at https://www.losant.com/ We're using Losant to build the backend without having to write any code.
-
7Create an Application on Losant
Once logged into Losant, create a new Application. Choose a name that makes sense to you.
-
8Create a Webhook on Losant
Go to the webhook tab and Add Webhook. This is the link between Alexa and Losant. Choose a name and select "Alexa" for verification. Ensure "Wait for reply from workflow" is selected. Save the webhook.
-
9Set a web service endpoint to handle skill requests on Amazon
Back at the Amazon developer website, on the endpoint screen, choose "HTTPS" endpoint and enter the "https://triggers.losant.com/webhooks/xxxx" URL from the Losant webhook that you just created into the default region. Change the certificate type to "My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority"
-
10Create a Workflow on Losant
Use the workflow tab to create a Cloud Workflow. On the workflow, drag the "Webhook" node onto the workspace. Inside this Node, ensure the Webhook Name is set to the Alexa Webhook you created in Step 8. Drag a "Webhook Reply" node onto the workspace and connect the Webhook output to the Webhook Reply input. Inside the Webhook reply, set the Reply Body to String Template and copy the following into the text box:
{ "version": "1.0", "response": { "outputSpeech": { "type": "PlainText", "text": "Blink successful" }, "shouldEndSession": true } }
The JSON value "Blink Successful" for the "text" key is the response sent to Alexa and what is said after a successful action. You can change this to any text that you want to be said.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.