Here is the code and instructional content you need to create your first Alexa skill.
- An Amazon developer account.
- An Amazon Web Services account.
- AWS Lambda
- Knowledge of Node.js and JSON.
For more information visit: https://developer.amazon.com/docs/ask-overviews/requirements-to-build-a-skill.html
- Intents: An intent represents an action that fulfils a user's spoken request. Intents can optionally have arguments called slots.
- Sample utterances: A set of likely spoken phrases mapped to the intents. This should include as many representative phrases as possible.
- AWS Lambda is a compute service that lets you run code without provisioning or managing servers. AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second. You pay only for the compute time you consume - there is no charge when your code is not running.
Intent | Sample utterances |
---|---|
FirstIntent | * First intent * Tell me about first intent * Activate first intent |
SecondIntent | * Second intent * Tell me about second intent * Activate second intent |
ThirdIntent | * Third intent * Tell me about third intent * Activate third intent |
To create your Alexa skill model, complete the following steps:
- Navigate to https://developer.amazon.com/home.html.
- Log on.
- Navigate to the Alexa tab and click Alexa Skills Kit.
- Click Create skill.
- Enter your skill's name in the Skill name field.
- Select Custom.
- Click Create skill.
- Select Start from scratch.
- Click Choose.
When you say a skill's invocation name you begin an interaction with a particular custom skill. For example, if the invocation name is Chatter bot, users can say: "Alexa, ask Chatter bot."
- In the CUSTOM menu, navigate to Invocation.
- Enter your Skill Invocation Name.
- Click Save Model
You must create intents to represent a user's spoken request. To create your intents, complete the following steps:
- In the CUSTOM menu, navigate to Intents.
- Click Add.
- Click Add intent.
- Click Create custom intent.
- In the Create custom intent field enter the following name: FirstIntent.
- Fill in the sample utterances for FirstIntent listed in Table 1.
- Click Save Model.
- Repeat steps 1 - 7 for SecondIntent and ThirdIntent.
- Click Build Model.
To set up your Endpoint to receive POST requests when a user interacts with your Alexa Skill, complete the following steps:
- Navigate to Service Endpoint Type and click AWS Lambda ARN.
- Navigate to Your Skill ID and copy it to your clipboard.
- Do not close your developer console.
To set up your Lamda function, complete the following steps:
- Open a new tab and navigate to https://console.aws.amazon.com/.
- Navigate to the AWS Services tab and click Lambda.
- Click Create function.
- Select Author from scratch.
- Enter your Function name.
- In the Runtime drop-down menu, select Node.js 10.x.
- Click Create function.
- Click Add trigger and select Alexa Skills Kit from the drop-down menu.
- Add the Skill ID that you copied from the developer console.
- Click Add.
- Click Save.
- Copy the ARN number on the top right corner of your window.
- Navigate to the developer console in your browser tab.
- Enter the ARN number in the Default Region field.
- Click Save Endpoints.
- Navigate to AWS and click on your function name.
- In the Function code window, add the index.js and messageResponses.js files to your folder.
- Click Save.
To build your model, complete the following steps:
- Navigate to the developer console.
- In your skill, navigate to the CUSTOM menu and click Intents.
- Click Build Model.
- In the Amazon developer console navigate to the Test tab.
- If the test section is grayed out, navigate to Test is disabled for this skill click Off and select Development.
- Where it says Type or click and hold the mic type Alexa ask + (Your skill name) and press Enter, then type “Ask (Your skill name) to (utterance)”.
- If the outputs are: "This is your invocation message" and "This is your (intent)" you are successful.