From 1f390145a05e96e0dbb07e1e6555fd0e87918bd5 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Thu, 26 Oct 2017 10:51:08 -0700 Subject: [PATCH 01/10] Standardize file structure, clarify with const/let --- multiple-streams/.ask/config | 19 + .../instructions/1-voice-user-interface.md | 87 +++++ .../instructions/2-lambda-function.md | 59 +++ .../instructions/3-connect-vui-to-code.md | 33 ++ multiple-streams/instructions/4-testing.md | 88 +++++ .../instructions/5-customization.md | 27 ++ .../instructions/6-publication.md | 128 +++++++ multiple-streams/interaction-model.json | 0 .../{js => lambda/custom}/audioAssets.js | 0 .../custom}/audioEventHandlers.js | 0 .../{js => lambda/custom}/constants.js | 0 .../{js => lambda/custom}/index.js | 0 .../{js => lambda/custom}/package.json | 0 .../{js => lambda/custom}/stateHandlers.js | 0 .../lambda/custom}/strings.js | 0 multiple-streams/lambda/package-lock.json | 350 ++++++++++++++++++ multiple-streams/lambda/package.json | 26 ++ multiple-streams/lambda/test/lambda.js | 42 +++ .../lambda/test/launch_request.json | 37 ++ multiple-streams/lambda/test/next_intent.json | 42 +++ multiple-streams/lambda/test/play_intent.json | 42 +++ .../lambda/test/playback_stopped.json | 39 ++ .../lambda/test/system_exception.json | 38 ++ .../lambda/test/test_exception.js | 65 ++++ .../lambda/test/test_launch_request.js | 79 ++++ .../lambda/test/test_next_intent.js | 65 ++++ .../lambda/test/test_play_intent.js | 79 ++++ .../lambda/test/test_playback_stopped.js | 60 +++ multiple-streams/models/en-US.json | 0 .../instructions/1-voice-user-interface.md | 87 +++++ .../instructions/2-lambda-function.md | 59 +++ .../instructions/3-connect-vui-to-code.md | 33 ++ single-stream/instructions/4-testing.md | 88 +++++ single-stream/instructions/5-customization.md | 27 ++ single-stream/instructions/6-publication.md | 128 +++++++ single-stream/interaction-model.json | 0 .../lambda/{src => custom}/audioAssets.js | 2 +- .../{src => custom}/audioEventHandlers.js | 4 +- .../lambda/{src => custom}/constants.js | 0 single-stream/lambda/{src => custom}/index.js | 18 +- .../lambda/{src => custom}/package-lock.json | 0 .../lambda/{src => custom}/package.json | 0 .../lambda/{src => custom}/stateHandlers.js | 21 +- single-stream/lambda/custom/strings.js | 19 + single-stream/lambda/test/test_exception.js | 16 +- .../lambda/test/test_launch_request.js | 16 +- single-stream/lambda/test/test_next_intent.js | 16 +- single-stream/lambda/test/test_play_intent.js | 16 +- .../lambda/test/test_playback_stopped.js | 16 +- 49 files changed, 1908 insertions(+), 63 deletions(-) create mode 100644 multiple-streams/.ask/config create mode 100644 multiple-streams/instructions/1-voice-user-interface.md create mode 100644 multiple-streams/instructions/2-lambda-function.md create mode 100644 multiple-streams/instructions/3-connect-vui-to-code.md create mode 100644 multiple-streams/instructions/4-testing.md create mode 100644 multiple-streams/instructions/5-customization.md create mode 100644 multiple-streams/instructions/6-publication.md create mode 100644 multiple-streams/interaction-model.json rename multiple-streams/{js => lambda/custom}/audioAssets.js (100%) rename multiple-streams/{js => lambda/custom}/audioEventHandlers.js (100%) rename multiple-streams/{js => lambda/custom}/constants.js (100%) rename multiple-streams/{js => lambda/custom}/index.js (100%) rename multiple-streams/{js => lambda/custom}/package.json (100%) rename multiple-streams/{js => lambda/custom}/stateHandlers.js (100%) rename {single-stream/lambda/src => multiple-streams/lambda/custom}/strings.js (100%) create mode 100644 multiple-streams/lambda/package-lock.json create mode 100644 multiple-streams/lambda/package.json create mode 100644 multiple-streams/lambda/test/lambda.js create mode 100644 multiple-streams/lambda/test/launch_request.json create mode 100644 multiple-streams/lambda/test/next_intent.json create mode 100644 multiple-streams/lambda/test/play_intent.json create mode 100644 multiple-streams/lambda/test/playback_stopped.json create mode 100644 multiple-streams/lambda/test/system_exception.json create mode 100644 multiple-streams/lambda/test/test_exception.js create mode 100644 multiple-streams/lambda/test/test_launch_request.js create mode 100644 multiple-streams/lambda/test/test_next_intent.js create mode 100644 multiple-streams/lambda/test/test_play_intent.js create mode 100644 multiple-streams/lambda/test/test_playback_stopped.js create mode 100644 multiple-streams/models/en-US.json create mode 100644 single-stream/instructions/1-voice-user-interface.md create mode 100644 single-stream/instructions/2-lambda-function.md create mode 100644 single-stream/instructions/3-connect-vui-to-code.md create mode 100644 single-stream/instructions/4-testing.md create mode 100644 single-stream/instructions/5-customization.md create mode 100644 single-stream/instructions/6-publication.md create mode 100644 single-stream/interaction-model.json rename single-stream/lambda/{src => custom}/audioAssets.js (95%) rename single-stream/lambda/{src => custom}/audioEventHandlers.js (95%) rename single-stream/lambda/{src => custom}/constants.js (100%) rename single-stream/lambda/{src => custom}/index.js (58%) rename single-stream/lambda/{src => custom}/package-lock.json (100%) rename single-stream/lambda/{src => custom}/package.json (100%) rename single-stream/lambda/{src => custom}/stateHandlers.js (89%) create mode 100644 single-stream/lambda/custom/strings.js diff --git a/multiple-streams/.ask/config b/multiple-streams/.ask/config new file mode 100644 index 0000000..59a39fb --- /dev/null +++ b/multiple-streams/.ask/config @@ -0,0 +1,19 @@ +{ + "deploy_settings": { + "default": { + "skill_id": "", + "was_cloned": false, + "merge": { + "skillManifest": { + "apis": { + "custom": { + "endpoint": { + "uri": "ask-custom-myradio-default" + } + } + } + } + } + } + } +} diff --git a/multiple-streams/instructions/1-voice-user-interface.md b/multiple-streams/instructions/1-voice-user-interface.md new file mode 100644 index 0000000..764bf25 --- /dev/null +++ b/multiple-streams/instructions/1-voice-user-interface.md @@ -0,0 +1,87 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Setting up Your Voice User Interface + +There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/alexa-skills-kit/vui). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that in [the next step](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) of this instructions guide. + +1. **Go to the [Amazon Developer Portal](http://developer.amazon.com). In the top right corner of the screen, click the Sign In button.**
(If you don't already have an account, you will be able to create a new one for free.) + + ![Sign in](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-1-developer-portal._TTH_.png) + +2. **Once you have signed in, click the Alexa button at the top of the screen.** + + ![Alexa button](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-2-alexa-button._TTH_.png) + +3. **On the Alexa page, choose the Get Started button for the Alexa Skills Kit.** + + ![Get Started](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-3-alexa-skills-kit._TTH_.png) + +4. **Select Add A New Skill.** This will get you to the first page of your new Alexa skill. + + ![Amazon Developer Portal](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-4-add-a-new-skill._TTH_.png) + +5. **Fill out the Skill Information screen.** Make sure to review the tips we provide below the screenshot. + + ![Skill Information](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-5-skill-information._TTH_.png) + + ### Skill Information Instructions + * **Skill Type** For this skill, we are creating a skill using the Custom Interaction Model. This is the default choice. + + * **Language** Choose the first language you want to support. You can add additional languages in the future, but we need to start with one. (This guide is using U.S. English to start.) + + * **Name** This is the name of the skill as it will be displayed in the [Alexa app](http://alexa.amazon.com). + + * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Minecraft Helper" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. + + | Invocation Name Requirements | Examples of incorrect invocation names | + | ---------------------------- | -------------------------------------- | + | The skill invocation name must not infringe upon the intellectual property rights of an entity or person. | korean air; septa check | + | Invocation names should be more than one word (unless it is a brand or intellectual property), and must not be a name or place | horoscope; trivia; guide; new york | + | Two word invocation names are not allowed when one of the words is a definite article, indefinite article, or a preposition | any poet; the bookie; the fool | + | The invocation name must not contain any of the Alexa skill launch phrases and connecting words. Launch phrase examples include "launch," "ask," "tell," "load," and "begin." Connecting word examples include "to," "from," "by," "if," "and," "whether." | trivia game for star wars; better with bacon | + | The invocation name must not contain the wake words "Alexa," "Amazon," "Echo," "Computer," or the words "skill" or "app." | hackster initial skill; word skills | + | The invocation name must be written in each language you choose to support. For example, the German version of your skill must have an invocation name written in German, while the English (US) version must have an invocation name written in English. | kitchen stories (German skill) | + + * **Audio Player** For this minecraft helper skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player). + +6. **Click the Next button to move to the Interaction Model.** + + + +7. Click on the **Launch Skill Builder** (Beta) button . This will launch the new Skill Builder Dashboard. + + ![Launch Skill Builder](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-7-skill-builder-launch._TTH_.png) + +8. Click on the "Code Editor" item under **Dashboard** on the top left side of the skill builder. + +9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/interaction-model.json), then click "Apply Changes" or "Save Model". + +10. Click on the "Dashboard" button. + + +11. Add some more sample utterances for your newly generated intents. These are the things a user would say to make a specific intent happen. Here are a few examples: + + * am I free {date} + * whats am i doing {date} + * what are my plans {date} + * what meetings do i have {date} + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-10-sample-utterances._TTH_.png) + +12. Click on the **Save Model** button, and then click on the **Build Model** button. + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-12-skill-builder-build-save-model._TTH_.png) + + +13. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md). + + If you get an error from your interaction model, check through this list: + + * **Did you copy and paste the provided code into the appropriate boxes?** + * **Did you accidentally add any unwanted characters to the Interaction Model or Sample Utterances?** + +

+[![Next: Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_lambda_function._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) + + diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md new file mode 100644 index 0000000..b68a45d --- /dev/null +++ b/multiple-streams/instructions/2-lambda-function.md @@ -0,0 +1,59 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/sskill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Setting Up A Lambda Function Using Amazon Web Services + +In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. + +1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). + + + +2. **Click "Services" at the top of the screen, and type "Lambda" in the search box.** You can also find Lambda in the list of services. It is in the "Compute" section. + + + +3. **Check your AWS region.** AWS Lambda only works with the Alexa Skills Kit in two regions: US East (N. Virginia) and EU (Ireland). Make sure you choose the region closest to your customers. + + + +4. **Click the "Create a Lambda function" button.** It should be near the top of your screen. (If you don't see this button, it is because you haven't created a Lambda function before. Click the blue "Get Started" button near the center of your screen.) + + + +5. **Choose the blueprint named "alexa-skill-kit-sdk-factskill".** We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself. + + + +6. **Configure your trigger.** Click in the dashed box, and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. + + + + Once you have selected Alexa Skills Kit, click the **Next** button. + +7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "MinecraftHelper" is sufficient if you don't have another idea for a name. + + + +8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. + +9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." + + + +10. **For this guide, you can skip all of the Advanced settings.** Click the **Next** button to move to the Review screen. + + + +11. **The Review screen is a summary of your choices. Click Create Function in the bottom left corner.** You will need to scroll down to find **Create Function.** + + + +12. **After you create the function, the ARN value appears in the top right corner. Copy this value for use in the next section of the guide.** + + + +

+ + + diff --git a/multiple-streams/instructions/3-connect-vui-to-code.md b/multiple-streams/instructions/3-connect-vui-to-code.md new file mode 100644 index 0000000..6161dc2 --- /dev/null +++ b/multiple-streams/instructions/3-connect-vui-to-code.md @@ -0,0 +1,33 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Connecting Your Voice User Interface To Your Lambda Function + +On [page #1](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together. + +1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. + +2. **Open the "Configuration" tab on the left side.** + + + +3. **Select the "AWS Lambda ARN" option for your endpoint.** You have the ability to host your code anywhere that you would like, but for the purposes of simplicity and frugality, we are using AWS Lambda. ([Read more about Hosting Your Own Custom Skill Web Service](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service).) With the AWS Free Tier, you get 1,000,000 free requests per month, up to 3.2 million seconds of compute time per month. Learn more at https://aws.amazon.com/free/. In addition, Amazon now offers [AWS Promotional Credits for developers who have live Alexa skills that incur costs on AWS related to those skills](https://developer.amazon.com/alexa-skills-kit/alexa-aws-credits). + + + +4. **Select "North America" or "Europe" as your geographical region.** IMPORTANT: Make sure you select the same region that you created your Lambda in. Remember, Alexa skills using AWS Lambda can only run in N. Virginia (North America) and Ireland (Europe). + + + +5. **Paste your Lambda's ARN (Amazon Resource Name) into the textbox provided.** It should look similar to the screenshot above. + +6. **Leave "Account Linking" set to "No."** For this skill, we won't be using Account Linking, but you can learn more about [Linking an Alexa User with a User in Your System.](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/linking-an-alexa-user-with-a-user-in-your-system) + +7. **Click the "Next" button to continue to page #4 of this guide.** + + [![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/3-7-next-button._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md) + +

+ + + diff --git a/multiple-streams/instructions/4-testing.md b/multiple-streams/instructions/4-testing.md new file mode 100644 index 0000000..f478663 --- /dev/null +++ b/multiple-streams/instructions/4-testing.md @@ -0,0 +1,88 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Testing Your Alexa Skill + +So far, we have [created a Voice User Interface](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) and [a Lambda function](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), and [connected the two together](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-lambda.md). Your skill is now ready to test. + +1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. + +2. **Open the "Test" tab on the left side.** + + + +3. **Understand the voice simulator.** While it's not specific to your skill, the Voice Simulator is a valuable testing tool for every skill. Type a word into the box, and click the "Listen" button to hear how Alexa will +pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Language [(SSML)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference) to modify how Alexa will interpret text to speech. Try these examples: + + ```html + 12345 + ``` + + ```html + 12345 + ``` + + ```html + 12345 + ``` + + + + Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect. + +4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "how can i build a map" + + + + ### Service Simulator Tips + * After you click the "Ask [Your Skill Name]" button, you should see the **Lambda Request** and **Lambda Response** boxes get populated with JSON data like in the screenshot above. + * Click the **Listen** button in the bottom right corner to hear Alexa read the response. + + * If you receive a response that reads: *"The remote endpoint could not be called, or the response it returned was invalid,"* this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill. + +5. **Configure a test event in AWS Lambda.** Now that you are familiar with the **request** and **response** boxes in the Service Simulator, it's important for you to know that you can use your **requests** to directly test your Lambda function every time you update it. To do this: + 1. Create & copy a new response with the Service Simulator. + + 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test event."** + + + + 3. **Choose "Alexa Start Session" from the Sample Event Template dropdown list.** You can choose any item in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. This will also be the sample request that fires every time you update and "Save and Test" your Lambda code. + + + + 4. **Delete the contents of the box, and paste your request into the box.** + + + + 5. **Click the "Save and test" button.** This will save your test event, and run it against your Lambda function. + + + + This gives you visibility into four things: + + * **Your response, listed in the "Execution Result."** + + + + * **A Summary of the statistics for your request.** This includes things like duration, resources, and memory used. + + + + * **Log output.** By effectively using console.log() statements in your Lambda code, you can track what is happening inside your function, and help to figure out what is happening when something goes wrong. You will find the log to be incredibly valuable as you move into more advanced skills. + + + + * **A link to your [CloudWatch](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:) logs for this function.** This will show you **all** of the responses and log statements from every user interaction. This is very useful, especially when you are testing your skill from a device with your voice. (It is the "[Click here](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:)" link in the Log Output description.) + +6. **Other testing methods to consider:** + + * [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go. + * [Unit Testing with Alexa](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/unit-testing.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). + +7. **If your sample skill is working properly, you can now customize your skill.** + +

+ + + diff --git a/multiple-streams/instructions/5-customization.md b/multiple-streams/instructions/5-customization.md new file mode 100644 index 0000000..d1e2840 --- /dev/null +++ b/multiple-streams/instructions/5-customization.md @@ -0,0 +1,27 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Customize the Skill to be Yours + +At this point, you should have a working copy of our Helper skill. In order to make it your own, you will need to customize it with data and responses that you create. Here are the things you will need to change: + +1. **New sentences to respond to your users.** There are several sentences and responses that you will want to customize for your skill. + + 1. **Go back to your copy of [index.js]((https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/src/index.js)).** + + 2. **Look for the comment "TODO: Update these messages to customize."** This is the beginning of the section where you need to customize several text strings for your skill. + + 3. **Continue through index.js until you reach the bottom of the file.** This will ensure that you cover each of the values that you need to update. + +2. **New language.** If you are creating this skill for another language other than English, you will need to make sure Alexa's responses are also in that language. + + * For example, if you are creating your skill in German, every single response that Alexa makes has to be in German. You can't use English responses or your skill will fail certification. + +3. **Once you have made the updates listed on this page, you can click "Next" to move on to Publishing and Certification of your skill.** + + + +

+ + + diff --git a/multiple-streams/instructions/6-publication.md b/multiple-streams/instructions/6-publication.md new file mode 100644 index 0000000..4010635 --- /dev/null +++ b/multiple-streams/instructions/6-publication.md @@ -0,0 +1,128 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Get Your Skill Certified and Published + +We are almost done! The last step is to add the metadata that your skill will use in the [Alexa app](http://amazon.com/skills). This page will walk you through the remaining steps, and give you some tips on how to avoid the common mistakes developers make that result in a failed certification. + +1. **Go to your skill's Publishing Information tab on the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list).** + + + +2. **Complete the Global Fields data.** These fields apply across all of the languages that your skill supports. + + + + * **For Category, we are building a how-to skill, so select "Games, Trivia, and Accessories."** You will also be presented with a **Sub-Category** option. For this skill, choose "Knowledge and Trivia." + + * **Provide testing instructions.** Testing instructions give you an opportunity to explain your skill, and any special or possibly confusing features, to the certification team. A value is required in this box. + + * Since you are using our Howto Sample, make sure to add this sentence to your Testing Instructions: + + ``` + This was built using the Howto Sample. + ``` + + This will let the testing team understand what you're providing them, and should decrease the testing time required. + + * **Countries and Region can be for "all countries", unless you have a specific reason to exclude a specific location.** This gives Amazon the ability to distribute your skill globally. Remember that you will need to create additional versions of your skill in the other available languages before they will be available in those countries. + +3. **Write your skill descriptions.** + + + + * **Spend some time coming up with an enticing, succinct description.** This is one of the few places you have an opportunity to attract new users, so make the most of it! These descriptions show up in the list of skills available in the [Alexa app](http://alexa.amazon.com/spa/index.html#skills). + +4. **For your example phrases, come up with the three most exciting ways a user can talk to your skill.** + + + + * **Make sure that each of your example phrases are a perfect match with one of your Sample Utterances.** Incorrect example phrases are one of the most common reasons that skills fail certification, so we have provided a short list of things to consider as you write your example phrases: + + | Common Failure Points for Example Phrases | + | ----------------------------------------- | + | Example phrases **must** adhere to the [supported phrases](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/supported-phrases-to-begin-a-conversation). | + | Example phrases **must** be based on sample utterances specified in your Intent Schema. | + | Your first example phrase **must** include a wake word and your invocation name. | + | Example phrases **must** provide a contextual response. | + + * **Choose three example phrases that are likely to be the most common ways that users will attempt to interact with your skill.** Make sure that each of them works well, and provides an excellent user experience. + +5. **Provide a comprehensive list of keywords for users that are searching for new skills.** This is an optional field, and searching the [Alexa app](http://alexa.amazon.com) will also find the words in your Skill Name and descriptions, so you don't need to overdo it. That being said, if there are words that you want users to find your skill with, you should include them here. Separate the keywords with commas. + + + +6. **Create your skill's icons.** You need two sizes of your icon: 108x108px and 512x512px. + + + + * **Make sure you have the rights to the icons you create.** Please don't violate any trademarks or copyrights. + * **If you don't have software to make icons, try one of these free options:** + + * [GIMP](https://www.gimp.org/) (Windows/Mac/Linux) + * [Paint.NET](http://www.getpaint.net/index.html) (Windows) + * [Inkscape](http://inkscape.org) (Windows/Mac/Linux) + * [Iconion](http://iconion.com/) (Windows/Mac) + + * To make it easier to get started, we've created blank versions of these icons in both sizes for many formats: + + * [PSD](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/psd._TTH_.zip) + * [PNG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/png._TTH_.zip) + * [GIF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/gif._TTH_.zip) + * [PDF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdf._TTH_.zip) + * [JPG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/jpg._TTH_.zip) + * [SVG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/svg._TTH_.zip) + * [PDN](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdn._TTH_.zip) - for [Paint.NET](http://www.getpaint.net/index.html) + * [XCF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/xcf._TTH_.zip) - for [GIMP](https://www.gimp.org/) + +7. **Open the Privacy & Compliance tab on the left side of your skill in the [Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list).** + + + +8. **Answer each of the Global Fields questions using the guidance below.** These fields also apply across all of the languages that your skill supports. + + + + * **Does this skill allow users to make purchases or spend real money?** For this how-to skill, the answer is no. For future skills, make sure you answer this appropriately. + + * **Does this Alexa skill collect users' personal information?** Again, for this how-to skill, the answer is no. If you do collect information about a user, such as names, email addresses, phone numbers, and so forth, ensure that you answer Yes to this question. + * Answering "yes" to this question will also require you to provide a link to your Privacy Policy at the bottom of the page. + + * **Is your skill directed to children under the age of 13?** Because you customized this skill with data you provided, it is possible that you created a skill that targets children under the age of 13. For this how-to skill, the answer is **no** because it doesn't target a specific age group. + * Factors to consider in determining if this skill is directed to children under 13 include: + * Subject matter of the skill + * Presence of child-oriented activities and incentives + * Type of language used in the skill + * Music and other audio content in the skill + * How the skill is described and marketed + * Intended audience for the skill + + If you're not sure, please see the [FTC's COPPA Guidance and FAQ](https://www.ftc.gov/tips-advice/business-center/guidance/complying-coppa-frequently-asked-questions) for more information. + +9. **Export Compliance.** Be certain that you agree with all of the conditions. If you do, make sure to check this box, as Amazon requires this permission to distribute your skill around the globe. + +10. **Privacy Policy URL.** This is an optional field, and should not be required for this howto skill sample. You can leave it blank. + +11. **Terms of Use URL.** This is also optional, and you can leave it blank. + +12. **Click the Save button at the bottom of the page.** + + + +13. **Each checkmark should be green, as shown.** + + + +14. **If you feel that your skill is ready for certification, click the "Submit for Certification" button at the bottom of the page.** + + + +15. **You're done with your submission!** Here are a few things you might need to know: + + * **Certification can take several days to complete.** Please be patient. It takes time because we want to get it right. + + * **Did something go wrong?** Our team of evangelists run [online office hours every Tuesday from 1-2pm Pacific Time](https://attendee.gotowebinar.com/rt/8389200425172113931). They can help answer any questions you might have. + + * **Want the coolest t-shirt you've ever seen?** Every month, we create a brand-new Alexa Developer t-shirt or hoodie, and send them out to developers that published a skill that month. [You can get yours here if you live in the US](https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion), [here for the UK](https://developer.amazon.com/en-gb/alexa-skills-kit/alexa-developer-skill-promotion), and [here for Germany](https://developer.amazon.com/de-de/alexa-skills-kit/alexa-developer-skill-promotion). + + diff --git a/multiple-streams/interaction-model.json b/multiple-streams/interaction-model.json new file mode 100644 index 0000000..e69de29 diff --git a/multiple-streams/js/audioAssets.js b/multiple-streams/lambda/custom/audioAssets.js similarity index 100% rename from multiple-streams/js/audioAssets.js rename to multiple-streams/lambda/custom/audioAssets.js diff --git a/multiple-streams/js/audioEventHandlers.js b/multiple-streams/lambda/custom/audioEventHandlers.js similarity index 100% rename from multiple-streams/js/audioEventHandlers.js rename to multiple-streams/lambda/custom/audioEventHandlers.js diff --git a/multiple-streams/js/constants.js b/multiple-streams/lambda/custom/constants.js similarity index 100% rename from multiple-streams/js/constants.js rename to multiple-streams/lambda/custom/constants.js diff --git a/multiple-streams/js/index.js b/multiple-streams/lambda/custom/index.js similarity index 100% rename from multiple-streams/js/index.js rename to multiple-streams/lambda/custom/index.js diff --git a/multiple-streams/js/package.json b/multiple-streams/lambda/custom/package.json similarity index 100% rename from multiple-streams/js/package.json rename to multiple-streams/lambda/custom/package.json diff --git a/multiple-streams/js/stateHandlers.js b/multiple-streams/lambda/custom/stateHandlers.js similarity index 100% rename from multiple-streams/js/stateHandlers.js rename to multiple-streams/lambda/custom/stateHandlers.js diff --git a/single-stream/lambda/src/strings.js b/multiple-streams/lambda/custom/strings.js similarity index 100% rename from single-stream/lambda/src/strings.js rename to multiple-streams/lambda/custom/strings.js diff --git a/multiple-streams/lambda/package-lock.json b/multiple-streams/lambda/package-lock.json new file mode 100644 index 0000000..283bc84 --- /dev/null +++ b/multiple-streams/lambda/package-lock.json @@ -0,0 +1,350 @@ +{ + "name": "Single_Stream_Audio_Player_Example", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "alexa-sdk": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/alexa-sdk/-/alexa-sdk-1.0.14.tgz", + "integrity": "sha1-RvIlzl8OkxXKU2I9xftAWOLn+xQ=", + "requires": { + "aws-sdk": "2.130.0", + "i18next": "3.5.2", + "i18next-sprintf-postprocessor": "0.2.2" + } + }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=" + }, + "aws-sdk": { + "version": "2.130.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.130.0.tgz", + "integrity": "sha1-8Mbafb2poVywwr6zAw9toqTAPDY=", + "requires": { + "buffer": "4.9.1", + "crypto-browserify": "1.0.9", + "events": "1.1.1", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.1.0", + "xml2js": "0.4.17", + "xmlbuilder": "4.2.1" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base64-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", + "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==" + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=" + }, + "buffer": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "requires": { + "base64-js": "1.2.1", + "ieee754": "1.1.8", + "isarray": "1.0.0" + } + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "requires": { + "assertion-error": "1.0.2", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.3" + } + }, + "chai-string": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.4.0.tgz", + "integrity": "sha1-NZFAwFHTak5LGl/GuRAVL0OKjUk=" + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "crypto-browserify": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-1.0.9.tgz", + "integrity": "sha1-zFRJaF37hesRyYKKzHy4erW7/MA=" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "requires": { + "type-detect": "4.0.3" + } + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==" + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" + }, + "i18next": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-3.5.2.tgz", + "integrity": "sha1-kwOQ1cMYzqpIWLUt0OQOayA/n0E=" + }, + "i18next-sprintf-postprocessor": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/i18next-sprintf-postprocessor/-/i18next-sprintf-postprocessor-0.2.2.tgz", + "integrity": "sha1-LkCfEENXk4Jpi2otpwzapVHWfqQ=" + }, + "ieee754": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", + "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "jmespath": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", + "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", + "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" + }, + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "requires": { + "has-flag": "2.0.0" + } + }, + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=" + }, + "url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "xml2js": { + "version": "0.4.17", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.17.tgz", + "integrity": "sha1-F76T6q4/O3eTWceVtBlwWogX6Gg=", + "requires": { + "sax": "1.2.1", + "xmlbuilder": "4.2.1" + } + }, + "xmlbuilder": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-4.2.1.tgz", + "integrity": "sha1-qlijBBoGb5DqoWwvU4n/GfP0YaU=", + "requires": { + "lodash": "4.17.4" + } + } + } +} diff --git a/multiple-streams/lambda/package.json b/multiple-streams/lambda/package.json new file mode 100644 index 0000000..673dcd0 --- /dev/null +++ b/multiple-streams/lambda/package.json @@ -0,0 +1,26 @@ +{ + "name": "Single_Stream_Audio_Player_Example", + "version": "1.0.0", + "description": "An simple audio player sample skill.", + "main": "index.js", + "scripts": { + "test": "mocha" + }, + "keywords": [ + "alexa", + "skill", + "audio player" + ], + "author": "Amazon.com", + "license": "See license in ../../LICENSE.txt", + "dependencies": { + "alexa-sdk": "^1.0.14", + "chai": "*", + "chai-string": "*", + "mocha": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/alexa/skill-sample-nodejs-audio-player" + } +} diff --git a/multiple-streams/lambda/test/lambda.js b/multiple-streams/lambda/test/lambda.js new file mode 100644 index 0000000..bd57ae1 --- /dev/null +++ b/multiple-streams/lambda/test/lambda.js @@ -0,0 +1,42 @@ +'use strict'; + +exports.debug = false; +exports.response = undefined; + +exports.context = function context() { + + //mostly used for compatibility with old Lambda function, not using callback + context.done = function (error, result) { + console.log("DEPRECATED - USE CALLBACKS INSTEAD"); + console.log("http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html#nodejs-prog-model-handler-callback"); + process.exit(); + } + context.succeed = function (result) { + console.log("DEPRECATED - USE CALLBACKS INSTEAD"); + console.log("http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html#nodejs-prog-model-handler-callback"); + process.exit(); + } + context.fail = function (error) { + console.log("DEPRECATED - USE CALLBACKS INSTEAD"); + console.log("http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html#nodejs-prog-model-handler-callback"); + process.exit(); + } + + return context; +} + +exports.callback = function callback(error, result) { + + if (error != undefined && error != null) { + console.error(error); + } + if (result != undefined && result != null) { + if (exports.debug) { + console.log("\n" + "******************* RESPONSE **********************"); + console.log("\n" + JSON.stringify(result, null, 2)); + } + exports.response = result; + } else { + console.log('result undefined or null'); + } +} \ No newline at end of file diff --git a/multiple-streams/lambda/test/launch_request.json b/multiple-streams/lambda/test/launch_request.json new file mode 100644 index 0000000..06b7a50 --- /dev/null +++ b/multiple-streams/lambda/test/launch_request.json @@ -0,0 +1,37 @@ +{ + "version": "1.0", + "session": { + "new": true, + "sessionId": "amzn1.echo-api.session.123", + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + } + }, + "context": { + "AudioPlayer": { + "playerActivity": "STOPPED" + }, + "System": { + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + }, + "device": { + "supportedInterfaces": { + "AudioPlayer": {} + } + } + } + }, + "request": { + "type": "LaunchRequest", + "requestId": "amzn1.echo-api.request.123", + "timestamp": "2017-03-04T19:02:37Z", + "locale": "en-GB" + } +} \ No newline at end of file diff --git a/multiple-streams/lambda/test/next_intent.json b/multiple-streams/lambda/test/next_intent.json new file mode 100644 index 0000000..888327e --- /dev/null +++ b/multiple-streams/lambda/test/next_intent.json @@ -0,0 +1,42 @@ +{ + "version": "1.0", + "session": { + "new": true, + "sessionId": "amzn1.echo-api.session.123", + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + } + }, + "context": { + "AudioPlayer": { + "offsetInMilliseconds": 255764, + "token": "https://audio1.maxi80.com", + "playerActivity": "STOPPED" + }, + "System": { + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + }, + "device": { + "supportedInterfaces": { + "AudioPlayer": {} + } + } + } + }, + "request": { + "type": "IntentRequest", + "requestId": "amzn1.echo-api.request.123", + "timestamp": "2017-03-13T22:39:07Z", + "locale": "en-GB", + "intent": { + "name": "AMAZON.NextIntent" + } + } +} \ No newline at end of file diff --git a/multiple-streams/lambda/test/play_intent.json b/multiple-streams/lambda/test/play_intent.json new file mode 100644 index 0000000..6bfa57b --- /dev/null +++ b/multiple-streams/lambda/test/play_intent.json @@ -0,0 +1,42 @@ +{ + "version": "1.0", + "session": { + "new": true, + "sessionId": "amzn1.echo-api.session.123", + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + } + }, + "context": { + "AudioPlayer": { + "offsetInMilliseconds": 3160, + "token": "0", + "playerActivity": "STOPPED" + }, + "System": { + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + }, + "device": { + "supportedInterfaces": { + "AudioPlayer": {} + } + } + } + }, + "request": { + "type": "IntentRequest", + "requestId": "amzn1.echo-api.request.123", + "timestamp": "2017-03-04T19:34:05Z", + "locale": "en-GB", + "intent": { + "name": "PlayAudio" + } + } +} \ No newline at end of file diff --git a/multiple-streams/lambda/test/playback_stopped.json b/multiple-streams/lambda/test/playback_stopped.json new file mode 100644 index 0000000..3207203 --- /dev/null +++ b/multiple-streams/lambda/test/playback_stopped.json @@ -0,0 +1,39 @@ +{ + "version": "1.0", + "context": { + "AudioPlayer": { + "offsetInMilliseconds": 272197, + "token": "https://audio1.maxi80.com", + "playerActivity": "STOPPED" + }, + "Display": {}, + "System": { + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + }, + "device": { + "deviceId": "amzn1.ask.device.123", + "supportedInterfaces": { + "AudioPlayer": {}, + "Display": { + "templateVersion": "1.0", + "markupVersion": "1.0" + }, + "VideoApp": {} + } + }, + "apiEndpoint": "https://api.amazonalexa.com" + } + }, + "request": { + "type": "AudioPlayer.PlaybackStopped", + "requestId": "amzn1.echo-api.request.123", + "timestamp": "2017-07-08T09:49:39Z", + "locale": "en-GB", + "token": "https://audio1.maxi80.com", + "offsetInMilliseconds": 272197 + } +} \ No newline at end of file diff --git a/multiple-streams/lambda/test/system_exception.json b/multiple-streams/lambda/test/system_exception.json new file mode 100644 index 0000000..1623be6 --- /dev/null +++ b/multiple-streams/lambda/test/system_exception.json @@ -0,0 +1,38 @@ + { + "version": "1.0", + "context": { + "System": { + "application": { + "applicationId": "amzn1.ask.skill.123" + }, + "user": { + "userId": "amzn1.ask.account.123" + }, + "device": { + "deviceId": "amzn1.ask.device.123", + "supportedInterfaces": { + "AudioPlayer": {}, + "Display": { + "templateVersion": "1.0", + "markupVersion": "1.0" + }, + "VideoApp": {} + } + }, + "apiEndpoint": "https://api.amazonalexa.com" + } + }, + "request": { + "type": "System.ExceptionEncountered", + "requestId": "amzn1.echo-api.request.123", + "timestamp": "2017-07-08T10:29:54Z", + "locale": "en-GB", + "error": { + "type": "INVALID_RESPONSE", + "message": "SpeechletResponse was null" + }, + "cause": { + "requestId": "amzn1.echo-api.request.123" + } + } +} \ No newline at end of file diff --git a/multiple-streams/lambda/test/test_exception.js b/multiple-streams/lambda/test/test_exception.js new file mode 100644 index 0000000..22efa8a --- /dev/null +++ b/multiple-streams/lambda/test/test_exception.js @@ -0,0 +1,65 @@ +'use strict'; + +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); + +const chai = require('chai'); +chai.use(require('chai-string')); + +const should = chai.should(); +const assert = chai.assert; + +let event = undefined; + +describe('Audio Player Test : Exception', function () { + + // pre-requisites + before(function (done) { + + // pass the skill debug flag to Lambda mockup + lambda.debug = constant.debug; + + event = require('./system_exception.json'); + skill.handler(event, lambda.context(), lambda.callback); + + done(); + + }); + + + it('it responses with valid response structure ', function (done) { + + lambda.response.should.have.property("version"); + lambda.response.version.should.equal("1.0"); + + done(); + }), + + it('it responses with output speech ', function (done) { + + lambda.response.should.have.property("response"); + let r = lambda.response.response; + + r.should.have.property("outputSpeech"); + r.outputSpeech.should.have.property("type"); + r.outputSpeech.type.should.equal('SSML'); + r.outputSpeech.should.have.property("ssml"); + r.outputSpeech.ssml.should.startWith(''); + r.outputSpeech.ssml.should.endWith(''); + + done(); + }), + + it('it responses with no directive ', function (done) { + + let r = lambda.response.response; + r.should.have.property("shouldEndSession"); + r.shouldEndSession.should.be.true; + + r.should.not.have.property("directives"); + + done(); + + }); +}); diff --git a/multiple-streams/lambda/test/test_launch_request.js b/multiple-streams/lambda/test/test_launch_request.js new file mode 100644 index 0000000..d480356 --- /dev/null +++ b/multiple-streams/lambda/test/test_launch_request.js @@ -0,0 +1,79 @@ +'use strict'; + +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); + +const chai = require('chai'); +chai.use(require('chai-string')); + +const should = chai.should(); +const assert = chai.assert; + +let event = undefined; + +describe('Audio Player Test : LaunchRequest', function () { + + // pre-requisites + before(function (done) { + + // pass the skill debug flag to Lambda mockup + lambda.debug = constant.debug; + + event = require('./launch_request.json'); + skill.handler(event, lambda.context(), lambda.callback); + + done(); + + }); + + + it('it responses with valid response structure ', function (done) { + + lambda.response.should.have.property("version"); + lambda.response.version.should.equal("1.0"); + + done(); + }), + + it('it responses with output speech ', function (done) { + + lambda.response.should.have.property("response"); + let r = lambda.response.response; + + r.should.have.property("outputSpeech"); + r.outputSpeech.should.have.property("type"); + r.outputSpeech.type.should.equal('SSML'); + r.outputSpeech.should.have.property("ssml"); + r.outputSpeech.ssml.should.startWith(''); + r.outputSpeech.ssml.should.endWith(''); + + done(); + }), + + it('it responses with AudioPlayer.Play directive ', function (done) { + + let r = lambda.response.response; + r.should.have.property("shouldEndSession"); + r.shouldEndSession.should.be.true; + + r.should.have.property("directives"); + r.directives.should.have.lengthOf(1); + + let d = r.directives[0]; + d.should.have.property("type"); + d.type.should.equal("AudioPlayer.Play"); + d.should.have.property("playBehavior"); + d.playBehavior.should.equal("REPLACE_ALL"); + d.should.have.property("audioItem"); + d.audioItem.should.have.property("stream"); + d.audioItem.stream.should.have.property("url"); + d.audioItem.stream.url.should.startWith("https://"); + d.audioItem.stream.should.have.property("token"); + d.audioItem.stream.should.have.property("expectedPreviousToken"); + d.audioItem.stream.should.have.property("offsetInMilliseconds"); + + done(); + + }); +}); diff --git a/multiple-streams/lambda/test/test_next_intent.js b/multiple-streams/lambda/test/test_next_intent.js new file mode 100644 index 0000000..da34b1f --- /dev/null +++ b/multiple-streams/lambda/test/test_next_intent.js @@ -0,0 +1,65 @@ +'use strict'; + +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); + +const chai = require('chai'); +chai.use(require('chai-string')); + +const should = chai.should(); +const assert = chai.assert; + +let event = undefined; + +describe('Audio Player Test : NextIntent', function () { + + // pre-requisites + before(function (done) { + + // pass the skill debug flag to Lambda mockup + lambda.debug = constant.debug; + + event = require('./next_intent.json'); + skill.handler(event, lambda.context(), lambda.callback); + + done(); + + }); + + + it('it responses with valid response structure ', function (done) { + + lambda.response.should.have.property("version"); + lambda.response.version.should.equal("1.0"); + + done(); + }), + + it('it responses with output speech ', function (done) { + + lambda.response.should.have.property("response"); + let r = lambda.response.response; + + r.should.have.property("outputSpeech"); + r.outputSpeech.should.have.property("type"); + r.outputSpeech.type.should.equal('SSML'); + r.outputSpeech.should.have.property("ssml"); + r.outputSpeech.ssml.should.startWith(''); + r.outputSpeech.ssml.should.endWith(''); + + done(); + }), + + it('it responses with no directive ', function (done) { + + let r = lambda.response.response; + r.should.have.property("shouldEndSession"); + r.shouldEndSession.should.be.true; + + r.should.not.have.property("directives"); + + done(); + + }); +}); diff --git a/multiple-streams/lambda/test/test_play_intent.js b/multiple-streams/lambda/test/test_play_intent.js new file mode 100644 index 0000000..95ebd84 --- /dev/null +++ b/multiple-streams/lambda/test/test_play_intent.js @@ -0,0 +1,79 @@ +'use strict'; + +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); + +const chai = require('chai'); +chai.use(require('chai-string')); + +const should = chai.should(); +const assert = chai.assert; + +let event = undefined; + +describe('Audio Player Test : PlayIntent', function () { + + // pre-requisites + before(function (done) { + + // pass the skill debug flag to Lambda mockup + lambda.debug = constant.debug; + + event = require('./play_intent.json'); + skill.handler(event, lambda.context(), lambda.callback); + + done(); + + }); + + + it('it responses with valid response structure ', function (done) { + + lambda.response.should.have.property("version"); + lambda.response.version.should.equal("1.0"); + + done(); + }), + + it('it responses with output speech ', function (done) { + + lambda.response.should.have.property("response"); + let r = lambda.response.response; + + r.should.have.property("outputSpeech"); + r.outputSpeech.should.have.property("type"); + r.outputSpeech.type.should.equal('SSML'); + r.outputSpeech.should.have.property("ssml"); + r.outputSpeech.ssml.should.startWith(''); + r.outputSpeech.ssml.should.endWith(''); + + done(); + }), + + it('it responses with AudioPlayer.Play directive ', function (done) { + + let r = lambda.response.response; + r.should.have.property("shouldEndSession"); + r.shouldEndSession.should.be.true; + + r.should.have.property("directives"); + r.directives.should.have.lengthOf(1); + + let d = r.directives[0]; + d.should.have.property("type"); + d.type.should.equal("AudioPlayer.Play"); + d.should.have.property("playBehavior"); + d.playBehavior.should.equal("REPLACE_ALL"); + d.should.have.property("audioItem"); + d.audioItem.should.have.property("stream"); + d.audioItem.stream.should.have.property("url"); + d.audioItem.stream.url.should.startWith("https://"); + d.audioItem.stream.should.have.property("token"); + d.audioItem.stream.should.have.property("expectedPreviousToken"); + d.audioItem.stream.should.have.property("offsetInMilliseconds"); + + done(); + + }); +}); diff --git a/multiple-streams/lambda/test/test_playback_stopped.js b/multiple-streams/lambda/test/test_playback_stopped.js new file mode 100644 index 0000000..47174b6 --- /dev/null +++ b/multiple-streams/lambda/test/test_playback_stopped.js @@ -0,0 +1,60 @@ +'use strict'; + +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); + +const chai = require('chai'); +chai.use(require('chai-string')); + +const should = chai.should(); +const assert = chai.assert; + +let event = undefined; + +describe('Audio Player Test : Playback Stopped', function () { + + // pre-requisites + before(function (done) { + + // pass the skill debug flag to Lambda mockup + lambda.debug = constant.debug; + + event = require('./playback_stopped.json'); + skill.handler(event, lambda.context(), lambda.callback); + + done(); + + }); + + + it('it responses with valid response structure ', function (done) { + + lambda.response.should.have.property("version"); + lambda.response.version.should.equal("1.0"); + + done(); + }), + + it('it responses with no output speech ', function (done) { + + lambda.response.should.have.property("response"); + let r = lambda.response.response; + + r.should.not.have.property("outputSpeech"); + + done(); + }), + + it('it responses with no directive ', function (done) { + + let r = lambda.response.response; + r.should.have.property("shouldEndSession"); + r.shouldEndSession.should.be.true; + + r.should.not.have.property("directives"); + + done(); + + }); +}); diff --git a/multiple-streams/models/en-US.json b/multiple-streams/models/en-US.json new file mode 100644 index 0000000..e69de29 diff --git a/single-stream/instructions/1-voice-user-interface.md b/single-stream/instructions/1-voice-user-interface.md new file mode 100644 index 0000000..764bf25 --- /dev/null +++ b/single-stream/instructions/1-voice-user-interface.md @@ -0,0 +1,87 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Setting up Your Voice User Interface + +There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/alexa-skills-kit/vui). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that in [the next step](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) of this instructions guide. + +1. **Go to the [Amazon Developer Portal](http://developer.amazon.com). In the top right corner of the screen, click the Sign In button.**
(If you don't already have an account, you will be able to create a new one for free.) + + ![Sign in](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-1-developer-portal._TTH_.png) + +2. **Once you have signed in, click the Alexa button at the top of the screen.** + + ![Alexa button](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-2-alexa-button._TTH_.png) + +3. **On the Alexa page, choose the Get Started button for the Alexa Skills Kit.** + + ![Get Started](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-3-alexa-skills-kit._TTH_.png) + +4. **Select Add A New Skill.** This will get you to the first page of your new Alexa skill. + + ![Amazon Developer Portal](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-4-add-a-new-skill._TTH_.png) + +5. **Fill out the Skill Information screen.** Make sure to review the tips we provide below the screenshot. + + ![Skill Information](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-5-skill-information._TTH_.png) + + ### Skill Information Instructions + * **Skill Type** For this skill, we are creating a skill using the Custom Interaction Model. This is the default choice. + + * **Language** Choose the first language you want to support. You can add additional languages in the future, but we need to start with one. (This guide is using U.S. English to start.) + + * **Name** This is the name of the skill as it will be displayed in the [Alexa app](http://alexa.amazon.com). + + * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Minecraft Helper" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. + + | Invocation Name Requirements | Examples of incorrect invocation names | + | ---------------------------- | -------------------------------------- | + | The skill invocation name must not infringe upon the intellectual property rights of an entity or person. | korean air; septa check | + | Invocation names should be more than one word (unless it is a brand or intellectual property), and must not be a name or place | horoscope; trivia; guide; new york | + | Two word invocation names are not allowed when one of the words is a definite article, indefinite article, or a preposition | any poet; the bookie; the fool | + | The invocation name must not contain any of the Alexa skill launch phrases and connecting words. Launch phrase examples include "launch," "ask," "tell," "load," and "begin." Connecting word examples include "to," "from," "by," "if," "and," "whether." | trivia game for star wars; better with bacon | + | The invocation name must not contain the wake words "Alexa," "Amazon," "Echo," "Computer," or the words "skill" or "app." | hackster initial skill; word skills | + | The invocation name must be written in each language you choose to support. For example, the German version of your skill must have an invocation name written in German, while the English (US) version must have an invocation name written in English. | kitchen stories (German skill) | + + * **Audio Player** For this minecraft helper skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player). + +6. **Click the Next button to move to the Interaction Model.** + + + +7. Click on the **Launch Skill Builder** (Beta) button . This will launch the new Skill Builder Dashboard. + + ![Launch Skill Builder](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-7-skill-builder-launch._TTH_.png) + +8. Click on the "Code Editor" item under **Dashboard** on the top left side of the skill builder. + +9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/interaction-model.json), then click "Apply Changes" or "Save Model". + +10. Click on the "Dashboard" button. + + +11. Add some more sample utterances for your newly generated intents. These are the things a user would say to make a specific intent happen. Here are a few examples: + + * am I free {date} + * whats am i doing {date} + * what are my plans {date} + * what meetings do i have {date} + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-10-sample-utterances._TTH_.png) + +12. Click on the **Save Model** button, and then click on the **Build Model** button. + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-12-skill-builder-build-save-model._TTH_.png) + + +13. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md). + + If you get an error from your interaction model, check through this list: + + * **Did you copy and paste the provided code into the appropriate boxes?** + * **Did you accidentally add any unwanted characters to the Interaction Model or Sample Utterances?** + +

+[![Next: Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_lambda_function._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) + + diff --git a/single-stream/instructions/2-lambda-function.md b/single-stream/instructions/2-lambda-function.md new file mode 100644 index 0000000..b68a45d --- /dev/null +++ b/single-stream/instructions/2-lambda-function.md @@ -0,0 +1,59 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/sskill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Setting Up A Lambda Function Using Amazon Web Services + +In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. + +1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). + + + +2. **Click "Services" at the top of the screen, and type "Lambda" in the search box.** You can also find Lambda in the list of services. It is in the "Compute" section. + + + +3. **Check your AWS region.** AWS Lambda only works with the Alexa Skills Kit in two regions: US East (N. Virginia) and EU (Ireland). Make sure you choose the region closest to your customers. + + + +4. **Click the "Create a Lambda function" button.** It should be near the top of your screen. (If you don't see this button, it is because you haven't created a Lambda function before. Click the blue "Get Started" button near the center of your screen.) + + + +5. **Choose the blueprint named "alexa-skill-kit-sdk-factskill".** We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself. + + + +6. **Configure your trigger.** Click in the dashed box, and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. + + + + Once you have selected Alexa Skills Kit, click the **Next** button. + +7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "MinecraftHelper" is sufficient if you don't have another idea for a name. + + + +8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. + +9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." + + + +10. **For this guide, you can skip all of the Advanced settings.** Click the **Next** button to move to the Review screen. + + + +11. **The Review screen is a summary of your choices. Click Create Function in the bottom left corner.** You will need to scroll down to find **Create Function.** + + + +12. **After you create the function, the ARN value appears in the top right corner. Copy this value for use in the next section of the guide.** + + + +

+ + + diff --git a/single-stream/instructions/3-connect-vui-to-code.md b/single-stream/instructions/3-connect-vui-to-code.md new file mode 100644 index 0000000..6161dc2 --- /dev/null +++ b/single-stream/instructions/3-connect-vui-to-code.md @@ -0,0 +1,33 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Connecting Your Voice User Interface To Your Lambda Function + +On [page #1](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together. + +1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. + +2. **Open the "Configuration" tab on the left side.** + + + +3. **Select the "AWS Lambda ARN" option for your endpoint.** You have the ability to host your code anywhere that you would like, but for the purposes of simplicity and frugality, we are using AWS Lambda. ([Read more about Hosting Your Own Custom Skill Web Service](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service).) With the AWS Free Tier, you get 1,000,000 free requests per month, up to 3.2 million seconds of compute time per month. Learn more at https://aws.amazon.com/free/. In addition, Amazon now offers [AWS Promotional Credits for developers who have live Alexa skills that incur costs on AWS related to those skills](https://developer.amazon.com/alexa-skills-kit/alexa-aws-credits). + + + +4. **Select "North America" or "Europe" as your geographical region.** IMPORTANT: Make sure you select the same region that you created your Lambda in. Remember, Alexa skills using AWS Lambda can only run in N. Virginia (North America) and Ireland (Europe). + + + +5. **Paste your Lambda's ARN (Amazon Resource Name) into the textbox provided.** It should look similar to the screenshot above. + +6. **Leave "Account Linking" set to "No."** For this skill, we won't be using Account Linking, but you can learn more about [Linking an Alexa User with a User in Your System.](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/linking-an-alexa-user-with-a-user-in-your-system) + +7. **Click the "Next" button to continue to page #4 of this guide.** + + [![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/3-7-next-button._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md) + +

+ + + diff --git a/single-stream/instructions/4-testing.md b/single-stream/instructions/4-testing.md new file mode 100644 index 0000000..f478663 --- /dev/null +++ b/single-stream/instructions/4-testing.md @@ -0,0 +1,88 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Testing Your Alexa Skill + +So far, we have [created a Voice User Interface](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) and [a Lambda function](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), and [connected the two together](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-lambda.md). Your skill is now ready to test. + +1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. + +2. **Open the "Test" tab on the left side.** + + + +3. **Understand the voice simulator.** While it's not specific to your skill, the Voice Simulator is a valuable testing tool for every skill. Type a word into the box, and click the "Listen" button to hear how Alexa will +pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Language [(SSML)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference) to modify how Alexa will interpret text to speech. Try these examples: + + ```html + 12345 + ``` + + ```html + 12345 + ``` + + ```html + 12345 + ``` + + + + Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect. + +4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "how can i build a map" + + + + ### Service Simulator Tips + * After you click the "Ask [Your Skill Name]" button, you should see the **Lambda Request** and **Lambda Response** boxes get populated with JSON data like in the screenshot above. + * Click the **Listen** button in the bottom right corner to hear Alexa read the response. + + * If you receive a response that reads: *"The remote endpoint could not be called, or the response it returned was invalid,"* this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill. + +5. **Configure a test event in AWS Lambda.** Now that you are familiar with the **request** and **response** boxes in the Service Simulator, it's important for you to know that you can use your **requests** to directly test your Lambda function every time you update it. To do this: + 1. Create & copy a new response with the Service Simulator. + + 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test event."** + + + + 3. **Choose "Alexa Start Session" from the Sample Event Template dropdown list.** You can choose any item in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. This will also be the sample request that fires every time you update and "Save and Test" your Lambda code. + + + + 4. **Delete the contents of the box, and paste your request into the box.** + + + + 5. **Click the "Save and test" button.** This will save your test event, and run it against your Lambda function. + + + + This gives you visibility into four things: + + * **Your response, listed in the "Execution Result."** + + + + * **A Summary of the statistics for your request.** This includes things like duration, resources, and memory used. + + + + * **Log output.** By effectively using console.log() statements in your Lambda code, you can track what is happening inside your function, and help to figure out what is happening when something goes wrong. You will find the log to be incredibly valuable as you move into more advanced skills. + + + + * **A link to your [CloudWatch](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:) logs for this function.** This will show you **all** of the responses and log statements from every user interaction. This is very useful, especially when you are testing your skill from a device with your voice. (It is the "[Click here](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:)" link in the Log Output description.) + +6. **Other testing methods to consider:** + + * [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go. + * [Unit Testing with Alexa](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/unit-testing.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). + +7. **If your sample skill is working properly, you can now customize your skill.** + +

+ + + diff --git a/single-stream/instructions/5-customization.md b/single-stream/instructions/5-customization.md new file mode 100644 index 0000000..d1e2840 --- /dev/null +++ b/single-stream/instructions/5-customization.md @@ -0,0 +1,27 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Customize the Skill to be Yours + +At this point, you should have a working copy of our Helper skill. In order to make it your own, you will need to customize it with data and responses that you create. Here are the things you will need to change: + +1. **New sentences to respond to your users.** There are several sentences and responses that you will want to customize for your skill. + + 1. **Go back to your copy of [index.js]((https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/src/index.js)).** + + 2. **Look for the comment "TODO: Update these messages to customize."** This is the beginning of the section where you need to customize several text strings for your skill. + + 3. **Continue through index.js until you reach the bottom of the file.** This will ensure that you cover each of the values that you need to update. + +2. **New language.** If you are creating this skill for another language other than English, you will need to make sure Alexa's responses are also in that language. + + * For example, if you are creating your skill in German, every single response that Alexa makes has to be in German. You can't use English responses or your skill will fail certification. + +3. **Once you have made the updates listed on this page, you can click "Next" to move on to Publishing and Certification of your skill.** + + + +

+ + + diff --git a/single-stream/instructions/6-publication.md b/single-stream/instructions/6-publication.md new file mode 100644 index 0000000..4010635 --- /dev/null +++ b/single-stream/instructions/6-publication.md @@ -0,0 +1,128 @@ +# Build An Alexa Minecraft Helper Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) + +## Get Your Skill Certified and Published + +We are almost done! The last step is to add the metadata that your skill will use in the [Alexa app](http://amazon.com/skills). This page will walk you through the remaining steps, and give you some tips on how to avoid the common mistakes developers make that result in a failed certification. + +1. **Go to your skill's Publishing Information tab on the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list).** + + + +2. **Complete the Global Fields data.** These fields apply across all of the languages that your skill supports. + + + + * **For Category, we are building a how-to skill, so select "Games, Trivia, and Accessories."** You will also be presented with a **Sub-Category** option. For this skill, choose "Knowledge and Trivia." + + * **Provide testing instructions.** Testing instructions give you an opportunity to explain your skill, and any special or possibly confusing features, to the certification team. A value is required in this box. + + * Since you are using our Howto Sample, make sure to add this sentence to your Testing Instructions: + + ``` + This was built using the Howto Sample. + ``` + + This will let the testing team understand what you're providing them, and should decrease the testing time required. + + * **Countries and Region can be for "all countries", unless you have a specific reason to exclude a specific location.** This gives Amazon the ability to distribute your skill globally. Remember that you will need to create additional versions of your skill in the other available languages before they will be available in those countries. + +3. **Write your skill descriptions.** + + + + * **Spend some time coming up with an enticing, succinct description.** This is one of the few places you have an opportunity to attract new users, so make the most of it! These descriptions show up in the list of skills available in the [Alexa app](http://alexa.amazon.com/spa/index.html#skills). + +4. **For your example phrases, come up with the three most exciting ways a user can talk to your skill.** + + + + * **Make sure that each of your example phrases are a perfect match with one of your Sample Utterances.** Incorrect example phrases are one of the most common reasons that skills fail certification, so we have provided a short list of things to consider as you write your example phrases: + + | Common Failure Points for Example Phrases | + | ----------------------------------------- | + | Example phrases **must** adhere to the [supported phrases](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/supported-phrases-to-begin-a-conversation). | + | Example phrases **must** be based on sample utterances specified in your Intent Schema. | + | Your first example phrase **must** include a wake word and your invocation name. | + | Example phrases **must** provide a contextual response. | + + * **Choose three example phrases that are likely to be the most common ways that users will attempt to interact with your skill.** Make sure that each of them works well, and provides an excellent user experience. + +5. **Provide a comprehensive list of keywords for users that are searching for new skills.** This is an optional field, and searching the [Alexa app](http://alexa.amazon.com) will also find the words in your Skill Name and descriptions, so you don't need to overdo it. That being said, if there are words that you want users to find your skill with, you should include them here. Separate the keywords with commas. + + + +6. **Create your skill's icons.** You need two sizes of your icon: 108x108px and 512x512px. + + + + * **Make sure you have the rights to the icons you create.** Please don't violate any trademarks or copyrights. + * **If you don't have software to make icons, try one of these free options:** + + * [GIMP](https://www.gimp.org/) (Windows/Mac/Linux) + * [Paint.NET](http://www.getpaint.net/index.html) (Windows) + * [Inkscape](http://inkscape.org) (Windows/Mac/Linux) + * [Iconion](http://iconion.com/) (Windows/Mac) + + * To make it easier to get started, we've created blank versions of these icons in both sizes for many formats: + + * [PSD](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/psd._TTH_.zip) + * [PNG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/png._TTH_.zip) + * [GIF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/gif._TTH_.zip) + * [PDF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdf._TTH_.zip) + * [JPG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/jpg._TTH_.zip) + * [SVG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/svg._TTH_.zip) + * [PDN](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdn._TTH_.zip) - for [Paint.NET](http://www.getpaint.net/index.html) + * [XCF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/xcf._TTH_.zip) - for [GIMP](https://www.gimp.org/) + +7. **Open the Privacy & Compliance tab on the left side of your skill in the [Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list).** + + + +8. **Answer each of the Global Fields questions using the guidance below.** These fields also apply across all of the languages that your skill supports. + + + + * **Does this skill allow users to make purchases or spend real money?** For this how-to skill, the answer is no. For future skills, make sure you answer this appropriately. + + * **Does this Alexa skill collect users' personal information?** Again, for this how-to skill, the answer is no. If you do collect information about a user, such as names, email addresses, phone numbers, and so forth, ensure that you answer Yes to this question. + * Answering "yes" to this question will also require you to provide a link to your Privacy Policy at the bottom of the page. + + * **Is your skill directed to children under the age of 13?** Because you customized this skill with data you provided, it is possible that you created a skill that targets children under the age of 13. For this how-to skill, the answer is **no** because it doesn't target a specific age group. + * Factors to consider in determining if this skill is directed to children under 13 include: + * Subject matter of the skill + * Presence of child-oriented activities and incentives + * Type of language used in the skill + * Music and other audio content in the skill + * How the skill is described and marketed + * Intended audience for the skill + + If you're not sure, please see the [FTC's COPPA Guidance and FAQ](https://www.ftc.gov/tips-advice/business-center/guidance/complying-coppa-frequently-asked-questions) for more information. + +9. **Export Compliance.** Be certain that you agree with all of the conditions. If you do, make sure to check this box, as Amazon requires this permission to distribute your skill around the globe. + +10. **Privacy Policy URL.** This is an optional field, and should not be required for this howto skill sample. You can leave it blank. + +11. **Terms of Use URL.** This is also optional, and you can leave it blank. + +12. **Click the Save button at the bottom of the page.** + + + +13. **Each checkmark should be green, as shown.** + + + +14. **If you feel that your skill is ready for certification, click the "Submit for Certification" button at the bottom of the page.** + + + +15. **You're done with your submission!** Here are a few things you might need to know: + + * **Certification can take several days to complete.** Please be patient. It takes time because we want to get it right. + + * **Did something go wrong?** Our team of evangelists run [online office hours every Tuesday from 1-2pm Pacific Time](https://attendee.gotowebinar.com/rt/8389200425172113931). They can help answer any questions you might have. + + * **Want the coolest t-shirt you've ever seen?** Every month, we create a brand-new Alexa Developer t-shirt or hoodie, and send them out to developers that published a skill that month. [You can get yours here if you live in the US](https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion), [here for the UK](https://developer.amazon.com/en-gb/alexa-skills-kit/alexa-developer-skill-promotion), and [here for Germany](https://developer.amazon.com/de-de/alexa-skills-kit/alexa-developer-skill-promotion). + + diff --git a/single-stream/interaction-model.json b/single-stream/interaction-model.json new file mode 100644 index 0000000..e69de29 diff --git a/single-stream/lambda/src/audioAssets.js b/single-stream/lambda/custom/audioAssets.js similarity index 95% rename from single-stream/lambda/src/audioAssets.js rename to single-stream/lambda/custom/audioAssets.js index 5896f3d..9c144ba 100644 --- a/single-stream/lambda/src/audioAssets.js +++ b/single-stream/lambda/custom/audioAssets.js @@ -1,6 +1,6 @@ 'use strict'; -var audioData = { +const audioData = { title: 'My Radio', subtitle: 'Less bla bla, more la la', cardContent: "Visit our web site https://www.myradio.com", diff --git a/single-stream/lambda/src/audioEventHandlers.js b/single-stream/lambda/custom/audioEventHandlers.js similarity index 95% rename from single-stream/lambda/src/audioEventHandlers.js rename to single-stream/lambda/custom/audioEventHandlers.js index 6655e5f..cb5264c 100644 --- a/single-stream/lambda/src/audioEventHandlers.js +++ b/single-stream/lambda/custom/audioEventHandlers.js @@ -1,13 +1,13 @@ 'use strict'; -var audioEventHandlers = { +const audioEventHandlers = { 'PlaybackStarted' : function () { /* * AudioPlayer.PlaybackStarted Directive received. * Confirming that requested audio file began playing. * Do not send any specific response. */ - console.log("Playback started"); + console.log("Playback started"); this.emit(':responseReady'); }, 'PlaybackFinished' : function () { diff --git a/single-stream/lambda/src/constants.js b/single-stream/lambda/custom/constants.js similarity index 100% rename from single-stream/lambda/src/constants.js rename to single-stream/lambda/custom/constants.js diff --git a/single-stream/lambda/src/index.js b/single-stream/lambda/custom/index.js similarity index 58% rename from single-stream/lambda/src/index.js rename to single-stream/lambda/custom/index.js index 03735e8..fc21d6a 100644 --- a/single-stream/lambda/src/index.js +++ b/single-stream/lambda/custom/index.js @@ -1,16 +1,16 @@ 'use strict'; -var alexa = require('alexa-sdk'); -var constants = require('./constants'); -var stateHandlers = require('./stateHandlers'); -var audioEventHandlers = require('./audioEventHandlers'); -var languageStrings = require('./strings'); +const alexa = require('alexa-sdk'); +const constants = require('./constants'); +const stateHandlers = require('./stateHandlers'); +const audioEventHandlers = require('./audioEventHandlers'); +const languageStrings = require('./strings'); exports.handler = (event, context, callback) => { - - var skill = alexa.handler(event, context, callback); - + + const skill = alexa.handler(event, context, callback); + skill.appId = constants.appId; skill.resources = languageStrings; skill.debug = constants.debug; @@ -18,7 +18,7 @@ exports.handler = (event, context, callback) => { stateHandlers, audioEventHandlers ); - + if (skill.debug) { console.log("\n" + "******************* REQUEST **********************"); console.log("\n" + JSON.stringify(event, null, 2)); diff --git a/single-stream/lambda/src/package-lock.json b/single-stream/lambda/custom/package-lock.json similarity index 100% rename from single-stream/lambda/src/package-lock.json rename to single-stream/lambda/custom/package-lock.json diff --git a/single-stream/lambda/src/package.json b/single-stream/lambda/custom/package.json similarity index 100% rename from single-stream/lambda/src/package.json rename to single-stream/lambda/custom/package.json diff --git a/single-stream/lambda/src/stateHandlers.js b/single-stream/lambda/custom/stateHandlers.js similarity index 89% rename from single-stream/lambda/src/stateHandlers.js rename to single-stream/lambda/custom/stateHandlers.js index 9b92054..094ddc0 100644 --- a/single-stream/lambda/src/stateHandlers.js +++ b/single-stream/lambda/custom/stateHandlers.js @@ -1,10 +1,10 @@ 'use strict'; -var Alexa = require('alexa-sdk'); -var audioData = require('./audioAssets'); -var constants = require('./constants'); +const Alexa = require('alexa-sdk'); +const audioData = require('./audioAssets'); +const constants = require('./constants'); -var stateHandlers = { +const stateHandlers = { 'LaunchRequest': function () { this.emit('PlayAudio'); }, @@ -32,7 +32,7 @@ var stateHandlers = { this.response.speak(this.t('CAN_NOT_SKIP_MSG')); this.emit(':responseReady'); }, - 'AMAZON.PreviousIntent': function () { + 'AMAZON.PreviousIntent': function () { this.response.speak(this.t('CAN_NOT_SKIP_MSG')); this.emit(':responseReady'); }, @@ -47,7 +47,7 @@ var stateHandlers = { 'AMAZON.LoopOffIntent': function () { this.emit('AMAZON.StartOverIntent');}, 'AMAZON.ShuffleOnIntent': function () { this.emit('AMAZON.StartOverIntent');}, 'AMAZON.ShuffleOffIntent': function () { this.emit('AMAZON.StartOverIntent');}, - 'AMAZON.StartOverIntent': function () { + 'AMAZON.StartOverIntent': function () { this.response.speak(this.t('NOT_POSSIBLE_MSG')); this.emit(':responseReady'); }, @@ -61,7 +61,7 @@ var stateHandlers = { module.exports = stateHandlers; -var controller = function () { +const controller = function () { return { play: function (text) { /* @@ -72,9 +72,9 @@ var controller = function () { */ if (canThrowCard.call(this)) { - var cardTitle = audioData.subtitle; - var cardContent = audioData.cardContent; - var cardImage = audioData.image; + let cardTitle = audioData.subtitle; + let cardContent = audioData.cardContent; + let cardImage = audioData.image; this.response.cardRenderer(cardTitle, cardContent, cardImage); } @@ -104,4 +104,3 @@ function canThrowCard() { return false; } } - diff --git a/single-stream/lambda/custom/strings.js b/single-stream/lambda/custom/strings.js new file mode 100644 index 0000000..0e642c1 --- /dev/null +++ b/single-stream/lambda/custom/strings.js @@ -0,0 +1,19 @@ +'use strict'; + +let EnglishStrings = { + "WELCOME_MSG": "Welcome to {{ skillName }}", + "HELP_MSG": "Welcome to {{ skillName }}. You can play, stop, resume listening. How can I help you ?", + "UNHANDLED_MSG" : "Sorry, I could not understand what you've just said.", + "CAN_NOT_SKIP_MSG" : "This is radio, you have to wait for next track to play.", + "RESUME_MSG" : "Resuming {{ skillName }}", + "NOT_POSSIBLE_MSG" : "This is radio, you can not do that. You can ask me to stop or pause to stop listening.", + "STOP_MSG" : "Goodbye." +}; +module.exports = { + "en-GB": { + "translation": EnglishStrings + }, + "en-US": { + "translation": EnglishStrings + } +}; diff --git a/single-stream/lambda/test/test_exception.js b/single-stream/lambda/test/test_exception.js index 613f2a9..22efa8a 100644 --- a/single-stream/lambda/test/test_exception.js +++ b/single-stream/lambda/test/test_exception.js @@ -1,16 +1,16 @@ 'use strict'; -let lambda = require('./lambda.js'); -let skill = require('../src/index.js'); -let constant = require('../src/constants.js'); +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); -let chai = require('chai'); +const chai = require('chai'); chai.use(require('chai-string')); -let should = chai.should(); -let assert = chai.assert; +const should = chai.should(); +const assert = chai.assert; -var event = undefined; +let event = undefined; describe('Audio Player Test : Exception', function () { @@ -62,4 +62,4 @@ describe('Audio Player Test : Exception', function () { done(); }); -}); \ No newline at end of file +}); diff --git a/single-stream/lambda/test/test_launch_request.js b/single-stream/lambda/test/test_launch_request.js index 6770052..d480356 100644 --- a/single-stream/lambda/test/test_launch_request.js +++ b/single-stream/lambda/test/test_launch_request.js @@ -1,16 +1,16 @@ 'use strict'; -let lambda = require('./lambda.js'); -let skill = require('../src/index.js'); -let constant = require('../src/constants.js'); +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); -let chai = require('chai'); +const chai = require('chai'); chai.use(require('chai-string')); -let should = chai.should(); -let assert = chai.assert; +const should = chai.should(); +const assert = chai.assert; -var event = undefined; +let event = undefined; describe('Audio Player Test : LaunchRequest', function () { @@ -76,4 +76,4 @@ describe('Audio Player Test : LaunchRequest', function () { done(); }); -}); \ No newline at end of file +}); diff --git a/single-stream/lambda/test/test_next_intent.js b/single-stream/lambda/test/test_next_intent.js index f246ecf..da34b1f 100644 --- a/single-stream/lambda/test/test_next_intent.js +++ b/single-stream/lambda/test/test_next_intent.js @@ -1,16 +1,16 @@ 'use strict'; -let lambda = require('./lambda.js'); -let skill = require('../src/index.js'); -let constant = require('../src/constants.js'); +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); -let chai = require('chai'); +const chai = require('chai'); chai.use(require('chai-string')); -let should = chai.should(); -let assert = chai.assert; +const should = chai.should(); +const assert = chai.assert; -var event = undefined; +let event = undefined; describe('Audio Player Test : NextIntent', function () { @@ -62,4 +62,4 @@ describe('Audio Player Test : NextIntent', function () { done(); }); -}); \ No newline at end of file +}); diff --git a/single-stream/lambda/test/test_play_intent.js b/single-stream/lambda/test/test_play_intent.js index d337dd6..95ebd84 100644 --- a/single-stream/lambda/test/test_play_intent.js +++ b/single-stream/lambda/test/test_play_intent.js @@ -1,16 +1,16 @@ 'use strict'; -let lambda = require('./lambda.js'); -let skill = require('../src/index.js'); -let constant = require('../src/constants.js'); +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); -let chai = require('chai'); +const chai = require('chai'); chai.use(require('chai-string')); -let should = chai.should(); -let assert = chai.assert; +const should = chai.should(); +const assert = chai.assert; -var event = undefined; +let event = undefined; describe('Audio Player Test : PlayIntent', function () { @@ -76,4 +76,4 @@ describe('Audio Player Test : PlayIntent', function () { done(); }); -}); \ No newline at end of file +}); diff --git a/single-stream/lambda/test/test_playback_stopped.js b/single-stream/lambda/test/test_playback_stopped.js index b734c3a..47174b6 100644 --- a/single-stream/lambda/test/test_playback_stopped.js +++ b/single-stream/lambda/test/test_playback_stopped.js @@ -1,16 +1,16 @@ 'use strict'; -let lambda = require('./lambda.js'); -let skill = require('../src/index.js'); -let constant = require('../src/constants.js'); +const lambda = require('./lambda.js'); +const skill = require('../src/index.js'); +const constant = require('../src/constants.js'); -let chai = require('chai'); +const chai = require('chai'); chai.use(require('chai-string')); -let should = chai.should(); -let assert = chai.assert; +const should = chai.should(); +const assert = chai.assert; -var event = undefined; +let event = undefined; describe('Audio Player Test : Playback Stopped', function () { @@ -57,4 +57,4 @@ describe('Audio Player Test : Playback Stopped', function () { done(); }); -}); \ No newline at end of file +}); From 9a763bd2c3663817ce98dd44b9c2e4e6a408e1aa Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Thu, 26 Oct 2017 11:31:00 -0700 Subject: [PATCH 02/10] Update links --- README.md | 6 +- .../instructions/1-voice-user-interface.md | 16 ++-- .../instructions/2-lambda-function.md | 10 +-- .../instructions/3-connect-vui-to-code.md | 10 +-- multiple-streams/instructions/4-testing.md | 8 +- .../instructions/5-customization.md | 10 +-- .../instructions/6-publication.md | 4 +- multiple-streams/interaction-model.json | 65 ++++++++++++++++ multiple-streams/lambda-role.md | 19 +++++ multiple-streams/set-up-aws.md | 15 ++++ multiple-streams/unit-testing.md | 76 +++++++++++++++++++ single-stream/README.md | 33 ++++++-- .../instructions/1-voice-user-interface.md | 16 ++-- .../instructions/2-lambda-function.md | 12 +-- .../instructions/3-connect-vui-to-code.md | 10 +-- single-stream/instructions/4-testing.md | 10 +-- single-stream/instructions/5-customization.md | 10 +-- single-stream/instructions/6-publication.md | 10 +-- single-stream/interaction-model.json | 62 +++++++++++++++ single-stream/lambda-role.md | 19 +++++ single-stream/set-up-aws.md | 15 ++++ single-stream/unit-testing.md | 76 +++++++++++++++++++ 22 files changed, 439 insertions(+), 73 deletions(-) create mode 100644 multiple-streams/lambda-role.md create mode 100644 multiple-streams/set-up-aws.md create mode 100644 multiple-streams/unit-testing.md create mode 100644 single-stream/lambda-role.md create mode 100644 single-stream/set-up-aws.md create mode 100644 single-stream/unit-testing.md diff --git a/README.md b/README.md index da94138..3d60edc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Skill Sample NodeJS Audio Player -This project demonstartes the use of Alexa Audio Player for skills. +This project demonstrates the use of Alexa Audio Player for skills. -- Multiple-streams folder contains an example skill to play multiple, re-recorded audio streams, such as a basic podcast skill. +- [Multiple-streams](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/README.md) folder contains an example skill to play multiple, re-recorded audio streams, such as a basic podcast skill. -- Single-stream folder contains an example skill to play a single stream, such as a live radio skill. +- [Single-stream](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/README.md) folder contains an example skill to play a single stream, such as a live radio skill. diff --git a/multiple-streams/instructions/1-voice-user-interface.md b/multiple-streams/instructions/1-voice-user-interface.md index 764bf25..443888d 100644 --- a/multiple-streams/instructions/1-voice-user-interface.md +++ b/multiple-streams/instructions/1-voice-user-interface.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Podcast Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) ## Setting up Your Voice User Interface -There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/alexa-skills-kit/vui). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that in [the next step](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) of this instructions guide. +There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/alexa-skills-kit/vui). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that in [the next step](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md) of this instructions guide. 1. **Go to the [Amazon Developer Portal](http://developer.amazon.com). In the top right corner of the screen, click the Sign In button.**
(If you don't already have an account, you will be able to create a new one for free.) @@ -32,7 +32,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf * **Name** This is the name of the skill as it will be displayed in the [Alexa app](http://alexa.amazon.com). - * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Minecraft Helper" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. + * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Podcast Player" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. | Invocation Name Requirements | Examples of incorrect invocation names | | ---------------------------- | -------------------------------------- | @@ -43,7 +43,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf | The invocation name must not contain the wake words "Alexa," "Amazon," "Echo," "Computer," or the words "skill" or "app." | hackster initial skill; word skills | | The invocation name must be written in each language you choose to support. For example, the German version of your skill must have an invocation name written in German, while the English (US) version must have an invocation name written in English. | kitchen stories (German skill) | - * **Audio Player** For this minecraft helper skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player). + * **Audio Player** For this Podcast Player skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player). 6. **Click the Next button to move to the Interaction Model.** @@ -55,7 +55,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf 8. Click on the "Code Editor" item under **Dashboard** on the top left side of the skill builder. -9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/interaction-model.json), then click "Apply Changes" or "Save Model". +9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/interaction-model.json), then click "Apply Changes" or "Save Model". 10. Click on the "Dashboard" button. @@ -74,7 +74,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-12-skill-builder-build-save-model._TTH_.png) -13. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md). +13. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md). If you get an error from your interaction model, check through this list: @@ -82,6 +82,6 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf * **Did you accidentally add any unwanted characters to the Interaction Model or Sample Utterances?**

-[![Next: Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_lambda_function._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) +[![Next: Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_lambda_function._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md) diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md index b68a45d..8c5f82d 100644 --- a/multiple-streams/instructions/2-lambda-function.md +++ b/multiple-streams/instructions/2-lambda-function.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/sskill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Podcast Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) ## Setting Up A Lambda Function Using Amazon Web Services -In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. +In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. 1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). @@ -31,7 +31,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-h Once you have selected Alexa Skills Kit, click the **Next** button. -7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "MinecraftHelper" is sufficient if you don't have another idea for a name. +7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "PodcastPlayer" is sufficient if you don't have another idea for a name. @@ -54,6 +54,6 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-h

- + diff --git a/multiple-streams/instructions/3-connect-vui-to-code.md b/multiple-streams/instructions/3-connect-vui-to-code.md index 6161dc2..8680ed5 100644 --- a/multiple-streams/instructions/3-connect-vui-to-code.md +++ b/multiple-streams/instructions/3-connect-vui-to-code.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Podcast Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) ## Connecting Your Voice User Interface To Your Lambda Function -On [page #1](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together. +On [page #1](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together. 1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. @@ -25,9 +25,9 @@ On [page #1](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/inst 7. **Click the "Next" button to continue to page #4 of this guide.** - [![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/3-7-next-button._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md) + [![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/3-7-next-button._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)

- + diff --git a/multiple-streams/instructions/4-testing.md b/multiple-streams/instructions/4-testing.md index f478663..25b1fb1 100644 --- a/multiple-streams/instructions/4-testing.md +++ b/multiple-streams/instructions/4-testing.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Podcast Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) ## Testing Your Alexa Skill -So far, we have [created a Voice User Interface](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) and [a Lambda function](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), and [connected the two together](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-lambda.md). Your skill is now ready to test. +So far, we have [created a Voice User Interface](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md) and [a Lambda function](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md), and [connected the two together](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-lambda.md). Your skill is now ready to test. 1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. @@ -83,6 +83,6 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup 7. **If your sample skill is working properly, you can now customize your skill.**

- + diff --git a/multiple-streams/instructions/5-customization.md b/multiple-streams/instructions/5-customization.md index d1e2840..e52774b 100644 --- a/multiple-streams/instructions/5-customization.md +++ b/multiple-streams/instructions/5-customization.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Podcast Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) ## Customize the Skill to be Yours -At this point, you should have a working copy of our Helper skill. In order to make it your own, you will need to customize it with data and responses that you create. Here are the things you will need to change: +At this point, you should have a working copy of our Podcast Player skill. In order to make it your own, you will need to customize it with data and responses that you create. Here are the things you will need to change: 1. **New sentences to respond to your users.** There are several sentences and responses that you will want to customize for your skill. @@ -19,9 +19,9 @@ At this point, you should have a working copy of our Helper skill. In order to 3. **Once you have made the updates listed on this page, you can click "Next" to move on to Publishing and Certification of your skill.** - +

- + diff --git a/multiple-streams/instructions/6-publication.md b/multiple-streams/instructions/6-publication.md index 4010635..5c7a05c 100644 --- a/multiple-streams/instructions/6-publication.md +++ b/multiple-streams/instructions/6-publication.md @@ -1,5 +1,5 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Podcast Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) ## Get Your Skill Certified and Published diff --git a/multiple-streams/interaction-model.json b/multiple-streams/interaction-model.json index e69de29..c29ded4 100644 --- a/multiple-streams/interaction-model.json +++ b/multiple-streams/interaction-model.json @@ -0,0 +1,65 @@ +{ + "intents": [ + { + "name": "AMAZON.CancelIntent", + "samples": [] + }, + { + "name": "AMAZON.HelpIntent", + "samples": [] + }, + { + "name": "AMAZON.NextIntent", + "samples": [] + }, + { + "name": "AMAZON.NoIntent", + "samples": [] + }, + { + "name": "AMAZON.PauseIntent", + "samples": [] + }, + { + "name": "AMAZON.PreviousIntent", + "samples": [] + }, + { + "name": "AMAZON.ResumeIntent", + "samples": [] + }, + { + "name": "AMAZON.StartOverIntent", + "samples": [] + }, + { + "name": "AMAZON.StopIntent", + "samples": [] + }, + { + "name": "AMAZON.YesIntent", + "samples": [] + }, + { + "name": "PlayAudio", + "samples": [ + "begin podcast", + "begin the podcast", + "begin playing the podcast", + "start podcast", + "start the podcast", + "start playing the podcast", + "play the podcast", + "to play", + "to begin podcast", + "to begin the podcast", + "to begin playing the podcast", + "to start podcast", + "to start the podcast", + "to start playing the podcast", + "to play the podcast" + ], + "slots": [] + } + ] +} diff --git a/multiple-streams/lambda-role.md b/multiple-streams/lambda-role.md new file mode 100644 index 0000000..ae98bfa --- /dev/null +++ b/multiple-streams/lambda-role.md @@ -0,0 +1,19 @@ +# Setting Up Your First Lambda Role + +If you're reading this page, you're probably setting up your first role for a Lambda function. While it's an easy process, we want to make sure you understand all of the "whys" that go into this process. + +1. **Choose "Create a custom role" from the Role dropdown.** This will launch a new tab in your browser, so make sure that popups are enabled when you attempt this. + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/1-choose-custom-role._TTH_.png) + +2. **You are now creating a new IAM role.** IAM stands for Identity and Access Management. ([You can read more about IAM here.](http://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)) By creating this role, you are enabling your Lambda function to be able to create Amazon CloudWatch logs for your function. ([You can read more about managing permissions with IAM roles here.](https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role)) + +3. **You don't need to make any changes. Click the Allow button in the bottom right corner.** + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/3-allow-button._TTH_.png) + +4. **This should close the new tab, and populate your Lambda function appropriately.** If your "Lambda function handler and role" section doesn't look like the screenshot below, try refreshing your page and selecting your new role from the "existing role" dropdown. + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/4-lambda-function-role._TTH_.png) + +5. **You can now return to what you were doing.** diff --git a/multiple-streams/set-up-aws.md b/multiple-streams/set-up-aws.md new file mode 100644 index 0000000..f8045c0 --- /dev/null +++ b/multiple-streams/set-up-aws.md @@ -0,0 +1,15 @@ +# Create an AWS Account + + **Note: If you already have an AWS account, you can skip this section. Just sign in to your [console](http://aws.amazon.com).** + +1. Open [aws.amazon.com](aws.amazon.com) and then choose **‘Create an AWS Account’** + + + + 1. Follow the online instructions. Do not worry about the IAM role, we will do that later. + 2. You will need a Valid Credit Card to set up your account (note the AWS Free Tier will suffice however. [You can find out more about the free tier here](https://aws.amazon.com/free/?sc_ichannel=ha&sc_ipage=signin&sc_iplace=body_link_text&sc_icampaigntype=free_tier&sc_icampaign=ha_en_free_tier_signin_2014_03).) + 3. Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad. + +2. Sign in to the AWS Console + +3. It can sometimes take a couple minutes for your new AWS account to go live. You will receive an e-mail when your account is active. \ No newline at end of file diff --git a/multiple-streams/unit-testing.md b/multiple-streams/unit-testing.md new file mode 100644 index 0000000..d26be4a --- /dev/null +++ b/multiple-streams/unit-testing.md @@ -0,0 +1,76 @@ +#Unit Testing Your Alexa Skills + +There are many ways to test your Alexa skill code, and I'm sure others will have similar or superior solutions, but this just works. And it works well! + +To start, we are going to use three things to make all of this work. The first is AWS Lambda, of course. If you haven't built a skill for Alexa before, you're going to want to learn that first before you dive into unit testing those skills. Once you've gotten your Lambda function set up, however, you're most of the way there. + +The second step involves another AWS product, API Gateway. It will become the HTTP front end to your Lambda function. It will catch the POST messages that we want to pass to our function, and funnels the JSON response back, so that we can validate our request against our specific testing criteria. Let's look at setting this up. + +##Configuring API Gateway +1. To start, go to [AWS API Gateway](https://aws.amazon.com/api-gateway/) and sign in to the console. + +2. From there, you are going to click on the "Create API" button near the top of the page. + +3. First, make sure that you have chosen "New API" from the radio buttons at the top of the page. + +4. Next, you need to give your API a name and description. For this example, name your API "Alexa Skill API." The description can be anything you want. Click the "Create API" button in the bottom right of the screen. + +5. Our next step is to create a resource inside our API. Click the "Actions" button at the top of the page, and choose "Create Resource." + +6. Give your New Child Resource the name "Alexa Resource." It should populate the Resource Path automatically for you with "alexa-resource." After this, you can click the "Create Resource button in the bottom right corner of the screen. + +7. You should see your new resource in the Resources pane. Click the Actions button again, and choose "Create Method." + +8. We need to make our resource able to catch POST requests, so in the new dropdown box that was created, choose POST from the options, and click the round checkbox button. + +9. For the setup of your POST function, you can leave the Integration Type at "Lambda Function." For the Lambda Region, choose the region where your Lambda function lives. (Most commonly, this is "us-east-1."). + +10. In the Lambda Function box, start typing the name of your Lambda function. It should autocomplete for you. Click the "Save" button at the bottom right corner of the screen. + +11. One last time, we need to open the Actions button, and this time choose "Deploy API." In the Deploy API box that appears, choose "[New Stage]" for Deployment stage. For the other three values (Stage Name, Stage description, and Deployment description), you can just use the word "Test" for all of them. The values don't matter, it's just so that you know what the purpose of this new API is for. + +12. Click the Deploy Button. + +13. Copy the Invoke URL from the blue box at the top of the screen, remembering that the Resource name you used was "alexa-resource." Your API is set up and ready to roll. + +##Using Postman to Test Your Lambda +1. If you don't already have this tool, make sure to download [Postman](https://www.getpostman.com/). + +2. Create a profile, and log in to the Postman software. + +3. Near the top center of the screen is a box with the words "Enter request URL." Paste the Invoke URL from your API Gateway setup into this box. + +4. Change the GET dropdown to POST. + +5. Below the textbox, click the Headers tab. For the key, use "Content-Type", and for the value, use "application/json." + +6. On the Body tab, choose "raw" from the radio buttons, and paste a Lambda request in the large text box. + +7. You should now be able to click the large blue Send button near the top right corner of the page. In the bottom half of the page, you should see another Body tab for the response. Opening this should show you the actual response recieved from your Lambda function. + +8. Once you've verified that you can successfully communicate with your Lambda, we can start building a suite of tests. + +9. Back up at the top of the screen (but below the request URL textbox), there is another tab called "Tests." In this tab, you can create as many tests as you would like for this request event. For example, you want to verify that when you pass the value "K" to your Lambda function, that it returns the value "Potassium," (assuming you're building a skill related to the Periodic Table of Elements.) To do this, you can use one of the convenient links on the right, or just use this text: + + '''JAVASCRIPT + tests["Submitted 'K' as first name, expect 'Potassium' in response."] = responseBody === "Potassium"; + ''' + +10. Click the Send button again should show the Tests tab in the lower half with results similar to (1/1) or (0/1). Clicking on this Tests tab at the bottom should show a list of all of your tests for this response, as well as their status. (Pass/Fail). + +11. To save this for future use, there is a Save button next to the Send button we have been using in the top right corner of the screen. CLick it to save this request and its tests. + +12. In the box that appears, give your Request name something meaningful to your test, like "Submitted 'K', should receive 'Potassium.'" + +13. The description is optional, but always helpful to remind yourself what the purpose of this test/request is. + +14. Finally, create a new collection name. I recommend naming it after your skill, as this will be where you can keep all of your tests for that skill. + +15. On the left side of Postman, you have probably been operating in the History tab, where it shows you a result of each time you've pressed the Send button. Click on the Collections tab, and you should now see a new collection with the same name as the one you just created. + +16. You can click on an individual test to open/edit/run one of them, and you can can click on the three dots after a test to edit, duplicate, or delete it. + +17. If you click the arrow that is next to your collection, there is a blue Run button that will run all of your requests and their tests at once, giving you instant verification about the status of your skill. + +That is all! + diff --git a/single-stream/README.md b/single-stream/README.md index dfb3c2a..b694d05 100644 --- a/single-stream/README.md +++ b/single-stream/README.md @@ -1,4 +1,23 @@ -# Single Stream Audio Skill (My Radio) +# Build An Alexa Radio Skill + + +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/6-publication.md) + + + + + + + + + + + + + + + + diff --git a/single-stream/instructions/1-voice-user-interface.md b/single-stream/instructions/1-voice-user-interface.md index 764bf25..7c8ce8d 100644 --- a/single-stream/instructions/1-voice-user-interface.md +++ b/single-stream/instructions/1-voice-user-interface.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Radio Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) ## Setting up Your Voice User Interface -There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/alexa-skills-kit/vui). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that in [the next step](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) of this instructions guide. +There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/alexa-skills-kit/vui). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that in [the next step](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md) of this instructions guide. 1. **Go to the [Amazon Developer Portal](http://developer.amazon.com). In the top right corner of the screen, click the Sign In button.**
(If you don't already have an account, you will be able to create a new one for free.) @@ -32,7 +32,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf * **Name** This is the name of the skill as it will be displayed in the [Alexa app](http://alexa.amazon.com). - * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Minecraft Helper" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. + * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Radio Player" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. | Invocation Name Requirements | Examples of incorrect invocation names | | ---------------------------- | -------------------------------------- | @@ -43,7 +43,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf | The invocation name must not contain the wake words "Alexa," "Amazon," "Echo," "Computer," or the words "skill" or "app." | hackster initial skill; word skills | | The invocation name must be written in each language you choose to support. For example, the German version of your skill must have an invocation name written in German, while the English (US) version must have an invocation name written in English. | kitchen stories (German skill) | - * **Audio Player** For this minecraft helper skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player). + * **Audio Player** For this Radio Player skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player). 6. **Click the Next button to move to the Interaction Model.** @@ -55,7 +55,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf 8. Click on the "Code Editor" item under **Dashboard** on the top left side of the skill builder. -9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/interaction-model.json), then click "Apply Changes" or "Save Model". +9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/interaction-model.json), then click "Apply Changes" or "Save Model". 10. Click on the "Dashboard" button. @@ -74,7 +74,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/1-12-skill-builder-build-save-model._TTH_.png) -13. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md). +13. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md). If you get an error from your interaction model, check through this list: @@ -82,6 +82,6 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf * **Did you accidentally add any unwanted characters to the Interaction Model or Sample Utterances?**

-[![Next: Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_lambda_function._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md) +[![Next: Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_lambda_function._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md) diff --git a/single-stream/instructions/2-lambda-function.md b/single-stream/instructions/2-lambda-function.md index b68a45d..8764cc3 100644 --- a/single-stream/instructions/2-lambda-function.md +++ b/single-stream/instructions/2-lambda-function.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/sskill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Radio Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) ## Setting Up A Lambda Function Using Amazon Web Services -In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. +In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. 1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). @@ -35,9 +35,9 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-h -8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. +8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. -9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." +9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." @@ -54,6 +54,6 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-h

- + diff --git a/single-stream/instructions/3-connect-vui-to-code.md b/single-stream/instructions/3-connect-vui-to-code.md index 6161dc2..b1c45ea 100644 --- a/single-stream/instructions/3-connect-vui-to-code.md +++ b/single-stream/instructions/3-connect-vui-to-code.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Radio Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) ## Connecting Your Voice User Interface To Your Lambda Function -On [page #1](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together. +On [page #1](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together. 1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. @@ -25,9 +25,9 @@ On [page #1](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/inst 7. **Click the "Next" button to continue to page #4 of this guide.** - [![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/3-7-next-button._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md) + [![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/3-7-next-button._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)

- + diff --git a/single-stream/instructions/4-testing.md b/single-stream/instructions/4-testing.md index f478663..6a51be4 100644 --- a/single-stream/instructions/4-testing.md +++ b/single-stream/instructions/4-testing.md @@ -1,9 +1,9 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Radio Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) ## Testing Your Alexa Skill -So far, we have [created a Voice User Interface](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md) and [a Lambda function](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md), and [connected the two together](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-lambda.md). Your skill is now ready to test. +So far, we have [created a Voice User Interface](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md) and [a Lambda function](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md), and [connected the two together](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-lambda.md). Your skill is now ready to test. 1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial. @@ -78,11 +78,11 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup 6. **Other testing methods to consider:** * [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go. - * [Unit Testing with Alexa](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/unit-testing.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). + * [Unit Testing with Alexa](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/unit-testing.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). 7. **If your sample skill is working properly, you can now customize your skill.**

- + diff --git a/single-stream/instructions/5-customization.md b/single-stream/instructions/5-customization.md index d1e2840..67a8063 100644 --- a/single-stream/instructions/5-customization.md +++ b/single-stream/instructions/5-customization.md @@ -1,5 +1,5 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Radio Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) ## Customize the Skill to be Yours @@ -7,7 +7,7 @@ At this point, you should have a working copy of our Helper skill. In order to 1. **New sentences to respond to your users.** There are several sentences and responses that you will want to customize for your skill. - 1. **Go back to your copy of [index.js]((https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/src/index.js)).** + 1. **Go back to your copy of [index.js]((https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/src/index.js)).** 2. **Look for the comment "TODO: Update these messages to customize."** This is the beginning of the section where you need to customize several text strings for your skill. @@ -19,9 +19,9 @@ At this point, you should have a working copy of our Helper skill. In order to 3. **Once you have made the updates listed on this page, you can click "Next" to move on to Publishing and Certification of your skill.** - +

- + diff --git a/single-stream/instructions/6-publication.md b/single-stream/instructions/6-publication.md index 4010635..e003454 100644 --- a/single-stream/instructions/6-publication.md +++ b/single-stream/instructions/6-publication.md @@ -1,5 +1,5 @@ -# Build An Alexa Minecraft Helper Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/instructions/6-publication.md) +# Build An Alexa Radio Player Skill +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-locked._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-on._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) ## Get Your Skill Certified and Published @@ -17,10 +17,10 @@ We are almost done! The last step is to add the metadata that your skill will u * **Provide testing instructions.** Testing instructions give you an opportunity to explain your skill, and any special or possibly confusing features, to the certification team. A value is required in this box. - * Since you are using our Howto Sample, make sure to add this sentence to your Testing Instructions: + * Since you are using our Audio Player Sample, make sure to add this sentence to your Testing Instructions: ``` - This was built using the Howto Sample. + This was built using the Audio Player Sample. ``` This will let the testing team understand what you're providing them, and should decrease the testing time required. @@ -101,7 +101,7 @@ We are almost done! The last step is to add the metadata that your skill will u 9. **Export Compliance.** Be certain that you agree with all of the conditions. If you do, make sure to check this box, as Amazon requires this permission to distribute your skill around the globe. -10. **Privacy Policy URL.** This is an optional field, and should not be required for this howto skill sample. You can leave it blank. +10. **Privacy Policy URL.** This is an optional field, and should not be required for this Audio Player skill sample. You can leave it blank. 11. **Terms of Use URL.** This is also optional, and you can leave it blank. diff --git a/single-stream/interaction-model.json b/single-stream/interaction-model.json index e69de29..d929570 100644 --- a/single-stream/interaction-model.json +++ b/single-stream/interaction-model.json @@ -0,0 +1,62 @@ +{ + "intents": [ + { + "name": "AMAZON.CancelIntent", + "samples": [] + }, + { + "name": "AMAZON.HelpIntent", + "samples": [ + "help me please", + "help please", + "what should i do", + "what's next", + "how can I listen to my radio", + "tell me how to play", + "tell me how to stop", + "tell me how to resume", + "how to stop" + ] + }, + { + "name": "AMAZON.PauseIntent", + "samples": [] + }, + { + "name": "AMAZON.ResumeIntent", + "samples": [] + }, + { + "name": "AMAZON.StartOverIntent", + "samples": [] + }, + { + "name": "AMAZON.StopIntent", + "samples": [] + }, + { + "name": "PlayAudio", + "samples": [ + "play", + "start", + "play my radio", + "play my radio please", + "start my radio", + "start my radio please", + "start the radio", + "start the radio please", + "play the radio", + "play the radio please", + "start the audio", + "start the audio please", + "play the audio", + "play the audio please", + "start the music", + "start the music please", + "play the music", + "play the music please" + ], + "slots": [] + } + ] +} diff --git a/single-stream/lambda-role.md b/single-stream/lambda-role.md new file mode 100644 index 0000000..ae98bfa --- /dev/null +++ b/single-stream/lambda-role.md @@ -0,0 +1,19 @@ +# Setting Up Your First Lambda Role + +If you're reading this page, you're probably setting up your first role for a Lambda function. While it's an easy process, we want to make sure you understand all of the "whys" that go into this process. + +1. **Choose "Create a custom role" from the Role dropdown.** This will launch a new tab in your browser, so make sure that popups are enabled when you attempt this. + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/1-choose-custom-role._TTH_.png) + +2. **You are now creating a new IAM role.** IAM stands for Identity and Access Management. ([You can read more about IAM here.](http://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)) By creating this role, you are enabling your Lambda function to be able to create Amazon CloudWatch logs for your function. ([You can read more about managing permissions with IAM roles here.](https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role)) + +3. **You don't need to make any changes. Click the Allow button in the bottom right corner.** + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/3-allow-button._TTH_.png) + +4. **This should close the new tab, and populate your Lambda function appropriately.** If your "Lambda function handler and role" section doesn't look like the screenshot below, try refreshing your page and selecting your new role from the "existing role" dropdown. + + ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/4-lambda-function-role._TTH_.png) + +5. **You can now return to what you were doing.** diff --git a/single-stream/set-up-aws.md b/single-stream/set-up-aws.md new file mode 100644 index 0000000..f8045c0 --- /dev/null +++ b/single-stream/set-up-aws.md @@ -0,0 +1,15 @@ +# Create an AWS Account + + **Note: If you already have an AWS account, you can skip this section. Just sign in to your [console](http://aws.amazon.com).** + +1. Open [aws.amazon.com](aws.amazon.com) and then choose **‘Create an AWS Account’** + + + + 1. Follow the online instructions. Do not worry about the IAM role, we will do that later. + 2. You will need a Valid Credit Card to set up your account (note the AWS Free Tier will suffice however. [You can find out more about the free tier here](https://aws.amazon.com/free/?sc_ichannel=ha&sc_ipage=signin&sc_iplace=body_link_text&sc_icampaigntype=free_tier&sc_icampaign=ha_en_free_tier_signin_2014_03).) + 3. Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad. + +2. Sign in to the AWS Console + +3. It can sometimes take a couple minutes for your new AWS account to go live. You will receive an e-mail when your account is active. \ No newline at end of file diff --git a/single-stream/unit-testing.md b/single-stream/unit-testing.md new file mode 100644 index 0000000..d26be4a --- /dev/null +++ b/single-stream/unit-testing.md @@ -0,0 +1,76 @@ +#Unit Testing Your Alexa Skills + +There are many ways to test your Alexa skill code, and I'm sure others will have similar or superior solutions, but this just works. And it works well! + +To start, we are going to use three things to make all of this work. The first is AWS Lambda, of course. If you haven't built a skill for Alexa before, you're going to want to learn that first before you dive into unit testing those skills. Once you've gotten your Lambda function set up, however, you're most of the way there. + +The second step involves another AWS product, API Gateway. It will become the HTTP front end to your Lambda function. It will catch the POST messages that we want to pass to our function, and funnels the JSON response back, so that we can validate our request against our specific testing criteria. Let's look at setting this up. + +##Configuring API Gateway +1. To start, go to [AWS API Gateway](https://aws.amazon.com/api-gateway/) and sign in to the console. + +2. From there, you are going to click on the "Create API" button near the top of the page. + +3. First, make sure that you have chosen "New API" from the radio buttons at the top of the page. + +4. Next, you need to give your API a name and description. For this example, name your API "Alexa Skill API." The description can be anything you want. Click the "Create API" button in the bottom right of the screen. + +5. Our next step is to create a resource inside our API. Click the "Actions" button at the top of the page, and choose "Create Resource." + +6. Give your New Child Resource the name "Alexa Resource." It should populate the Resource Path automatically for you with "alexa-resource." After this, you can click the "Create Resource button in the bottom right corner of the screen. + +7. You should see your new resource in the Resources pane. Click the Actions button again, and choose "Create Method." + +8. We need to make our resource able to catch POST requests, so in the new dropdown box that was created, choose POST from the options, and click the round checkbox button. + +9. For the setup of your POST function, you can leave the Integration Type at "Lambda Function." For the Lambda Region, choose the region where your Lambda function lives. (Most commonly, this is "us-east-1."). + +10. In the Lambda Function box, start typing the name of your Lambda function. It should autocomplete for you. Click the "Save" button at the bottom right corner of the screen. + +11. One last time, we need to open the Actions button, and this time choose "Deploy API." In the Deploy API box that appears, choose "[New Stage]" for Deployment stage. For the other three values (Stage Name, Stage description, and Deployment description), you can just use the word "Test" for all of them. The values don't matter, it's just so that you know what the purpose of this new API is for. + +12. Click the Deploy Button. + +13. Copy the Invoke URL from the blue box at the top of the screen, remembering that the Resource name you used was "alexa-resource." Your API is set up and ready to roll. + +##Using Postman to Test Your Lambda +1. If you don't already have this tool, make sure to download [Postman](https://www.getpostman.com/). + +2. Create a profile, and log in to the Postman software. + +3. Near the top center of the screen is a box with the words "Enter request URL." Paste the Invoke URL from your API Gateway setup into this box. + +4. Change the GET dropdown to POST. + +5. Below the textbox, click the Headers tab. For the key, use "Content-Type", and for the value, use "application/json." + +6. On the Body tab, choose "raw" from the radio buttons, and paste a Lambda request in the large text box. + +7. You should now be able to click the large blue Send button near the top right corner of the page. In the bottom half of the page, you should see another Body tab for the response. Opening this should show you the actual response recieved from your Lambda function. + +8. Once you've verified that you can successfully communicate with your Lambda, we can start building a suite of tests. + +9. Back up at the top of the screen (but below the request URL textbox), there is another tab called "Tests." In this tab, you can create as many tests as you would like for this request event. For example, you want to verify that when you pass the value "K" to your Lambda function, that it returns the value "Potassium," (assuming you're building a skill related to the Periodic Table of Elements.) To do this, you can use one of the convenient links on the right, or just use this text: + + '''JAVASCRIPT + tests["Submitted 'K' as first name, expect 'Potassium' in response."] = responseBody === "Potassium"; + ''' + +10. Click the Send button again should show the Tests tab in the lower half with results similar to (1/1) or (0/1). Clicking on this Tests tab at the bottom should show a list of all of your tests for this response, as well as their status. (Pass/Fail). + +11. To save this for future use, there is a Save button next to the Send button we have been using in the top right corner of the screen. CLick it to save this request and its tests. + +12. In the box that appears, give your Request name something meaningful to your test, like "Submitted 'K', should receive 'Potassium.'" + +13. The description is optional, but always helpful to remind yourself what the purpose of this test/request is. + +14. Finally, create a new collection name. I recommend naming it after your skill, as this will be where you can keep all of your tests for that skill. + +15. On the left side of Postman, you have probably been operating in the History tab, where it shows you a result of each time you've pressed the Send button. Click on the Collections tab, and you should now see a new collection with the same name as the one you just created. + +16. You can click on an individual test to open/edit/run one of them, and you can can click on the three dots after a test to edit, duplicate, or delete it. + +17. If you click the arrow that is next to your collection, there is a blue Run button that will run all of your requests and their tests at once, giving you instant verification about the status of your skill. + +That is all! + From d50a139aefe08ad1d06b73a585eeaee64e140ff9 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Thu, 26 Oct 2017 11:45:35 -0700 Subject: [PATCH 03/10] Update intial readmes : --- multiple-streams/README.md | 22 ++++++++++++++++++---- single-stream/README.md | 26 +++++++++++--------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/multiple-streams/README.md b/multiple-streams/README.md index bf0c453..81da97f 100644 --- a/multiple-streams/README.md +++ b/multiple-streams/README.md @@ -1,7 +1,21 @@ +# Build An Alexa Radio Skill + + +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/6-publication.md) + # Audio Player Sample Project The Alexa Skills Kit now allows developers to build skills that play long-form audio content on Alexa devices. This sample project demonstrates how to use the new interfaces for triggering playback of audio and handling audio player input events. +To follow this tutorial, work through the [instructions](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md) to create your audio player skill. + + + + + + + + ## How to Run the Sample 1. Clone the project and package the skill: @@ -22,7 +36,7 @@ zip -r ../audio-player.zip * ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/aws-lambda-role.PNG "AWS Lambda Role") ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/aws-lambda-ask-trigger.PNG "AWS Lambda Trigger") 3. After creation, take note of the ARN on the upper right, which you'll configure in the Developer Console below. - + 3. Create or login to an [Amazon Developer account](https://developer.amazon.com). In the Developer Console: 1. [Create an Alexa Skill](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-lambda-function) named MySkill and using the invocation name "my skill" and select 'Yes' for Audio Player support. @@ -31,7 +45,7 @@ zip -r ../audio-player.zip * ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/prod-interaction-model.png "Developer Portal Interaction Model") 3. Copy the Lambda ARN from above in the Configuration tab. ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/prod-configuration.png "Developer Portal Configuration") - + 4. You can start using the skill on your device or in the simulator using the invocation phrase "Alexa, ask my skill to play". ## How it Works @@ -51,6 +65,6 @@ The sample project plays a pre-defined list of audio content defined in `js/audi * **START_MODE** is the default state of the skill, such as when it's invoked without an intent for the first time. * **PLAY_MODE** is used when audio is currently being played by the skill. * **RESUME_DECISION_MODE** is used to handle the response from the user when they're asked to confirm they'd like to resume playback from a prior use of the skill. -* `audioEventHandlers.js` is where the skill handles AudioPlayer events. These events are only expected in the PLAY_MODE state and are used to track the user's progress through the content. +* `audioEventHandlers.js` is where the skill handles AudioPlayer events. These events are only expected in the PLAY_MODE state and are used to track the user's progress through the content. -You can learn more about the new [AudioPlayer interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference) and [PlaybackController interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-playbackcontroller-interface-reference). \ No newline at end of file +You can learn more about the new [AudioPlayer interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference) and [PlaybackController interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-playbackcontroller-interface-reference). diff --git a/single-stream/README.md b/single-stream/README.md index b694d05..2063cca 100644 --- a/single-stream/README.md +++ b/single-stream/README.md @@ -1,23 +1,10 @@ # Build An Alexa Radio Skill -[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/instructions/6-publication.md) +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) - - - - - - - - - - - - - - + + + + From 8705452398618c7d0644dcddf7b4a201aa275ead Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Thu, 26 Oct 2017 12:44:03 -0700 Subject: [PATCH 04/10] Customize instructions for zip file --- multiple-streams/README.md | 43 ++----------------- .../instructions/2-lambda-function.md | 10 ++++- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/multiple-streams/README.md b/multiple-streams/README.md index 81da97f..13d336e 100644 --- a/multiple-streams/README.md +++ b/multiple-streams/README.md @@ -9,45 +9,6 @@ The Alexa Skills Kit now allows developers to build skills that play long-form a To follow this tutorial, work through the [instructions](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md) to create your audio player skill. - - - - - - - -## How to Run the Sample - -1. Clone the project and package the skill: -```bash -git clone https://github.com/alexa/skill-sample-nodejs-audio-player.git -cd skill-sample-nodejs-audio-player/multiple-streams/js -npm install -zip -r ../audio-player.zip * -``` -2. Create or login to an [AWS account](https://aws.amazon.com/). In the AWS Console: - - 1. Create an AWS Role in IAM with access to Lambda, CloudWatch Logs and DynamoDB. - ![create_role_1](https://cloud.githubusercontent.com/assets/7671574/17451098/09f64f40-5b19-11e6-82ee-b82c98387052.png "AWS Create Role Screenshot 1") - ![create_role_2](https://cloud.githubusercontent.com/assets/7671574/17451100/0c3ef928-5b19-11e6-9aca-8cd353106396.png "AWS Create Role Screenshot 2") - ![create_role_3](https://cloud.githubusercontent.com/assets/7671574/18011103/7b05f2b2-6b68-11e6-8dc3-3aa9ead6d83e.png "AWS Create Role Screenshot 3") - - 2. Create an AWS Lambda function named AudioPlayerLambdaFunction being sure to select the role created above, configuring "Alexa Skills Kit" as the "Trigger" and using the zip file created above as the source. - ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/aws-lambda-role.PNG "AWS Lambda Role") - ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/aws-lambda-ask-trigger.PNG "AWS Lambda Trigger") - 3. After creation, take note of the ARN on the upper right, which you'll configure in the Developer Console below. - -3. Create or login to an [Amazon Developer account](https://developer.amazon.com). In the Developer Console: - - 1. [Create an Alexa Skill](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-lambda-function) named MySkill and using the invocation name "my skill" and select 'Yes' for Audio Player support. - ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/prod-skill-info.png "Developer Portal Skill Information") - 2. Copy the contents of `speechAssets/intentSchema.json` and `speechAssets/Utterances.txt` into the intent schema and sample utterances fields on the Interaction Model tab. - ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/prod-interaction-model.png "Developer Portal Interaction Model") - 3. Copy the Lambda ARN from above in the Configuration tab. - ![alt text](https://s3.amazonaws.com/lantern-public-assets/audio-player-assets/prod-configuration.png "Developer Portal Configuration") - -4. You can start using the skill on your device or in the simulator using the invocation phrase "Alexa, ask my skill to play". - ## How it Works Alexa Skills Kit now includes a set of output directives and input events that allow you to control the playback of audio files or streams. There are a few important concepts to get familiar with: @@ -68,3 +29,7 @@ The sample project plays a pre-defined list of audio content defined in `js/audi * `audioEventHandlers.js` is where the skill handles AudioPlayer events. These events are only expected in the PLAY_MODE state and are used to track the user's progress through the content. You can learn more about the new [AudioPlayer interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference) and [PlaybackController interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-playbackcontroller-interface-reference). + + + + diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md index 8c5f82d..8e3ee09 100644 --- a/multiple-streams/instructions/2-lambda-function.md +++ b/multiple-streams/instructions/2-lambda-function.md @@ -5,6 +5,14 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. +First, clone the project and package the skill: +```bash +git clone https://github.com/alexa/skill-sample-nodejs-audio-player.git +cd skill-sample-nodejs-audio-player/multiple-streams/js +npm install +zip -r ../audio-player.zip * +``` + 1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). @@ -35,7 +43,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a -8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. +8. **Select "Upload a .ZIP file" as your Code Entry Type** Then click "Upload" and select the zip file you created with the command above. 9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." From 7960ccbf51b12f6bf8bbee2b931e286261604e28 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Wed, 1 Nov 2017 11:36:39 -0700 Subject: [PATCH 05/10] Update instructions, fix format in multi-stream --- .../instructions/2-lambda-function.md | 4 +- multiple-streams/instructions/4-testing.md | 16 ++-- multiple-streams/lambda-role.md | 19 ----- multiple-streams/lambda/package.json | 2 +- multiple-streams/models/en-US.json | 70 +++++++++++++++++ multiple-streams/set-up-aws.md | 15 ---- multiple-streams/skill.json | 50 ++++++++++++ .../speechAssets/IntentSchema.json | 37 --------- multiple-streams/speechAssets/Utterances.txt | 15 ---- multiple-streams/unit-testing.md | 76 ------------------- ...ction-model.json => InteractionModel.json} | 0 .../instructions/1-voice-user-interface.md | 4 +- .../instructions/2-lambda-function.md | 4 +- single-stream/instructions/4-testing.md | 16 ++-- single-stream/lambda-role.md | 19 ----- single-stream/set-up-aws.md | 15 ---- single-stream/skill.json | 2 +- single-stream/unit-testing.md | 76 ------------------- 18 files changed, 146 insertions(+), 294 deletions(-) delete mode 100644 multiple-streams/lambda-role.md delete mode 100644 multiple-streams/set-up-aws.md create mode 100644 multiple-streams/skill.json delete mode 100644 multiple-streams/speechAssets/IntentSchema.json delete mode 100644 multiple-streams/speechAssets/Utterances.txt delete mode 100644 multiple-streams/unit-testing.md rename single-stream/{interaction-model.json => InteractionModel.json} (100%) delete mode 100644 single-stream/lambda-role.md delete mode 100644 single-stream/set-up-aws.md delete mode 100644 single-stream/unit-testing.md diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md index 8e3ee09..bbc55af 100644 --- a/multiple-streams/instructions/2-lambda-function.md +++ b/multiple-streams/instructions/2-lambda-function.md @@ -13,7 +13,7 @@ npm install zip -r ../audio-player.zip * ``` -1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). +1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/testing/set-up-aws.md). @@ -45,7 +45,7 @@ zip -r ../audio-player.zip * 8. **Select "Upload a .ZIP file" as your Code Entry Type** Then click "Upload" and select the zip file you created with the command above. -9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." +9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." diff --git a/multiple-streams/instructions/4-testing.md b/multiple-streams/instructions/4-testing.md index 25b1fb1..577a3ff 100644 --- a/multiple-streams/instructions/4-testing.md +++ b/multiple-streams/instructions/4-testing.md @@ -30,7 +30,7 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect. -4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "how can i build a map" +4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "open reindeer trivia" @@ -41,21 +41,23 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup * If you receive a response that reads: *"The remote endpoint could not be called, or the response it returned was invalid,"* this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill. 5. **Configure a test event in AWS Lambda.** Now that you are familiar with the **request** and **response** boxes in the Service Simulator, it's important for you to know that you can use your **requests** to directly test your Lambda function every time you update it. To do this: - 1. Create & copy a new response with the Service Simulator. + 1. Enter an utterance in the service simulator, and copy the generated Lambda Request for the next step. - 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test event."** + 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test events."** - 3. **Choose "Alexa Start Session" from the Sample Event Template dropdown list.** You can choose any item in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. This will also be the sample request that fires every time you update and "Save and Test" your Lambda code. + 3. **Select "Create New Test Event". Choose "Alexa Start Session" as the Event Template from the dropdown list.** You can choose any test event in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. - 4. **Delete the contents of the box, and paste your request into the box.** + 4. **Type in an Event Name into the Event Name Dialog box. Delete the contents of the code editor, and paste the Lambda request you copied above into the code editor.** The Event Name is only visible to you. Name your test event something descriptive and memorable. For our example, we entered an event name as "startSession". Additionally, by copying and pasting your Lambda Request from the service simulator, you can test different utterances and skill events beyond the pre-populated templates in Lambda. - 5. **Click the "Save and test" button.** This will save your test event, and run it against your Lambda function. + 5. **Click the "Create" button.** This will save your test event and bring you back to the main configuration for your lambda function. + + 6. **Click the "Test" button to execute the "startSession" test event.** @@ -78,7 +80,7 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup 6. **Other testing methods to consider:** * [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go. - * [Unit Testing with Alexa](https://github.com/alexa/skill-sample-nodejs-howto/blob/master/unit-testing.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). + * [Unit Testing with Alexa](https://github.com/alexa/alexa-cookbook/tree/master/testing/postman/README.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). 7. **If your sample skill is working properly, you can now customize your skill.** diff --git a/multiple-streams/lambda-role.md b/multiple-streams/lambda-role.md deleted file mode 100644 index ae98bfa..0000000 --- a/multiple-streams/lambda-role.md +++ /dev/null @@ -1,19 +0,0 @@ -# Setting Up Your First Lambda Role - -If you're reading this page, you're probably setting up your first role for a Lambda function. While it's an easy process, we want to make sure you understand all of the "whys" that go into this process. - -1. **Choose "Create a custom role" from the Role dropdown.** This will launch a new tab in your browser, so make sure that popups are enabled when you attempt this. - - ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/1-choose-custom-role._TTH_.png) - -2. **You are now creating a new IAM role.** IAM stands for Identity and Access Management. ([You can read more about IAM here.](http://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)) By creating this role, you are enabling your Lambda function to be able to create Amazon CloudWatch logs for your function. ([You can read more about managing permissions with IAM roles here.](https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role)) - -3. **You don't need to make any changes. Click the Allow button in the bottom right corner.** - - ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/3-allow-button._TTH_.png) - -4. **This should close the new tab, and populate your Lambda function appropriately.** If your "Lambda function handler and role" section doesn't look like the screenshot below, try refreshing your page and selecting your new role from the "existing role" dropdown. - - ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/4-lambda-function-role._TTH_.png) - -5. **You can now return to what you were doing.** diff --git a/multiple-streams/lambda/package.json b/multiple-streams/lambda/package.json index 673dcd0..a880f5c 100644 --- a/multiple-streams/lambda/package.json +++ b/multiple-streams/lambda/package.json @@ -1,7 +1,7 @@ { "name": "Single_Stream_Audio_Player_Example", "version": "1.0.0", - "description": "An simple audio player sample skill.", + "description": "A simple audio player sample skill.", "main": "index.js", "scripts": { "test": "mocha" diff --git a/multiple-streams/models/en-US.json b/multiple-streams/models/en-US.json index e69de29..ad79724 100644 --- a/multiple-streams/models/en-US.json +++ b/multiple-streams/models/en-US.json @@ -0,0 +1,70 @@ +{ + "interactionModel": { + "languageModel": { + "invocationName": "podcast player", + "intents": [ + { + "name": "AMAZON.CancelIntent", + "samples": [] + }, + { + "name": "AMAZON.HelpIntent", + "samples": [] + }, + { + "name": "AMAZON.NextIntent", + "samples": [] + }, + { + "name": "AMAZON.NoIntent", + "samples": [] + }, + { + "name": "AMAZON.PauseIntent", + "samples": [] + }, + { + "name": "AMAZON.PreviousIntent", + "samples": [] + }, + { + "name": "AMAZON.ResumeIntent", + "samples": [] + }, + { + "name": "AMAZON.StartOverIntent", + "samples": [] + }, + { + "name": "AMAZON.StopIntent", + "samples": [] + }, + { + "name": "AMAZON.YesIntent", + "samples": [] + }, + { + "name": "PlayAudio", + "samples": [ + "begin podcast", + "begin the podcast", + "begin playing the podcast", + "start podcast", + "start the podcast", + "start playing the podcast", + "play the podcast", + "to play", + "to begin podcast", + "to begin the podcast", + "to begin playing the podcast", + "to start podcast", + "to start the podcast", + "to start playing the podcast", + "to play the podcast" + ], + "slots": [] + } + ] + } + } +} diff --git a/multiple-streams/set-up-aws.md b/multiple-streams/set-up-aws.md deleted file mode 100644 index f8045c0..0000000 --- a/multiple-streams/set-up-aws.md +++ /dev/null @@ -1,15 +0,0 @@ -# Create an AWS Account - - **Note: If you already have an AWS account, you can skip this section. Just sign in to your [console](http://aws.amazon.com).** - -1. Open [aws.amazon.com](aws.amazon.com) and then choose **‘Create an AWS Account’** - - - - 1. Follow the online instructions. Do not worry about the IAM role, we will do that later. - 2. You will need a Valid Credit Card to set up your account (note the AWS Free Tier will suffice however. [You can find out more about the free tier here](https://aws.amazon.com/free/?sc_ichannel=ha&sc_ipage=signin&sc_iplace=body_link_text&sc_icampaigntype=free_tier&sc_icampaign=ha_en_free_tier_signin_2014_03).) - 3. Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad. - -2. Sign in to the AWS Console - -3. It can sometimes take a couple minutes for your new AWS account to go live. You will receive an e-mail when your account is active. \ No newline at end of file diff --git a/multiple-streams/skill.json b/multiple-streams/skill.json new file mode 100644 index 0000000..a629f1d --- /dev/null +++ b/multiple-streams/skill.json @@ -0,0 +1,50 @@ +{ + "skillManifest": { + "publishingInformation": { + "locales": { + "en-US": { + "summary": "Listen to Podcast Player, less la la la, more bla bla bla.", + "examplePhrases": [ + "Alexa, open Podcast Player", + "Alexa, play Podcast Player", + "Alexa, ask Podcast Player to play" + ], + "keywords": [ + "podcast", + "streaming", + "radio" + ], + "name": "Podcast Player", + "description": "Listen to Podcast Player, with less la la la, and more bla bla bla.\n\nPodcast Player provides a high quality sound 24/7 with the best podcasts.\n\nTo start, just say \"Alexa, launch Podcast Player\" or \"Alexa, play podcast player\" to start the radio\".\n\nAt anytime, you can stop by saying \"Alexa, stop\"", + "smallIconUri": "https://s3-eu-west-1.amazonaws.com/alexa.maxi80.com/assets/alexa-logo-108.png", + "largeIconUri": "https://s3-eu-west-1.amazonaws.com/alexa.maxi80.com/assets/alexa-logo-512.png" + } + }, + "isAvailableWorldwide": true, + "testingInstructions": "Include your testing instruction (if any) here", + "category": "STREAMING_SERVICE", + "distributionCountries": [] + }, + "apis": { + "custom": { + "endpoint": { + "sourceDir": "lambda/custom" + }, + "interfaces": [ + { + "type": "AUDIO_PLAYER" + } + ] + } + }, + "manifestVersion": "1.0", + "permissions": [], + "privacyAndCompliance": { + "allowsPurchases": false, + "isExportCompliant": true, + "containsAds": false, + "isChildDirected": false, + "usesPersonalInfo": false + } + } +} diff --git a/multiple-streams/speechAssets/IntentSchema.json b/multiple-streams/speechAssets/IntentSchema.json deleted file mode 100644 index d3cbf85..0000000 --- a/multiple-streams/speechAssets/IntentSchema.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "intents": [ - { - "intent": "PlayAudio" - }, - { - "intent": "AMAZON.PauseIntent" - }, - { - "intent": "AMAZON.ResumeIntent" - }, - { - "intent": "AMAZON.NextIntent" - }, - { - "intent": "AMAZON.PreviousIntent" - }, - { - "intent": "AMAZON.HelpIntent" - }, - { - "intent": "AMAZON.StopIntent" - }, - { - "intent": "AMAZON.CancelIntent" - }, - { - "intent": "AMAZON.StartOverIntent" - }, - { - "intent": "AMAZON.YesIntent" - }, - { - "intent": "AMAZON.NoIntent" - } - ] -} \ No newline at end of file diff --git a/multiple-streams/speechAssets/Utterances.txt b/multiple-streams/speechAssets/Utterances.txt deleted file mode 100644 index 255d20a..0000000 --- a/multiple-streams/speechAssets/Utterances.txt +++ /dev/null @@ -1,15 +0,0 @@ -PlayAudio begin podcast -PlayAudio begin the podcast -PlayAudio begin playing the podcast -PlayAudio start podcast -PlayAudio start the podcast -PlayAudio start playing the podcast -PlayAudio play the podcast -PlayAudio to play -PlayAudio to begin podcast -PlayAudio to begin the podcast -PlayAudio to begin playing the podcast -PlayAudio to start podcast -PlayAudio to start the podcast -PlayAudio to start playing the podcast -PlayAudio to play the podcast \ No newline at end of file diff --git a/multiple-streams/unit-testing.md b/multiple-streams/unit-testing.md deleted file mode 100644 index d26be4a..0000000 --- a/multiple-streams/unit-testing.md +++ /dev/null @@ -1,76 +0,0 @@ -#Unit Testing Your Alexa Skills - -There are many ways to test your Alexa skill code, and I'm sure others will have similar or superior solutions, but this just works. And it works well! - -To start, we are going to use three things to make all of this work. The first is AWS Lambda, of course. If you haven't built a skill for Alexa before, you're going to want to learn that first before you dive into unit testing those skills. Once you've gotten your Lambda function set up, however, you're most of the way there. - -The second step involves another AWS product, API Gateway. It will become the HTTP front end to your Lambda function. It will catch the POST messages that we want to pass to our function, and funnels the JSON response back, so that we can validate our request against our specific testing criteria. Let's look at setting this up. - -##Configuring API Gateway -1. To start, go to [AWS API Gateway](https://aws.amazon.com/api-gateway/) and sign in to the console. - -2. From there, you are going to click on the "Create API" button near the top of the page. - -3. First, make sure that you have chosen "New API" from the radio buttons at the top of the page. - -4. Next, you need to give your API a name and description. For this example, name your API "Alexa Skill API." The description can be anything you want. Click the "Create API" button in the bottom right of the screen. - -5. Our next step is to create a resource inside our API. Click the "Actions" button at the top of the page, and choose "Create Resource." - -6. Give your New Child Resource the name "Alexa Resource." It should populate the Resource Path automatically for you with "alexa-resource." After this, you can click the "Create Resource button in the bottom right corner of the screen. - -7. You should see your new resource in the Resources pane. Click the Actions button again, and choose "Create Method." - -8. We need to make our resource able to catch POST requests, so in the new dropdown box that was created, choose POST from the options, and click the round checkbox button. - -9. For the setup of your POST function, you can leave the Integration Type at "Lambda Function." For the Lambda Region, choose the region where your Lambda function lives. (Most commonly, this is "us-east-1."). - -10. In the Lambda Function box, start typing the name of your Lambda function. It should autocomplete for you. Click the "Save" button at the bottom right corner of the screen. - -11. One last time, we need to open the Actions button, and this time choose "Deploy API." In the Deploy API box that appears, choose "[New Stage]" for Deployment stage. For the other three values (Stage Name, Stage description, and Deployment description), you can just use the word "Test" for all of them. The values don't matter, it's just so that you know what the purpose of this new API is for. - -12. Click the Deploy Button. - -13. Copy the Invoke URL from the blue box at the top of the screen, remembering that the Resource name you used was "alexa-resource." Your API is set up and ready to roll. - -##Using Postman to Test Your Lambda -1. If you don't already have this tool, make sure to download [Postman](https://www.getpostman.com/). - -2. Create a profile, and log in to the Postman software. - -3. Near the top center of the screen is a box with the words "Enter request URL." Paste the Invoke URL from your API Gateway setup into this box. - -4. Change the GET dropdown to POST. - -5. Below the textbox, click the Headers tab. For the key, use "Content-Type", and for the value, use "application/json." - -6. On the Body tab, choose "raw" from the radio buttons, and paste a Lambda request in the large text box. - -7. You should now be able to click the large blue Send button near the top right corner of the page. In the bottom half of the page, you should see another Body tab for the response. Opening this should show you the actual response recieved from your Lambda function. - -8. Once you've verified that you can successfully communicate with your Lambda, we can start building a suite of tests. - -9. Back up at the top of the screen (but below the request URL textbox), there is another tab called "Tests." In this tab, you can create as many tests as you would like for this request event. For example, you want to verify that when you pass the value "K" to your Lambda function, that it returns the value "Potassium," (assuming you're building a skill related to the Periodic Table of Elements.) To do this, you can use one of the convenient links on the right, or just use this text: - - '''JAVASCRIPT - tests["Submitted 'K' as first name, expect 'Potassium' in response."] = responseBody === "Potassium"; - ''' - -10. Click the Send button again should show the Tests tab in the lower half with results similar to (1/1) or (0/1). Clicking on this Tests tab at the bottom should show a list of all of your tests for this response, as well as their status. (Pass/Fail). - -11. To save this for future use, there is a Save button next to the Send button we have been using in the top right corner of the screen. CLick it to save this request and its tests. - -12. In the box that appears, give your Request name something meaningful to your test, like "Submitted 'K', should receive 'Potassium.'" - -13. The description is optional, but always helpful to remind yourself what the purpose of this test/request is. - -14. Finally, create a new collection name. I recommend naming it after your skill, as this will be where you can keep all of your tests for that skill. - -15. On the left side of Postman, you have probably been operating in the History tab, where it shows you a result of each time you've pressed the Send button. Click on the Collections tab, and you should now see a new collection with the same name as the one you just created. - -16. You can click on an individual test to open/edit/run one of them, and you can can click on the three dots after a test to edit, duplicate, or delete it. - -17. If you click the arrow that is next to your collection, there is a blue Run button that will run all of your requests and their tests at once, giving you instant verification about the status of your skill. - -That is all! - diff --git a/single-stream/interaction-model.json b/single-stream/InteractionModel.json similarity index 100% rename from single-stream/interaction-model.json rename to single-stream/InteractionModel.json diff --git a/single-stream/instructions/1-voice-user-interface.md b/single-stream/instructions/1-voice-user-interface.md index 7c8ce8d..9e1b04b 100644 --- a/single-stream/instructions/1-voice-user-interface.md +++ b/single-stream/instructions/1-voice-user-interface.md @@ -32,7 +32,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf * **Name** This is the name of the skill as it will be displayed in the [Alexa app](http://alexa.amazon.com). - * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "Radio Player" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. + * **Invocation Name** This is the name spoken by your users to start the skill. Use a name like "My Radio" for this sample skill. Some common issues that developers experience with invocation names are listed in the following table. In addition, please review the [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill) as you consider an invocation name for your skill. | Invocation Name Requirements | Examples of incorrect invocation names | | ---------------------------- | -------------------------------------- | @@ -55,7 +55,7 @@ There are two parts to an Alexa skill. The first part is the [Voice User Interf 8. Click on the "Code Editor" item under **Dashboard** on the top left side of the skill builder. -9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/interaction-model.json), then click "Apply Changes" or "Save Model". +9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](../InteractionModel.json), then click "Apply Changes" or "Save Model". 10. Click on the "Dashboard" button. diff --git a/single-stream/instructions/2-lambda-function.md b/single-stream/instructions/2-lambda-function.md index 8764cc3..93fcaff 100644 --- a/single-stream/instructions/2-lambda-function.md +++ b/single-stream/instructions/2-lambda-function.md @@ -5,7 +5,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. -1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](/set-up-aws.md). +1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/testing/set-up-aws.md). @@ -37,7 +37,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a 8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. -9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." +9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/testing/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." diff --git a/single-stream/instructions/4-testing.md b/single-stream/instructions/4-testing.md index 6a51be4..70c7c1a 100644 --- a/single-stream/instructions/4-testing.md +++ b/single-stream/instructions/4-testing.md @@ -30,7 +30,7 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect. -4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "how can i build a map" +4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "open reindeer trivia" @@ -41,21 +41,23 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup * If you receive a response that reads: *"The remote endpoint could not be called, or the response it returned was invalid,"* this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill. 5. **Configure a test event in AWS Lambda.** Now that you are familiar with the **request** and **response** boxes in the Service Simulator, it's important for you to know that you can use your **requests** to directly test your Lambda function every time you update it. To do this: - 1. Create & copy a new response with the Service Simulator. + 1. Enter an utterance in the service simulator, and copy the generated Lambda Request for the next step. - 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test event."** + 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test events."** - 3. **Choose "Alexa Start Session" from the Sample Event Template dropdown list.** You can choose any item in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. This will also be the sample request that fires every time you update and "Save and Test" your Lambda code. + 3. **Select "Create New Test Event". Choose "Alexa Start Session" as the Event Template from the dropdown list.** You can choose any test event in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. - 4. **Delete the contents of the box, and paste your request into the box.** + 4. **Type in an Event Name into the Event Name Dialog box. Delete the contents of the code editor, and paste the Lambda request you copied above into the code editor.** The Event Name is only visible to you. Name your test event something descriptive and memorable. For our example, we entered an event name as "startSession". Additionally, by copying and pasting your Lambda Request from the service simulator, you can test different utterances and skill events beyond the pre-populated templates in Lambda. - 5. **Click the "Save and test" button.** This will save your test event, and run it against your Lambda function. + 5. **Click the "Create" button.** This will save your test event and bring you back to the main configuration for your lambda function. + + 6. **Click the "Test" button to execute the "startSession" test event.** @@ -78,7 +80,7 @@ pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup 6. **Other testing methods to consider:** * [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go. - * [Unit Testing with Alexa](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/unit-testing.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). + * [Unit Testing with Alexa](https://github.com/alexa/alexa-cookbook/tree/master/testing/postman/README.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). 7. **If your sample skill is working properly, you can now customize your skill.** diff --git a/single-stream/lambda-role.md b/single-stream/lambda-role.md deleted file mode 100644 index ae98bfa..0000000 --- a/single-stream/lambda-role.md +++ /dev/null @@ -1,19 +0,0 @@ -# Setting Up Your First Lambda Role - -If you're reading this page, you're probably setting up your first role for a Lambda function. While it's an easy process, we want to make sure you understand all of the "whys" that go into this process. - -1. **Choose "Create a custom role" from the Role dropdown.** This will launch a new tab in your browser, so make sure that popups are enabled when you attempt this. - - ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/1-choose-custom-role._TTH_.png) - -2. **You are now creating a new IAM role.** IAM stands for Identity and Access Management. ([You can read more about IAM here.](http://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)) By creating this role, you are enabling your Lambda function to be able to create Amazon CloudWatch logs for your function. ([You can read more about managing permissions with IAM roles here.](https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role)) - -3. **You don't need to make any changes. Click the Allow button in the bottom right corner.** - - ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/3-allow-button._TTH_.png) - -4. **This should close the new tab, and populate your Lambda function appropriately.** If your "Lambda function handler and role" section doesn't look like the screenshot below, try refreshing your page and selecting your new role from the "existing role" dropdown. - - ![](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/lambda-role/4-lambda-function-role._TTH_.png) - -5. **You can now return to what you were doing.** diff --git a/single-stream/set-up-aws.md b/single-stream/set-up-aws.md deleted file mode 100644 index f8045c0..0000000 --- a/single-stream/set-up-aws.md +++ /dev/null @@ -1,15 +0,0 @@ -# Create an AWS Account - - **Note: If you already have an AWS account, you can skip this section. Just sign in to your [console](http://aws.amazon.com).** - -1. Open [aws.amazon.com](aws.amazon.com) and then choose **‘Create an AWS Account’** - - - - 1. Follow the online instructions. Do not worry about the IAM role, we will do that later. - 2. You will need a Valid Credit Card to set up your account (note the AWS Free Tier will suffice however. [You can find out more about the free tier here](https://aws.amazon.com/free/?sc_ichannel=ha&sc_ipage=signin&sc_iplace=body_link_text&sc_icampaigntype=free_tier&sc_icampaign=ha_en_free_tier_signin_2014_03).) - 3. Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad. - -2. Sign in to the AWS Console - -3. It can sometimes take a couple minutes for your new AWS account to go live. You will receive an e-mail when your account is active. \ No newline at end of file diff --git a/single-stream/skill.json b/single-stream/skill.json index ad34dc2..4fd4e4f 100644 --- a/single-stream/skill.json +++ b/single-stream/skill.json @@ -45,7 +45,7 @@ "apis": { "custom": { "endpoint": { - "sourceDir": "lambda/src" + "sourceDir": "lambda/custom" }, "interfaces": [ { diff --git a/single-stream/unit-testing.md b/single-stream/unit-testing.md deleted file mode 100644 index d26be4a..0000000 --- a/single-stream/unit-testing.md +++ /dev/null @@ -1,76 +0,0 @@ -#Unit Testing Your Alexa Skills - -There are many ways to test your Alexa skill code, and I'm sure others will have similar or superior solutions, but this just works. And it works well! - -To start, we are going to use three things to make all of this work. The first is AWS Lambda, of course. If you haven't built a skill for Alexa before, you're going to want to learn that first before you dive into unit testing those skills. Once you've gotten your Lambda function set up, however, you're most of the way there. - -The second step involves another AWS product, API Gateway. It will become the HTTP front end to your Lambda function. It will catch the POST messages that we want to pass to our function, and funnels the JSON response back, so that we can validate our request against our specific testing criteria. Let's look at setting this up. - -##Configuring API Gateway -1. To start, go to [AWS API Gateway](https://aws.amazon.com/api-gateway/) and sign in to the console. - -2. From there, you are going to click on the "Create API" button near the top of the page. - -3. First, make sure that you have chosen "New API" from the radio buttons at the top of the page. - -4. Next, you need to give your API a name and description. For this example, name your API "Alexa Skill API." The description can be anything you want. Click the "Create API" button in the bottom right of the screen. - -5. Our next step is to create a resource inside our API. Click the "Actions" button at the top of the page, and choose "Create Resource." - -6. Give your New Child Resource the name "Alexa Resource." It should populate the Resource Path automatically for you with "alexa-resource." After this, you can click the "Create Resource button in the bottom right corner of the screen. - -7. You should see your new resource in the Resources pane. Click the Actions button again, and choose "Create Method." - -8. We need to make our resource able to catch POST requests, so in the new dropdown box that was created, choose POST from the options, and click the round checkbox button. - -9. For the setup of your POST function, you can leave the Integration Type at "Lambda Function." For the Lambda Region, choose the region where your Lambda function lives. (Most commonly, this is "us-east-1."). - -10. In the Lambda Function box, start typing the name of your Lambda function. It should autocomplete for you. Click the "Save" button at the bottom right corner of the screen. - -11. One last time, we need to open the Actions button, and this time choose "Deploy API." In the Deploy API box that appears, choose "[New Stage]" for Deployment stage. For the other three values (Stage Name, Stage description, and Deployment description), you can just use the word "Test" for all of them. The values don't matter, it's just so that you know what the purpose of this new API is for. - -12. Click the Deploy Button. - -13. Copy the Invoke URL from the blue box at the top of the screen, remembering that the Resource name you used was "alexa-resource." Your API is set up and ready to roll. - -##Using Postman to Test Your Lambda -1. If you don't already have this tool, make sure to download [Postman](https://www.getpostman.com/). - -2. Create a profile, and log in to the Postman software. - -3. Near the top center of the screen is a box with the words "Enter request URL." Paste the Invoke URL from your API Gateway setup into this box. - -4. Change the GET dropdown to POST. - -5. Below the textbox, click the Headers tab. For the key, use "Content-Type", and for the value, use "application/json." - -6. On the Body tab, choose "raw" from the radio buttons, and paste a Lambda request in the large text box. - -7. You should now be able to click the large blue Send button near the top right corner of the page. In the bottom half of the page, you should see another Body tab for the response. Opening this should show you the actual response recieved from your Lambda function. - -8. Once you've verified that you can successfully communicate with your Lambda, we can start building a suite of tests. - -9. Back up at the top of the screen (but below the request URL textbox), there is another tab called "Tests." In this tab, you can create as many tests as you would like for this request event. For example, you want to verify that when you pass the value "K" to your Lambda function, that it returns the value "Potassium," (assuming you're building a skill related to the Periodic Table of Elements.) To do this, you can use one of the convenient links on the right, or just use this text: - - '''JAVASCRIPT - tests["Submitted 'K' as first name, expect 'Potassium' in response."] = responseBody === "Potassium"; - ''' - -10. Click the Send button again should show the Tests tab in the lower half with results similar to (1/1) or (0/1). Clicking on this Tests tab at the bottom should show a list of all of your tests for this response, as well as their status. (Pass/Fail). - -11. To save this for future use, there is a Save button next to the Send button we have been using in the top right corner of the screen. CLick it to save this request and its tests. - -12. In the box that appears, give your Request name something meaningful to your test, like "Submitted 'K', should receive 'Potassium.'" - -13. The description is optional, but always helpful to remind yourself what the purpose of this test/request is. - -14. Finally, create a new collection name. I recommend naming it after your skill, as this will be where you can keep all of your tests for that skill. - -15. On the left side of Postman, you have probably been operating in the History tab, where it shows you a result of each time you've pressed the Send button. Click on the Collections tab, and you should now see a new collection with the same name as the one you just created. - -16. You can click on an individual test to open/edit/run one of them, and you can can click on the three dots after a test to edit, duplicate, or delete it. - -17. If you click the arrow that is next to your collection, there is a blue Run button that will run all of your requests and their tests at once, giving you instant verification about the status of your skill. - -That is all! - From 40d28e704d2bd701d8ec3827f8a10658db3e1324 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Wed, 1 Nov 2017 11:43:03 -0700 Subject: [PATCH 06/10] Fix links --- multiple-streams/instructions/2-lambda-function.md | 2 +- single-stream/instructions/2-lambda-function.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md index bbc55af..927fd34 100644 --- a/multiple-streams/instructions/2-lambda-function.md +++ b/multiple-streams/instructions/2-lambda-function.md @@ -13,7 +13,7 @@ npm install zip -r ../audio-player.zip * ``` -1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/testing/set-up-aws.md). +1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/set-up-aws.md). diff --git a/single-stream/instructions/2-lambda-function.md b/single-stream/instructions/2-lambda-function.md index 93fcaff..e2ab0f7 100644 --- a/single-stream/instructions/2-lambda-function.md +++ b/single-stream/instructions/2-lambda-function.md @@ -5,7 +5,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user. -1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/testing/set-up-aws.md). +1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/set-up-aws.md). @@ -37,7 +37,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a 8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. -9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/testing/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." +9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." From e7a1f5c8dd89ef3d756a7d03b064f5e86182e72d Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Wed, 13 Dec 2017 10:41:22 -0700 Subject: [PATCH 07/10] Update LambdaUI instructions, intro file --- multiple-streams/instructions/0-intro.md | 0 .../instructions/2-lambda-function.md | 35 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 multiple-streams/instructions/0-intro.md diff --git a/multiple-streams/instructions/0-intro.md b/multiple-streams/instructions/0-intro.md new file mode 100644 index 0000000..e69de29 diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md index 927fd34..b40985e 100644 --- a/multiple-streams/instructions/2-lambda-function.md +++ b/multiple-streams/instructions/2-lambda-function.md @@ -29,37 +29,40 @@ zip -r ../audio-player.zip * -5. **Choose the blueprint named "alexa-skill-kit-sdk-factskill".** We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself. +5. **Select your blueprint and zip your code**There are two boxes labeled "Author from scratch" and "Blueprints". Click the radio button in the box titled "Blueprints" then choose the blueprint named "alexa-skill-kit-sdk-factskill". We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself. - + -6. **Configure your trigger.** Click in the dashed box, and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. +* On your local machine, go to the ```skill-sample-nodejs-trivia/lambda/``` directory and run ```deploy.js``` using Node. - + ``` + npm install aws-sdk + node deploy.js + ``` - Once you have selected Alexa Skills Kit, click the **Next** button. + * Go to the the ```skill-sample-nodejs-trivia/lambda/custom/``` directory and zip all of the files. Be sure to only zip the files inside the directory, and not the directory itself. Lambda needs to be able to find the ```index.js``` file at the root of the zip file. -7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "PodcastPlayer" is sufficient if you don't have another idea for a name. +6. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "AudioPlayer" is sufficient if you don't have another idea for a name. - + -8. **Select "Upload a .ZIP file" as your Code Entry Type** Then click "Upload" and select the zip file you created with the command above. +7. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution", then click "Create Function". -9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." + - +8. **Configure your trigger.** Look at the column on the left called "Add triggers", and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. -10. **For this guide, you can skip all of the Advanced settings.** Click the **Next** button to move to the Review screen. + - + Once you have selected Alexa Skills Kit, scroll down and click the **Add** button. Then click the **Save** button in the top right. You should see a green success message at the top of your screen. Now, click the box that has the Lambda icon followed by the name of your function (TriviaSkill if you used our suggestion) then scroll down to the next section of the page titled "Function code". -11. **The Review screen is a summary of your choices. Click Create Function in the bottom left corner.** You will need to scroll down to find **Create Function.** +9. **Select "Upload a .ZIP file" as your Code Entry Type** Then click "Upload" and select the zip file you created with the command above. Then click the "Save" button in the top right. - + -12. **After you create the function, the ARN value appears in the top right corner. Copy this value for use in the next section of the guide.** +10. **The ARN value should be in the top right corner. Copy this value for use in the next section of the guide.** - +

From 0ea0e74f4a00f883ede2a08d2afb1c4d30d7ea57 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Wed, 13 Dec 2017 10:54:53 -0700 Subject: [PATCH 08/10] Finish changes for multistream --- multiple-streams/README.md | 132 +++++++++++++++--- multiple-streams/instructions/0-intro.md | 45 ++++++ .../instructions/2-lambda-function.md | 2 +- 3 files changed, 160 insertions(+), 19 deletions(-) diff --git a/multiple-streams/README.md b/multiple-streams/README.md index 13d336e..98163c3 100644 --- a/multiple-streams/README.md +++ b/multiple-streams/README.md @@ -7,29 +7,125 @@ The Alexa Skills Kit now allows developers to build skills that play long-form audio content on Alexa devices. This sample project demonstrates how to use the new interfaces for triggering playback of audio and handling audio player input events. -To follow this tutorial, work through the [instructions](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/multiple-streams/instructions/1-voice-user-interface.md) to create your audio player skill. +

+ +

-## How it Works -Alexa Skills Kit now includes a set of output directives and input events that allow you to control the playback of audio files or streams. There are a few important concepts to get familiar with: +Be sure to take a look at the [Additional Resources](#additional-resources) at the bottom of this page! -* **AudioPlayer directives** are used by your skill to start and stop audio playback from content hosted at a publicly accessible secure URL. You send AudioPlayer directives in response to the intents you've configured for your skill, or new events you'll receive when a user controls their device with a dedicated controller (see PlaybackController events below). -* **PlaybackController events** are sent to your skill when a user selects play/next/prev/pause on dedicated hardware controls on the Alexa device, such as on the Amazon Tap or the Voice Remote for Amazon Echo and Echo Dot. Your skill receives these events if your skill is currently controlling audio on the device (i.e., you were the last to send an AudioPlayer directive). -* **AudioPlayer events** are sent to your skill at key changes in the status of audio playback, such as when audio has begun playing, been stopped or has finished. You can use them to track what's currently playing or queue up more content. Unlike intents, when you receive an AudioPlayer event, you may only respond with appropriate AudioPlayer directives to control playback. -The sample project plays a pre-defined list of audio content defined in `js/audioAssets.js`, allowing the user to control playback with a range of custom and built-in intents. It's organized into several modules: +## About +**Note:** The rest of this readme assumes you have your developer environment ready to go and that you have some familiarity with CLI (Command Line Interface) Tools, [AWS](https://aws.amazon.com/), and the [ASK Developer Portal](https://developer.amazon.com/alexa-skills-kit). If not, [click here](./instructions/0-intro.md) for a more detailed walkthrough. -* `index.js` is the main module that handles events from Alexa. In the sample project, we setup the skill and register handlers defined in seperate modules. -* `constants.js` holds a few constants like the Application ID of the skill and the name of a table in DynamoDB the skill will use to store details about what each user has played. -* `audioAssets.js` is a list of audio content the skill will play from. -* `stateHandlers.js` is where the skill handles voice intent and playback control commands. It registers handlers for each of the input events in different states the skill can be in, and defines a `controller` that centralizes the handler code since we perform the same action for several different input events (e.g., we do the same thing when the user tells the skill to stop or if the stop button is pressed on the device). The sample project define three states: - * **START_MODE** is the default state of the skill, such as when it's invoked without an intent for the first time. - * **PLAY_MODE** is used when audio is currently being played by the skill. - * **RESUME_DECISION_MODE** is used to handle the response from the user when they're asked to confirm they'd like to resume playback from a prior use of the skill. -* `audioEventHandlers.js` is where the skill handles AudioPlayer events. These events are only expected in the PLAY_MODE state and are used to track the user's progress through the content. -You can learn more about the new [AudioPlayer interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference) and [PlaybackController interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-playbackcontroller-interface-reference). - +### Usage - +```text +Alexa, open podcast player. + >> Welcome to the AWS Podcast. You can say, play the audio to begin the podcast.. + +Alexa, ask podcast player to play the audio. +``` + +### Repository Contents +* `/.ask` - [ASK CLI (Command Line Interface) Configuration](https://developer.amazon.com/docs/smapi/ask-cli-intro.html) +* `/lambda/custom` - Back-End Logic for the Alexa Skill hosted on [AWS Lambda](https://aws.amazon.com/lambda/) +* `/models` - Voice User Interface and Language Specific Interaction Models +* `/instructions` - Step-by-Step Instructions for Getting Started +* `skill.json` - [Skill Manifest](https://developer.amazon.com/docs/smapi/skill-manifest.html) + +## Setup w/ ASK CLI + +### Pre-requisites + +* Node.js (> v4.3) +* Register for an [AWS Account](https://aws.amazon.com/) +* Register for an [Amazon Developer Account](https://developer.amazon.com/) +* Install and Setup [ASK CLI](https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html) + +### Installation +1. Clone the repository. + + ```bash + $ git clone https://github.com/alexa/skill-sample-nodejs-audio-player/multiple-streams/ + ``` + +2. Initiatialize the [ASK CLI](https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html) by Navigating into the repository and running npm command: `ask init`. Follow the prompts. + + ```bash + $ cd skill-sample-nodejs-audio-player/multiple-streams/ + $ ask init + ``` + +3. Install npm dependencies by navigating into the `/lambda` directory and running the npm command: `npm install` + + ```bash + $ cd lambda/custom + $ npm install + ``` + + +### Deployment + +ASK CLI will create the skill and the lambda function for you. The Lambda function will be created in ```us-east-1 (Northern Virginia)``` by default. + +1. Deploy the skill and the lambda function in one step by running the following command: + + ```bash + $ ask deploy + ``` + +### Testing + +1. To test, you need to login to Alexa Developer Console, and enable the "Test" switch on your skill from the "Test" Tab. + +2. Simulate verbal interaction with your skill through the command line using the following example: + + ```bash + $ ask simulate -l en-US -t "alexa, start podcast player" + + ✓ Simulation created for simulation id: 4a7a9ed8-94b2-40c0-b3bd-fb63d9887fa7 + ◡ Waiting for simulation response{ + "status": "SUCCESSFUL", + ... + ``` + +3. Once the "Test" switch is enabled, your skill can be tested on devices associated with the developer account as well. Speak to Alexa from any enabled device, from your browser at [echosim.io](https://echosim.io/welcome), or through your Amazon Mobile App and say : + + ```text + Alexa, start podcast player + ``` + +## Customization + +1. ```./skill.json``` + + Change the skill name, example phrase, icons, testing instructions etc ... + + Remember that many information is locale-specific and must be changed for each locale (en-GB and en-US) + + See the Skill [Manifest Documentation](https://developer.amazon.com/docs/smapi/skill-manifest.html) for more information. + +2. ```./lambda/custom/index.js``` + + Modify messages, and facts from the source code to customize the skill. + +3. ```./models/*.json``` + + Change the model definition to replace the invocation name and the sample phrase for each intent. Repeat the operation for each locale you are planning to support. + +## Additional Resources + +### Community +* [Amazon Developer Forums](https://forums.developer.amazon.com/spaces/165/index.html) - Join the conversation! +* [Hackster.io](https://www.hackster.io/amazon-alexa) - See what others are building with Alexa. + +### Tutorials & Guides +* [Voice Design Guide](https://developer.amazon.com/designing-for-voice/) - A great resource for learning conversational and voice user interface design. +* [CodeAcademy: Learn Alexa](https://www.codecademy.com/learn/learn-alexa) - Learn how to build an Alexa Skill from within your browser with this beginner friendly tutorial on CodeAcademy! + +###Documentation +* [Official Alexa Skills Kit Node.js SDK](https://www.npmjs.com/package/alexa-sdk) - The Official Node.js SDK Documentation +* [Official Alexa Skills Kit Documentation](https://developer.amazon.com/docs/ask-overviews/build-skills-with-the-alexa-skills-kit.html) - Official Alexa Skills Kit Documentation diff --git a/multiple-streams/instructions/0-intro.md b/multiple-streams/instructions/0-intro.md index e69de29..9a10d81 100644 --- a/multiple-streams/instructions/0-intro.md +++ b/multiple-streams/instructions/0-intro.md @@ -0,0 +1,45 @@ +# Build An Alexa Fact Skill + + +[![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-off._TTH_.png)](1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](6-publication.md) + +## What You Will Learn +* [AWS Lambda](http://aws.amazon.com/lambda) +* [Alexa Skills Kit (ASK)](https://developer.amazon.com/alexa-skills-kit) +* Voice User Interface (VUI) Design +* Skill Certification +* State Management +* [Speechcons](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speechcon-reference) + +## What You Will Need +* [Amazon Developer Portal Account](http://developer.amazon.com) +* [Amazon Web Services Account](http://aws.amazon.com/) +* The sample code on [GitHub](https://github.com/alexa/skill-sample-nodejs-quiz-game). +* Simple graphical editing tool +* At least 25 rows of interesting data to quiz your users with. + * Examples: [U.S. States](.data/states.js), [Video Games](.data/videogames.js), [Books](data/books.js), [British Monarchs](data/monarchs.js) + +## How it Works + +Alexa Skills Kit now includes a set of output directives and input events that allow you to control the playback of audio files or streams. There are a few important concepts to get familiar with: + +* **AudioPlayer directives** are used by your skill to start and stop audio playback from content hosted at a publicly accessible secure URL. You send AudioPlayer directives in response to the intents you've configured for your skill, or new events you'll receive when a user controls their device with a dedicated controller (see PlaybackController events below). +* **PlaybackController events** are sent to your skill when a user selects play/next/prev/pause on dedicated hardware controls on the Alexa device, such as on the Amazon Tap or the Voice Remote for Amazon Echo and Echo Dot. Your skill receives these events if your skill is currently controlling audio on the device (i.e., you were the last to send an AudioPlayer directive). +* **AudioPlayer events** are sent to your skill at key changes in the status of audio playback, such as when audio has begun playing, been stopped or has finished. You can use them to track what's currently playing or queue up more content. Unlike intents, when you receive an AudioPlayer event, you may only respond with appropriate AudioPlayer directives to control playback. + +The sample project plays a pre-defined list of audio content defined in `js/audioAssets.js`, allowing the user to control playback with a range of custom and built-in intents. It's organized into several modules: + +* `index.js` is the main module that handles events from Alexa. In the sample project, we setup the skill and register handlers defined in seperate modules. +* `constants.js` holds a few constants like the Application ID of the skill and the name of a table in DynamoDB the skill will use to store details about what each user has played. +* `audioAssets.js` is a list of audio content the skill will play from. +* `stateHandlers.js` is where the skill handles voice intent and playback control commands. It registers handlers for each of the input events in different states the skill can be in, and defines a `controller` that centralizes the handler code since we perform the same action for several different input events (e.g., we do the same thing when the user tells the skill to stop or if the stop button is pressed on the device). The sample project define three states: + * **START_MODE** is the default state of the skill, such as when it's invoked without an intent for the first time. + * **PLAY_MODE** is used when audio is currently being played by the skill. + * **RESUME_DECISION_MODE** is used to handle the response from the user when they're asked to confirm they'd like to resume playback from a prior use of the skill. +* `audioEventHandlers.js` is where the skill handles AudioPlayer events. These events are only expected in the PLAY_MODE state and are used to track the user's progress through the content. + +You can learn more about the new [AudioPlayer interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference) and [PlaybackController interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-playbackcontroller-interface-reference). + + + + diff --git a/multiple-streams/instructions/2-lambda-function.md b/multiple-streams/instructions/2-lambda-function.md index b40985e..f53ace0 100644 --- a/multiple-streams/instructions/2-lambda-function.md +++ b/multiple-streams/instructions/2-lambda-function.md @@ -8,7 +8,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a First, clone the project and package the skill: ```bash git clone https://github.com/alexa/skill-sample-nodejs-audio-player.git -cd skill-sample-nodejs-audio-player/multiple-streams/js +cd skill-sample-nodejs-audio-player/multiple-streams/ npm install zip -r ../audio-player.zip * ``` From 76236f6aa8d0c27d123d8b177816a281821c9666 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Wed, 13 Dec 2017 11:06:46 -0700 Subject: [PATCH 09/10] Update CLI and Lambda instructions for single --- single-stream/README.md | 200 +++++++----------- single-stream/instructions/0-intro.md | 20 ++ .../instructions/2-lambda-function.md | 39 ++-- 3 files changed, 115 insertions(+), 144 deletions(-) create mode 100644 single-stream/instructions/0-intro.md diff --git a/single-stream/README.md b/single-stream/README.md index 2063cca..473d20a 100644 --- a/single-stream/README.md +++ b/single-stream/README.md @@ -3,173 +3,127 @@ [![Voice User Interface](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/1-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md)[![Lambda Function](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/2-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/2-lambda-function.md)[![Connect VUI to Code](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/3-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/3-connect-vui-to-code.md)[![Testing](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/4-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/4-testing.md)[![Customization](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/5-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/5-customization.md)[![Publication](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/navigation/6-off._TTH_.png)](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/6-publication.md) +# Streaming Audio Player Sample Project -# Single Stream Audio Skill (My Radio) +The Alexa Skills Kit now allows developers to build skills that play long-form audio content on Alexa devices. This sample project demonstrates how to use the new interfaces for triggering an audio stream. -This skill demonstrates how to create a single stream audio skill. Single stream skills are typically used by radio stations to provide a convenient and quick access to their live stream. +

+ +

-User interface is limited to Play and Stop use cases. -## Usage +Be sure to take a look at the [Additional Resources](#additional-resources) at the bottom of this page! -```text -Alexa, play my radio - -Alexa, stop -``` - -Work through these [instructions](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md) to build the audio skill. - - +### Community +* [Amazon Developer Forums](https://forums.developer.amazon.com/spaces/165/index.html) - Join the conversation! +* [Hackster.io](https://www.hackster.io/amazon-alexa) - See what others are building with Alexa. - +### Tutorials & Guides +* [Voice Design Guide](https://developer.amazon.com/designing-for-voice/) - A great resource for learning conversational and voice user interface design. +* [CodeAcademy: Learn Alexa](https://www.codecademy.com/learn/learn-alexa) - Learn how to build an Alexa Skill from within your browser with this beginner friendly tutorial on CodeAcademy! - +###Documentation +* [Official Alexa Skills Kit Node.js SDK](https://www.npmjs.com/package/alexa-sdk) - The Official Node.js SDK Documentation +* [Official Alexa Skills Kit Documentation](https://developer.amazon.com/docs/ask-overviews/build-skills-with-the-alexa-skills-kit.html) - Official Alexa Skills Kit Documentation diff --git a/single-stream/instructions/0-intro.md b/single-stream/instructions/0-intro.md new file mode 100644 index 0000000..f7063e6 --- /dev/null +++ b/single-stream/instructions/0-intro.md @@ -0,0 +1,20 @@ +# Single Stream Audio Skill (My Radio) + +This skill demonstrates how to create a single stream audio skill. Single stream skills are typically used by radio stations to provide a convenient and quick access to their live stream. + +User interface is limited to Play and Stop use cases. + +## Usage + +```text +Alexa, play my radio + +Alexa, stop +``` + +Work through these [instructions](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/instructions/1-voice-user-interface.md) to build the audio skill. + + + + + diff --git a/single-stream/instructions/2-lambda-function.md b/single-stream/instructions/2-lambda-function.md index e2ab0f7..0e84942 100644 --- a/single-stream/instructions/2-lambda-function.md +++ b/single-stream/instructions/2-lambda-function.md @@ -21,39 +21,36 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a -5. **Choose the blueprint named "alexa-skill-kit-sdk-factskill".** We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself. +5. **There are two boxes labeled "Author from scratch" and "Blueprints". Click the radio button in the box titled "Blueprints" then choose the blueprint named "alexa-skill-kit-sdk-factskill".** We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself. - + -6. **Configure your trigger.** Click in the dashed box, and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. +6. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "MyRadio" is sufficient if you don't have another idea for a name. - + - Once you have selected Alexa Skills Kit, click the **Next** button. +7. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." -7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "MinecraftHelper" is sufficient if you don't have another idea for a name. - - - -8. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-player/blob/master/single-stream/lambda/custom/index.js). Delete the contents of the code box, and paste the contents of the new code. + -9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution." +8. **Click Create Function in the bottom right corner.** You will need to scroll down to find **Create Function.** - + -10. **For this guide, you can skip all of the Advanced settings.** Click the **Next** button to move to the Review screen. +9. **After you create the function, the ARN value appears in the top right corner. Copy this value for use in the next section of the guide.** - + -11. **The Review screen is a summary of your choices. Click Create Function in the bottom left corner.** You will need to scroll down to find **Create Function.** +10. **Configure your trigger.** Look at the column on the left called "Add triggers", and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. - + -12. **After you create the function, the ARN value appears in the top right corner. Copy this value for use in the next section of the guide.** + Once you have selected Alexa Skills Kit, scroll down and click the **Add** button. Then click the **Save** button in the top right. You should see a green success message at the top of your screen. Now, click the box that has the Lambda icon followed by the name of your function (MyRadio if you used our suggestion) and scroll down to the field called "Function code". - +7. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-layer/single-stream/blob/master/lambda/src/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-layer/single-stream/blob/master/lambda/src/index.js). Delete the contents of the code box, and paste the contents of the new code. +Click "Save". -

- +

+ - + From faf1273da75ab340ce4b9484659d2fd6b3326060 Mon Sep 17 00:00:00 2001 From: Jake Kelly Date: Wed, 20 Dec 2017 16:16:25 -0800 Subject: [PATCH 10/10] Fix CLI instructions and fix MD --- single-stream/README.md | 4 ++-- single-stream/instructions/2-lambda-function.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/single-stream/README.md b/single-stream/README.md index 473d20a..983037c 100644 --- a/single-stream/README.md +++ b/single-stream/README.md @@ -57,7 +57,7 @@ Alexa, open my radio. $ ask init ``` -3. Install npm dependencies by navigating into the `/lambda` directory and running the npm command: `npm install` +3. Install npm dependencies by navigating into the `/lambda/custom` directory and running the npm command: `npm install` ```bash $ cd lambda/custom @@ -82,7 +82,7 @@ ASK CLI will create the skill and the lambda function for you. The Lambda functi 2. Simulate verbal interaction with your skill through the command line using the following example: ```bash - $ ask simulate -l en-US -t "alexa, start my radio" + $ ask simulate -l en-US -t "start my radio" ✓ Simulation created for simulation id: 4a7a9ed8-94b2-40c0-b3bd-fb63d9887fa7 ◡ Waiting for simulation response{ diff --git a/single-stream/instructions/2-lambda-function.md b/single-stream/instructions/2-lambda-function.md index 0e84942..88259ba 100644 --- a/single-stream/instructions/2-lambda-function.md +++ b/single-stream/instructions/2-lambda-function.md @@ -39,7 +39,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a 9. **After you create the function, the ARN value appears in the top right corner. Copy this value for use in the next section of the guide.** - + 10. **Configure your trigger.** Look at the column on the left called "Add triggers", and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page. @@ -47,7 +47,7 @@ In the [first step of this guide](https://github.com/alexa/skill-sample-nodejs-a Once you have selected Alexa Skills Kit, scroll down and click the **Add** button. Then click the **Save** button in the top right. You should see a green success message at the top of your screen. Now, click the box that has the Lambda icon followed by the name of your function (MyRadio if you used our suggestion) and scroll down to the field called "Function code". -7. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-layer/single-stream/blob/master/lambda/src/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-layer/single-stream/blob/master/lambda/src/index.js). Delete the contents of the code box, and paste the contents of the new code. +11. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-audio-layer/single-stream/blob/master/lambda/src/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-audio-layer/single-stream/blob/master/lambda/src/index.js). Delete the contents of the code box, and paste the contents of the new code. Click "Save".