Recently i attended one of the boot camp event where event host was using web based random generator to give away some prizes to the participants. He was typing minimum and maximum number and generating random number. once he has the random number and the winner he is walking into the audience to handover the prizes. To select next random number he is walking back to his laptop to generate again. This process taking too much time and it inspired me to create Random generator skill to Alexa so that we can use voice based app from anywhere in the room or within the audience.
Random generator is simple skill which require you to input valid number for the maximum number, so that it will give you random number. minimum number is not required. it will take by default 1.
Below steps by steps instruction help you to create or understand my skill.
Step #1 – Create an AWS Account
1. Open aws.amazon.com and then choose ‘Create a Free Account’
a. Follow the online instructions. Do not worry about the IAM role, we will do that later.
b. You will need a Valid Credit Card to set up your account (note the AWS Free Tier will suffice.
c. Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad.
2. Sign in to your Console
Step #2 – Create a Lambda Function
AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume - there is no charge when your code is not running. With Lambda, you can run code for virtually any type of application or backend service - all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability.
1. IMPORTANT: Select US East (N. Virginia) region (upper right). This is the only region that currently supports Alexa Skill development.
2. Select Lambda from Compute services (upper left)
3. Select “Create a Lambda Function” to begin the process of defining your Lambda function.
4. At the bottom of the ‘Select Blueprint’ page, select “Skip”
5. You should be in ‘Configure Function’. You should be able to add your code online or upload a zip file option.
6. set your handler and role as follows:
· Keep Handler as ‘index.handler’
· Drop down the “Role” menu and select “* Basic execution role”. This will launch a new tab in the IAM Management Console.
7. You will be asked to set up your Identity and Access Management or “IAM” role if you have not done so. AWS Identity and Access Management (IAM) enables you to securely control access to AWS services and resources for your users. Using IAM, you can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources. We need to create a role that allows our skill to invoke this Lambda function.
8. Accept the defaults to create a new IAM Role with a role name of lambda_basic_execution. Select “Allow” in the lower right corner and you will be returned to your Lambda function.
9. Keep the Advanced settings as default. Select ‘Next’ and review. You should see something like below. Then select ‘Create Function’:
10. Next we need to create an Event source. Event sources publish events that cause the Lambda function to be invoked. Upon invocation, AWS Lambda executes your code by passing the event to the handler in your Lambda function code. You associate an event source with your Lambda function using an event source mapping. We will use the Alexa Skills Kit event source and map it to this function.
· In your Lambda function tabs, select ‘Event Sources’ and Select ‘Add event source’
· Select ‘Alexa Skill Kit’ from the dropdown:
Step #3 – Set-up Your Alexa Skill in the Developer Portal
Skills are managed through the Amazon Developer Portal. You’ll link the Lambda function you created above to a Skill defined in the Developer Portal.
1. Open a new tab and go to the Developer Portal. Sign in or create a free account (upper right). You might see a different image if you have registered already or our page may have changed. If you see a similar menu and the ability to create an account or sign in, you are in the right place.
2. Once you’ve signed in, navigate to Apps & Services
3. Then select Alexa.
3. Choose Alexa Skills Kit:
4. Here is where you will define and manage your skill.
Select “Add New Skill”:
5. Make sure the radio button for the custom interaction model is selected for “Skill Type”.
6. Add the name of the skill. You can use “My Fact Skill” for this example. Remember, when you create a skill that you will publish, you will use a name that you define for your skill. That name will be the one that shows up in the Alexa App. Add the invocation name. Since we are using the sample, type “space geek”
7. Select "Next"
9. Now, notice you're on the interaction model.
10. Next, we need to define our skill’s interaction model. Let’s begin with the intent schema. In the context of Alexa, an intent represents an action that fulfills a user’s spoken request. Intents can optionally have arguments called slots. We will not be using custom slots in this template, but they are very useful if you want to parameterize your intents.
11. The next step is to build the utterance list.
12. Select Save. You should see the interaction model being built (this make a take a minute or 2). If you select next, your changes will be saved and you will go directly to the test screen. After selecting Save, it should now look like this:
13. Select Next, and you will be taken to the Configuration screen. Add the ARN from the Lambda function you created in the AWS Console earlier. Select the Lambda ARN (Amazon Resource Name) radio button. Then, select “No” for account linking since we will not be connecting to an external account.
14. Test the application using test simulator or using Amazon Echo Simulator Echosim.io
Installing and Enabling the Skill.
1. Go to http://alexa.amazon.com/#skills/ and select Amazing India skill or directly go to the URL below.
http://alexa.amazon.com/spa/index.html#skills/dp/B01H9ILCHU/?ref=skill_dsk_skb_sr_0
To use the random generator skill, try saying...
Alexa launch random guy
Alexa ask random guy
Alexa open random guy
Alexa ask random guy to maximum number is one hundred.
Comments