At we allow developers to deploy functions written in Node.js as infinitely scalable API endpoints, which they can then share with others via our library. This functionality, paired with our other features like automatic SDK generation and documentation, has made StdLib a perfect match for the we received while attending AWS re:Invent. We’re excited to share our product with you— StdLib is the way to get started building Alexa Skills, from newbie to veteran developers. StdLib (“Standard Library”) Amazon Echo Dot fastest, easiest StdLib + Echo Dot = ❤ Our enthusiasm with our Echo Dot first culminated in a during the Westworld Season Finale. As a result of that video, we received a lot of questions from developers asking how to implement their own Alexa Skills. Based on the overwhelming response of the developer community, we thought it best to put together a 7 minute guide on how to build an Alexa Skill with StdLib. Let’s get started! Dolores Abernathy Alexa Skill demo What You’ll Need Beforehand 1x Amazon Echo or Amazon Echo Dot 1x Alexa App and Registration ( ) Follow These Official Instructions 1x Access to the Alexa Developer Portal 7x Minutes (or 420x Seconds) Minute 1: Preparing Your Alexa Skill To begin with, we’re going to prepare your Alexa Skill on the Amazon Alexa Developer Portal. Visit and sign in to begin. Click the “Alexa” button at the top to find this page: developer.amazon.com/alexa Get Started with the Alexa Skills Kit Click under the Alexa Skills kit to begin. Next, on the , click . Get Started > top right of the screen Add a New Skill Skill Information This is the information used to identify your skill and how your skill will interact with Alexa. It’s pretty straightforward to get started with. Fill in these fields as indicated above; is “Custom Interaction Model” so we can define the skill behavior, is “Test” to easily identify the skill, and , or the phrase we’ll use to get Alexa to execute our skill is “Test Bot” — i.e. . Press on the bottom right when you’re ready. Skill Type Name Invocation Name “Hey Alexa, ask Test Bot [a phrase]” Next Minute 2: Prepare Your Interaction Model Next, the interaction model defines how Alexa will interpret things you ask of her. We’re now looking at defining the phrase, sentence or question at the end of and how we expect Alexa to parse it. “Hey Alexa, ask Test Bot [whatever you’d like]” Intents can be thought of as different functions that your skill can refer to. They can interpret sentences based on (see below) and from these utterances can populate (variables). We’ll cover in a future tutorial, for now let’s get our first and set up: Intents Utterances slots slots Intent Utterance Our Intent needs an , so we’ll make a basic one that just has a “HelloWorld” intent. You can copy the setup on the left. This is going to be linked to a very simple (function trigger). Intent Schema Utterance Utterances Utterances are trigger phrases to ask Alexa to refer to a specific intent. In order to trigger our intent, we’ll use the phrase, HelloWorld “how are you.” Very Simple Utterance Example This is all we really need to set up our Interaction Model to begin with. We’re now ready to actually write code for our Alexa Skill. Minute 3: StdLib Account Setup To build a function and deploy it as an infinitely scalable web service, you’ll first need to setup a StdLib account, you can do so by signing up on the . Just click “Sign Up” and once you’ve registered, you’re all good to go! StdLib Homepage Click “Sign Up” to Create an Account — Takes Less than a Minute! Minute 4: Create a StdLib Workspace If you don’t have Node.js installed, download version 6.9.x or higher from the . Once complete, open up your Terminal or Command Line and install the (full documentation available). Official Node.js Website StdLib Command Line Tools, available on GitHub: stdlib/lib $ npm install lib.cli -g You’ll now use the StdLib command line tools to create an Alexa Skill. First, create a directory for your StdLib services and initialize a workspace — you’ll be asked to log in with the account you already registered. $ mkdir stdlib$ cd stdlib$ lib init Once your workspace is initialized, you’re ready to create your StdLib service. Minute 5: StdLib Service Creation and Deployment You’re now ready to create your Alexa Skill. StdLib provides really simple that allow you to work with Alexa without having to write any additional code. Create a service with the “alexa” template by typing the following: service templates $ lib create -t alexa Follow the on screen instructions to continue, and enter the directory associated with your Skill. Alexa Skill Function Creation Workflow You can test your skill immediately with: $ lib . However, you’ll get an error stating that the “Intent name is required” — execute the “HelloWorld” intent specifically with: $ lib .intents.HelloWorld The response should look something like this; HelloWorld Intent Response Awesome! The JSON response you see is what Alexa expects in order to talk to you when your skill is accessed. If you want to make any modifications to the Skill or Intent, simply look in the folder. You can now deploy to StdLib using: /functions/intents/HelloWorld.js $ lib up dev An example output showing where your Alexa Skill is Available via HTTPS Once deployment is complete, you’ll see the above message (with your username and service name) and can execute it live (in the cloud) using the URL provided, or you can test it from the command line using: $ lib <username>.<service>[@dev].intents.HelloWorld Great! Let’s combine this endpoint with the we generated earlier. Interaction Model Minute 6: Assigning Your StdLib Endpoint to Alexa Now that you’ve deployed a function as an infinitely scalable web service on StdLib, you’re ready to connect it to Alexa. Go back to the Amazon Developer Portal and on the option for your Skill, enter the following: Configuration Endpoint Setup via HTTPS Note that you’ll replace with your endpoint as retrieved in the last step — Once complete, hit in the bottom right corner and you’ll be taken to SSL configuration options. Choose “ ” to continue (StdLib takes care of SSL for you). https://keith.lib.id/alexa@dev/ please include the trailing slash! Next My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority Development Endpoint is a StdLib Subdomain Hit again in the bottom right corner to finish your skill preparation. Next Minute 7: Congratulations! Your Alexa Skill is ready! All that’s left to do is test your skill — you should be on the page already. First make sure your Skill is enabled for testing: Test On the “Test” Page, make sure your skill is enabled Scroll down a bit an enter in an Example Utterance. “how are you” is one of our Utterances Type “how are you” (we set this up in a previous step) and hit . You should see the following result: Ask Test Hit “Listen” to hear a voice demo of your response! Your Skill is now live for testing through your personal Echo or Echo Dot. If your Dot is powered on, connected to WiFi and listening, simply ask it: Hey Alexa, ask Test Bot how are you? You should get the following response, as shown in this demo: Alexa “Test Bot” Skill Demo Yep — that easy! That’s all you need to start playing and testing Alexa Skills on your own, we certainly hope you found it helpful! That’s It! Your Alexa Skill is ready! Thanks for following along! We’re happy to have been able to share how fast and easiest it is to build Alexa Skills on StdLib, and we’re excited to see what you’ll build. Stay tuned for more updates by , star us on , or . signing up on StdLib GitHub at stdlib/lib follow @StdLibHQ on Twitter We plan on releasing more material shortly to show you how to build more in-depth Alexa Skills. Integrations with other StdLib services or 3rd party tools are simple, enabling you to even more powerful things with your Echo Dot using only a few lines of code. to familiarize yourself in the meantime, and join our Developer Community Slack by click on . Read our documentation on GitHub Community > Slack stdlib.com Keep in touch, and or if there’s anything specifically you’d like to know about! Let us know if you’ve built anything exciting that you would like us the feature or share. Feel free to . comment here e-mail me at keith [at] stdlib [dot] com follow me on Twitter as well, @keithwhor
Share Your Thoughts