Import the StandardSkillBuilder class from the Alexa Skills Kit (ASK) SDK standard.
Create a new one called “RecipeName”. When all of the slots are filled, we add the record to the db.An Alexa skill is Amazon’s version of an app that runs on Echo devices.
This tutorial shows you how to set up a local Flask Server with a local DynamoDB instance for persistent storage and connect a debugger.Once you’ve downloaded DynamoDB, navigate to the directory where you extracted DynamoDBLocal.jar, and type the following command:The underlined ngrok URL displayed in the prompt above is the public URL you will use for your web service. After saving our userId and slots to local variables for conciseness, we then enter our first dialog. They can also easily grant anyone with an Echo access to their unpublished skill by simply adding their email to the list of allowed testers. The user can ask to add a recipe and state where the recipe is located and specify if it is a quick or long recipe to make. In this getting started guide, learn the basic concepts of Amazon DynamoDB and working the various AWS SDKs to start using DynamoDB from your applications.
Designed by AWS experts, this course helps you develop the skills you need for building applications that use Amazon DynamoDB. After you add it you will see it appear in the list and underneath the slot name it will say “Choose a slot type…” Click that and select “Amazon.Food”.For the last slot, create one called “LongOrQuick” and give it a custom slot type of “LongOrQuick” by entering that into the box that says “Create a new slot type..”.Skills are free to create and developers can install their unpublished skills on their own devices.
I will go over that process at the end.Now for our custom slot types, we need to add some acceptable values.Next we are going to set up a dialog for this slot.
An Alexa skill is Amazon’s version of an app that runs on Echo devices. DynamoDB has two capacity modes and those come with specific billing options for processing reads and writes on your tables: on-demand and provisioned.
Emitting an elicitSlot action notifies our skill to instruct the user with the provided speech output to give us a value for one of the needed parameters. A request handler is the code responsible for taking action on one or more types of incoming requests.Port 5000 is the port where your Flask server is running on. Once we have successfully obtained a value, we now can confirm that we’ve understood what the user said correctly. Install the flask-ask-sdk package through the pip command.6. If you want to test whether or not your Flask server is responding, you can also add the following lines to the code after creating the skill builder object.
There is also a dedicated Alexa Slack channel and a forum, which I’ve added links to in the resources section below.The first step in creating our skill is setting it up on the Amazon Developer Portal.
With the new ASK SDK helpers, you can add a few lines of code and run any of your Alexa skills in Python on a local server. You can retrieve and save your persistent attributes to DynamoDB with the following prompts:If you are (or are thinking of) using AWS Lambda, testing and debugging may not be straightforward outside of using CloudWatch Logs. The utterance will just be “{RecipeName}”. AWS Documentation Amazon DynamoDB Developer Guide.
If you’re curious, you can view your generated JSON by clicking on the “Code Editor” on the left-hand sidebar above your intents.This intent has an utterance of “Delete a recipe” and a RecipeName slot:Starting from the beginning, we are importing the Alexa SDK, the AWS SDK, and then the es6-promisify library.
DynamoDB charges for reading, writing, and storing data in your DynamoDB tables, along with any optional features you choose to enable. Sometimes it’s a web bookmark, other times it’s in a cookbook and other times it may be something we ripped out of a random magazine. The recipes he adds will be stored in DynamoDB and associated with his userId so only he can view and delete these recipes.In our code, there are 2 ways to prompt the user for slot values using a dialog. The other way is to explicitly handle the prompting and confirmation for the slot. For the slot, GetRecipeQuickOrLong is the only one and it has a custom slot type of the same name:This slot has values of “Long” and “Quick”:AI voice assistant technology is still in its infancy, but it’s clearly evident that it has the potential to fundamentally change the way we interact with our devices. You can also use your favorite code editor to do step-by-step debugging and track down possible issues.Next, take the following steps:3. Next we need to set up the Lambda function to run our skill’s code.