diff --git a/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java b/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java index 28fea2c..feb8db7 100644 --- a/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java +++ b/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java @@ -49,12 +49,6 @@ public class GithubDataGrabber { System.out.println(TEMPLATES.get("java").getValue0()); System.out.println(TEMPLATES.get("java").getValue1()); -// github.createRepository("theoneandonlytest") -// .fromTemplateRepository( -// TEMPLATES.get("java").getValue0(), -// TEMPLATES.get("java").getValue1() -// ).create(); - } public Set getLanguages() throws IOException { diff --git a/skill-package/interactionModels/custom/en-GB.json b/skill-package/interactionModels/custom/en-GB.json index bce9d96..97ada0d 100644 --- a/skill-package/interactionModels/custom/en-GB.json +++ b/skill-package/interactionModels/custom/en-GB.json @@ -72,6 +72,8 @@ } ], "samples": [ + "give me a new repository in {language} called {title} .", + "create me a new repo", "make me a new {language} repo", "make me a new {language} repository", "create a repository in {language} called {title}", @@ -103,17 +105,17 @@ }, { "name": { - "value": "Shell" + "value": "shell" } }, { "name": { - "value": "Typescript" + "value": "typescript" } }, { "name": { - "value": "Kotlin" + "value": "kotlin" } }, { @@ -123,12 +125,12 @@ }, { "name": { - "value": "Elm" + "value": "elm" } }, { "name": { - "value": "Scala" + "value": "scala" } }, { @@ -138,7 +140,7 @@ }, { "name": { - "value": "Java" + "value": "java" } } ] @@ -729,6 +731,10 @@ { "id": "Elicit.Slot.1247776455707.488691447960", "variations": [ + { + "type": "PlainText", + "value": "in which language" + }, { "type": "PlainText", "value": "Which language do you need" diff --git a/slides/hey-google-javaland.pdf b/slides/hey-google-javaland.pdf index 73c11b4..6459652 100644 Binary files a/slides/hey-google-javaland.pdf and b/slides/hey-google-javaland.pdf differ diff --git a/test-javaland/CODE_OF_CONDUCT.md b/test-javaland/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..5b627cf --- /dev/null +++ b/test-javaland/CODE_OF_CONDUCT.md @@ -0,0 +1,4 @@ +## Code of Conduct +This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). +For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact +opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/test-javaland/CONTRIBUTING.md b/test-javaland/CONTRIBUTING.md new file mode 100644 index 0000000..4b4c981 --- /dev/null +++ b/test-javaland/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contributing Guidelines + +Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional +documentation, we greatly value feedback and contributions from our community. + +Please read through this document before submitting any issues or pull requests to ensure we have all the necessary +information to effectively respond to your bug report or contribution. + + +## Reporting Bugs/Feature Requests + +We welcome you to use the GitHub issue tracker to report bugs or suggest features. + +When filing an issue, please check [existing open](https://github.com/alexa/skill-sample-java-premium-hello-world/issues), or [recently closed](https://github.com/alexa/skill-sample-java-premium-hello-world/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already +reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: + +* A reproducible test case or series of steps +* The version of our code being used +* Any modifications you've made relevant to the bug +* Anything unusual about your environment or deployment + + +## Contributing via Pull Requests +Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: + +1. You are working against the latest source on the *master* branch. +2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. +3. You open an issue to discuss any significant work - we would hate for your time to be wasted. + +To send us a pull request, please: + +1. Fork the repository. +2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. +3. Ensure local tests pass. +4. Commit to your fork using clear commit messages. +5. Send us a pull request, answering any default questions in the pull request interface. +6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. + +GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and +[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). + + +## Finding contributions to work on +Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/alexa/skill-sample-java-premium-hello-world/labels/help%20wanted) issues is a great place to start. + + +## Code of Conduct +This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). +For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact +opensource-codeofconduct@amazon.com with any additional questions or comments. + + +## Security issue notifications +If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. + + +## Licensing + +See the [LICENSE](https://github.com/alexa/skill-sample-java-premium-hello-world/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. + +We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. diff --git a/test-javaland/LICENSE b/test-javaland/LICENSE new file mode 100644 index 0000000..44b3db7 --- /dev/null +++ b/test-javaland/LICENSE @@ -0,0 +1,96 @@ +Amazon Software License 1.0 + +This Amazon Software License ("License") governs your use, reproduction, and +distribution of the accompanying software as specified below. + +1. Definitions + + "Licensor" means any person or entity that distributes its Work. + + "Software" means the original work of authorship made available under this + License. + + "Work" means the Software and any additions to or derivative works of the + Software that are made available under this License. + + The terms "reproduce," "reproduction," "derivative works," and + "distribution" have the meaning as provided under U.S. copyright law; + provided, however, that for the purposes of this License, derivative works + shall not include works that remain separable from, or merely link (or bind + by name) to the interfaces of, the Work. + + Works, including the Software, are "made available" under this License by + including in or with the Work either (a) a copyright notice referencing the + applicability of this License to the Work, or (b) a copy of this License. + +2. License Grants + + 2.1 Copyright Grant. Subject to the terms and conditions of this License, + each Licensor grants to you a perpetual, worldwide, non-exclusive, + royalty-free, copyright license to reproduce, prepare derivative works of, + publicly display, publicly perform, sublicense and distribute its Work and + any resulting derivative works in any form. + + 2.2 Patent Grant. Subject to the terms and conditions of this License, each + Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free + patent license to make, have made, use, sell, offer for sale, import, and + otherwise transfer its Work, in whole or in part. The foregoing license + applies only to the patent claims licensable by Licensor that would be + infringed by Licensor's Work (or portion thereof) individually and + excluding any combinations with any other materials or technology. + +3. Limitations + + 3.1 Redistribution. You may reproduce or distribute the Work only if + (a) you do so under this License, (b) you include a complete copy of this + License with your distribution, and (c) you retain without modification + any copyright, patent, trademark, or attribution notices that are present + in the Work. + + 3.2 Derivative Works. You may specify that additional or different terms + apply to the use, reproduction, and distribution of your derivative works + of the Work ("Your Terms") only if (a) Your Terms provide that the use + limitation in Section 3.3 applies to your derivative works, and (b) you + identify the specific derivative works that are subject to Your Terms. + Notwithstanding Your Terms, this License (including the redistribution + requirements in Section 3.1) will continue to apply to the Work itself. + + 3.3 Use Limitation. The Work and any derivative works thereof only may be + used or intended for use with the web services, computing platforms or + applications provided by Amazon.com, Inc. or its affiliates, including + Amazon Web Services, Inc. + + 3.4 Patent Claims. If you bring or threaten to bring a patent claim against + any Licensor (including any claim, cross-claim or counterclaim in a + lawsuit) to enforce any patents that you allege are infringed by any Work, + then your rights under this License from such Licensor (including the + grants in Sections 2.1 and 2.2) will terminate immediately. + + 3.5 Trademarks. This License does not grant any rights to use any + Licensor's or its affiliates' names, logos, or trademarks, except as + necessary to reproduce the notices described in this License. + + 3.6 Termination. If you violate any term of this License, then your rights + under this License (including the grants in Sections 2.1 and 2.2) will + terminate immediately. + +4. Disclaimer of Warranty. + + THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR + NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER + THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN + IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU. + +5. Limitation of Liability. + + EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL + THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE + SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, + INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR + RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK (INCLUDING + BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS + OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER COMM ERCIAL DAMAGES + OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF + SUCH DAMAGES. diff --git a/test-javaland/NOTICE b/test-javaland/NOTICE new file mode 100644 index 0000000..c257be9 --- /dev/null +++ b/test-javaland/NOTICE @@ -0,0 +1,2 @@ +Skill Sample Java Premium Hello World +Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/test-javaland/README.md b/test-javaland/README.md new file mode 100755 index 0000000..3ee3d36 --- /dev/null +++ b/test-javaland/README.md @@ -0,0 +1,34 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + +Adding premium content to your skill is a way for you to monetize your skill. This Alexa sample skill is a template for a basic ISP skill. It takes the hello world skill and adds greetings in a variety of languages as premium content. This premium content is accessed through a one-time purchase of the "Premium Greeting Pack". This guide walks through the setup of this skill, including the creation of the in-skill products. + +## License + +This library is licensed under the Amazon Software License. + +## Skill Architecture +Each skill consists of two basic parts, a front end and a back end. +1. The front end is the voice interface, or VUI. The voice interface is configured through the voice interaction model. +2. The back end is where the logic of your skill resides. + +## Skill Setup (AWS Hosted) +In this sample skill, we will be deploying the skill to [Lambda](http://aws.amazon.com/lambda) function using [Amazon Web Services](http://aws.amazon.com) + +To **Get Started** using the Alexa Developer Console, click the button below: + +[![Get Started](./getting-started.png)](./instructions/1-setup-vui-aws-hosted.md) + +## 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. +* [Codecademy: 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 Codecademy! + +### Documentation +* [Official Alexa Skills Kit SDK for Java](https://github.com/alexa/alexa-skills-kit-sdk-for-java) - The Official Java 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/test-javaland/ask-resources.json b/test-javaland/ask-resources.json new file mode 100644 index 0000000..d08df24 --- /dev/null +++ b/test-javaland/ask-resources.json @@ -0,0 +1,23 @@ +{ + "askcliResourcesVersion": "2020-03-31", + "profiles": { + "default": { + "skillMetadata": { + "src": "./skill-package" + }, + "code": { + "default": { + "src": "./lambda" + } + }, + "skillInfrastructure": { + "userConfig": { + "runtime": "java8", + "handler": "com.amazon.ask.helloworld.HelloWorldStreamHandler", + "awsRegion": "eu-west-1" + }, + "type": "@ask-cli/lambda-deployer" + } + } + } +} \ No newline at end of file diff --git a/test-javaland/getting-started.png b/test-javaland/getting-started.png new file mode 100755 index 0000000..ee1a3fa Binary files /dev/null and b/test-javaland/getting-started.png differ diff --git a/test-javaland/instructions/1-setup-vui-aws-hosted.md b/test-javaland/instructions/1-setup-vui-aws-hosted.md new file mode 100755 index 0000000..59b8908 --- /dev/null +++ b/test-javaland/instructions/1-setup-vui-aws-hosted.md @@ -0,0 +1,35 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + + +1. **Go to the [Amazon Developer Portal](https://developer.amazon.com/alexa/console/ask). 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.) + +2. Once you have signed in, move your mouse over the **Your Alexa Consoles** text at the top of the screen and Select the **Skills** Link. + +3. From the **Alexa Skills Console** select the **Create Skill** button near the top-right of the list of your Alexa Skills. + +4. Give your new skill a **Name**. This is the name that will be shown in the Alexa Skills Store, and the name your users will refer to. Also change the locale if so desired. + +5. Select the **Custom** model button to add it to your skill, and select the **Create Skill** button at the top right. + +6. **Build the Interaction Model for your skill** + 1. On the left hand navigation panel, select the **JSON Editor** tab under **Interaction Model**. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](../../skill-sample-java-premium-hello-world/models) (make sure to pick the model that matches your skill's language). Click **Save Model**. + 2. If you want to change the skill invocation name, select the **Invocation** tab. Enter a **Skill Invocation Name**. This is the name that your users will need to say to start your skill. + 3. Click "Build Model". + + **Note:** You should notice that **Intents** and **Slot Types** will auto populate based on the JSON Interaction Model that you have now applied to your skill. Feel free to explore the changes here, to learn about **Intents**, **Slots**, and **Utterances** open our [technical documentation in a new tab](https://developer.amazon.com/docs/custom-skills/create-intents-utterances-and-slots.html?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-1&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-1_Convert_WW_beginnersdevs&sc_segment=beginnersdevs). + +7. **Optional:** Select an intent by expanding the **Intents** from the left side navigation panel. Add some more sample utterances for your newly generated intents. Think of all the different ways that a user could request to make a specific intent happen. A few examples are provided. Be sure to click **Save Model** and **Build Model** after you're done making changes here. + +8. If your interaction model builds successfully, proceed to the next step. If not, you should see an error. Try to resolve the errors. +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 again. + + + If you get an error from your interaction model, check through this list: + + * **Did you copy and paste the provided code correctly?** + * **Did you accidentally add any characters to the Interaction Model or Sample Utterances?** + +[![Next](./next.png)](2-create-aws-hosted-function.md) + diff --git a/test-javaland/instructions/2-create-aws-hosted-function.md b/test-javaland/instructions/2-create-aws-hosted-function.md new file mode 100755 index 0000000..470b589 --- /dev/null +++ b/test-javaland/instructions/2-create-aws-hosted-function.md @@ -0,0 +1,14 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + +## Setting Up A Lambda Function Using Amazon Web Services + +In the [first step of this guide](1-setup-vui-aws-hosted.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. + +Refer to [Hosting a Custom Skill as an AWS Lambda Function](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html) reference for a walkthrough on creating a AWS Lambda function with the correct role for your skill. When creating the function, select the “Author from scratch” option, and select the Java 8 runtime. + +To build the sample, open a terminal and go to the directory containing pom.xml, and run 'mvn org.apache.maven.plugins:maven-assembly-plugin:2.6:assembly -DdescriptorId=jar-with-dependencies package'. This will generate a zip file named "premium-hello-world-1.0-jar-with-dependencies.jar" in the target directory. + +Once you've created your AWS Lambda function and configured “Alexa Skills Kit” as a trigger, upload the JAR file produced from above and set the handler to the fully qualified class name of your handler function. Finally, copy the ARN for your AWS Lambda function because you’ll need it when configuring your skill in the [Amazon Developer Portal](https://developer.amazon.com/alexa/console/ask). + +[![Next](./next.png)](./3-create-isp.md) \ No newline at end of file diff --git a/test-javaland/instructions/3-create-isp.md b/test-javaland/instructions/3-create-isp.md new file mode 100755 index 0000000..d2fec0d --- /dev/null +++ b/test-javaland/instructions/3-create-isp.md @@ -0,0 +1,85 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + +# Create In-Skill Products + +On [page #1](./1-setup-vui-aws-hosted.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](./2-create-aws-hosted-function.md), we created the AWS Hosted Lambda function that contains all of our logic for the skill. Now we will create the in-skill products that customers can purchase. + +This sample implements a "One-Time Purchase" product called "Greeting Pack", which provides greetings in a variety of languages as premium content, and a monthly subscription called "Premium Subscription", which greets the customer using a variety of voices using Amazon Polly. + + +1. Create a "One-Time Purchase" +2. Create a "Subscription" + + +## Create a "One-Time Purchase" +1. Navigate to the Monetization Tool by clicking on the **In-Skill Products** section while on the **Build** tab of the Developer Console. + > If you cannot see the correct section in the left nav, click on the **Permissions** section, then click on **In-Skill Products**. +1. Click **Create in-skill product**. +1. Enter a Reference name. This is code-friendly name you want to assign to your in-skill product. For this sample, the code is expecting the reference name `Greetings_Pack`. + > Be sure to enter all the reference names exactly as provided. They are used in the sample code and it won't work properly if the name does not match exactly. +1. Choose **One-Time Purchase**. +1. Click **Create in-skill product**. +1. On the **Distribution** sub-section, enter the following details for the subscription: + + Field|Description|Value for Sample + -----|-----------|------------------ + **Display Name**|The display name of the product. Customers will see and hear this. | Greetings Pack + **One sentence description**| Summary description of the product. Customers will hear this. | The Greetings Pack says hello in a variety of languages like French, Spanish, Hindi, and more. + **Detailed Description**|A full description explaining the product's functionality and any prerequisites to using it. Customers will see this.| The Greetings Pack says hello in a variety of languages like French, Spanish, Hindi, and more. + **Example Phrases**| Example phrases customers can use to access your in-skill products. You should populate all three examples. | say hello in other languages, give me the special greeting, get greetings pack + **Small Icon**| Small icon used with product when displayed in the skill store or Alexa app. You can use this placeholder icon if you don't have an image you would like to use. | https://s3.amazonaws.com/ask-samples-resources/icons/moneyicon_108.png + **Large Icon**| Large icon used with product when displayed in the skill store or Alexa app. You can use this placeholder icon if you don't have an image you would like to use. | https://s3.amazonaws.com/ask-samples-resources/icons/moneyicon_512.png + **Keywords** | Keywords that will be used with search. | greetings + **Purchase prompt description**| The description of the product a customer hears when making a purchase or when they cancel a subscription.| The Greetings Pack says hello in a variety of languages like French, Spanish, Hindi, and more. + **Purchase confirmation description**|A description of the product that displays on the skill card in the Alexa app. Customers will see this. | You now have the Greetings Pack, which says hello in a variety of languages like French, Spanish, Hindi, and more. + **Privacy Policy URL**|A URL to the privacy policy for this locale. For this sample, we'll use a placeholder value. |https://localhost/privacy.html + + > Need help creating icons for your ISP or skill? Check out the [Alexa Skill Icon Builder](https://developer.amazon.com/docs/tools/icon-builder.html) + +1. Click **Save and continue**. +1. On the **Pricing** sub-section, the default values (amazon.com, $0.99 USD, releasing "today") are fine for the sample, however you can change the values if you like. +1. Set the **Tax Category** to 'Information Services'. This is suitable for this sample, however you should consult your tax professional for guidance on what to choose for this value. The available options are listed [here](https://developer.amazon.com/docs/in-skill-purchase/3-create-isp-dev-console.html#tax-category) +1. Click **Save and continue**. +1. Normally you would provide testing instructions to help the certification team find and test your in-skill product. (These testing instructions are specific to this in-skill product, and are in addition to the skill testing instructions you will provide on the **Certification** tab.) We're going to leave them blank for now. +1. Click **Save and finish**. +1. If you've provided all the necessary information, you will be able to click **Link to skill** which will link this in-skill product with your skill. If that's not an option, click **Continue** and then go back and fill in any missing information. +1. Congrats! You have added a "One-time Purchase" product to your skill. Now you are ready to test! + +> Before leaving the In-skill Products page, take a note of the links which say **Reset test purchases**. During testing if you want to 'un-buy' one of your products so you can re-buy it, click on these links. + +## Create a "Subscription" +1. Navigate to the Monetization Tool by clicking on the **In-Skill Products** section while on the **Build** tab of the Developer Console. + > If you cannot see the correct section in the left nav, click on the **Permissions** section, then click on **In-Skill Products**. +1. Click **Create in-skill product**. +1. Enter a Reference name. This is code-friendly name you want to assign to your in-skill product. For this sample, the code is expecting the reference name `Premium_Subscription`. + > Be sure to enter all the reference names exactly as provided. They are used in the sample code and it won't work properly if the name does not match exactly. +1. Choose **Subscription**. +1. Click **Create in-skill product**. +1. On the **Distribution** sub-section, enter the following details for the subscription: + + Field|Description|Value for Sample + -----|-----------|------------------ + **Display Name**|The display name of the product. Customers will see and hear this. | Premium Subscription + **One sentence description**| Summary description of the product. Customers will hear this. | The Premium Subscription greets the user in a variety of voices. + **Detailed Description**|A full description explaining the product's functionality and any prerequisites to using it. Customers will see this.| The Premium Subscription Pack unlocks the magic of Polly Voice, and greets you in a variety of languages, like hindi, spanish, italian, and more. + **Example Phrases**| Example phrases customers can use to access your in-skill products. You should populate all three examples. | Surprise me, switch personality + **Small Icon**| Small icon used with product when displayed in the skill store or Alexa app. You can use this placeholder icon if you don't have an image you would like to use. | https://s3.amazonaws.com/ask-samples-resources/icons/moneyicon_108.png + **Large Icon**| Large icon used with product when displayed in the skill store or Alexa app. You can use this placeholder icon if you don't have an image you would like to use. | https://s3.amazonaws.com/ask-samples-resources/icons/moneyicon_512.png + **Keywords** | Keywords that will be used with search. | personality,polly,voice + **Purchase prompt description**| The description of the product a customer hears when making a purchase or when they cancel a subscription.| The Premium Subscription Pack unlocks the magic of Polly Voice, and greets you in a variety of languages using Amazon Polly. + **Purchase confirmation description**|A description of the product that displays on the skill card in the Alexa app. Customers will see this. | You now have the Premium Subscription, which will greet you in multiple languages in a variety of voices using Amazon Polly. + **Privacy Policy URL**|A URL to the privacy policy for this locale. For this sample, we'll use a placeholder value. |https://localhost/privacy.html + + > Need help creating icons for your ISP or skill? Check out the [Alexa Skill Icon Builder](https://developer.amazon.com/docs/tools/icon-builder.html) + +1. Click **Save and continue**. +1. On the **Pricing** sub-section, the default values (amazon.com, $2.99 USD, Monthly billing, 7 day trial, releasing "today") are fine for the sample, however you can change the values if you like. +1. Set the **Tax Category** to 'Information Services'. This is suitable for this sample, however you should consult your tax professional for guidance on what to choose for this value. The available options are listed [here](https://developer.amazon.com/docs/in-skill-purchase/3-create-isp-dev-console.html#tax-category) +1. Click **Save and continue**. +1. Normally you would provide testing instructions to help the certification team find and test your in-skill product. (These testing instructions are specific to this in-skill product, and are in addition to the skill testing instructions you will provide on the **Certification** tab.) We're going to leave them blank for now. +1. Click **Save and finish**. +1. If you've provided all the necessary information, you will be able to click **Link to skill** which will link this in-skill product with your skill. If that's not an option, click **Continue** and then go back and fill in any missing information. +1. Congrats! You have added a "One-time Purchase" product to your skill. Now you are ready to test! + +[![Next](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_testing._TTH_.png)](4-testing.md) diff --git a/test-javaland/instructions/4-testing.md b/test-javaland/instructions/4-testing.md new file mode 100755 index 0000000..48c04f5 --- /dev/null +++ b/test-javaland/instructions/4-testing.md @@ -0,0 +1,48 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + +## Testing Your Alexa Skill + +So far, we have created a Voice User Interface, created the in-skill products and deployed code to a backend service linked to the skill. Your skill is now ready to test. + +1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/alexa/console/ask) 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. Access the **Alexa Simulator**, by selecting the **Test** link from the top navigation menu. + +3. Enable Testing by selecting **Development** from the drop down found directly below the top navigation menu. Once enabled, the label should read **Skill testing is enabled in:** `Development`. + +4. To validate that your skill is working as expected, invoke your skill from the **Alexa Simulator**. You can either type or click and hold the mic from the input box to use your voice. + 1. **Type** "Open" followed by the invocation name you gave your skill in [Step 1](./1-setup-vui-aws-hosted.md). For example, "Open Premium Hello World". + 2. **Use your voice** by clicking and holding the mic on the side panel and saying "Open" followed by the invocation name you gave your skill. + 3. **If you've forgotten the invocation name** for your skill, revisit the **Build** panel on the top navigation menu and select **Invocation** from the sidebar to review it. +5. Test phrases like: + - Alexa, open premium hello world + - give me a premium greeting + - what can I buy + - buy premium greeting + - what have I bought + > Note: if you have enabled a voice code to prevent accidental purchases via voice, you will be required to provide it before you can make an in-skill purchase. If you type that code, be sure to spell the numbers out, e.g. "one two three four" instead of "1234", otherwise the simulator will not recognize your code. + +6. Ensure your skill works the way that you designed it to. + - After you interact with the Alexa Simulator, you should see the Skill I/O **JSON Input** and **JSON Output** boxes get populated with JSON data. You can also view the **Device Log** to trace your steps. + - If it's not working as expected, you can dig into the JSON to see exactly what Alexa is sending and receiving from the endpoint. If something is broken, AWS Lambda offers an additional testing tool to help you troubleshoot your skill. + + + +> **Note: The developer account associated with the skill is never charged for in-skill products.** For more details about testing skills with in-skill products, please refer to the [In-Skill Purchase Testing Guide](https://developer.amazon.com/docs/in-skill-purchase/isp-test-guide.html) + +> If you need to reset a test purchase, you can return to the In-Skill Products page in the Alexa Developer Console. (That's on the **Build** tab, and click on **In-Skill Products** in the left nav. If you don't see it there, click on the In-Skill Products item in the Skill Builder Checklist.) Then click on the **Reset test purchases** link to reset your purchases for that product. This will work regardless of how you setup the in-skill product (console or CLI). + +> **Pro Tip**: type or say `exit` in the simulator to reset the session before each test pass. The simulator holds a session open longer than on a device to assist in your testing and it's easy to forget a session is still open. + + +## Other testing methods to consider:** + * Testing on your Alexa enabled devices and applications - any devices registered using the same account as your Alexa developer account will have your skill enabled on them when testing is enabled in development mode. You should always test your skill on an actual device rather than relying solely on the simulator. Keep in mind that in-skill products may not be purchased on all devices, but already purchased products will be available for use on all devices. + * [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://alexa.design/postman-guide) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway). + +> Note: While in-skill products are only currently available in the English (US) locale, any developer account (regardless of home locale), can be used to create skills with in-skill products. When testing, you must use an account which defaults to the amazon.com marketplace. (You may recall see that marketplace mentioned on the in-skill products' pricing page.) If your developer account does not default to that marketplace, or your billing address is outside the United States, then you will need to create a new account for testing purposes. Create this account using https://www.amazon.com and set an address for somewhere in the United States. + +If your sample skill is working properly, you can now **customize** your skill. + +[![Next](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/buttons/button_next_customization._TTH_.png)](5-customization.md) diff --git a/test-javaland/instructions/5-customization.md b/test-javaland/instructions/5-customization.md new file mode 100755 index 0000000..4527809 --- /dev/null +++ b/test-javaland/instructions/5-customization.md @@ -0,0 +1,39 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + +## Customization / Next Steps + +At this point, you should have a working copy of your skill. This is a clone of a sample skill, so if you want to publish the skill, you will first need to customize it so it offers content/functionality not currently available via the Alexa Skill Store. + +### Update Premium Greetings + +You can expand the premium greeting pack with greetings in more languages by updating the object `premium_greetings` inside index.js. + + ``` + const premium_greetings = [ + { language: "hindi", greeting: "Namaste" }, + { language: "french", greeting: "Bonjour" }, + { language: "spanish", greeting: "Hola" }, + { language: "japanese", greeting: "Konichiwa" }, + { language: "italian", greeting: "Ciao" } + ]; +``` +## Update/Create In-Skill Products + +In the developer console, switch to the **In-Skill Products** sub-section of the **Build** tab. Unlink/delete/modify products you don't intend to keep in your skill. Repeat the process we used to add new in-skill products which match your categories. + +### In-Skill Product Testing Instructions and Other Placeholders + +You may recall we didn't provide testing instructions for our sample in-skill products. When you are updating your in-skill products, be sure to include those testing instructions. It does not have to be complex. At a minimum, provide a simple scenario for how to invoke your skill and request your in-skill product. + +Also update the privacy policy, icons and other placeholder values used as part of the sample. As previously mentioned, your skill won't pass certification with placeholder values. + +## Test, Test, Test + +After making the above changes, be sure to test thoroughly. After you're done testing, have a friend or colleague test as well. + +## Publication + +Once you've customized your skill, proceed to the certification / publication step. + +[![Next](./next.png)](6-submit-for-certification.md) diff --git a/test-javaland/instructions/6-submit-for-certification.md b/test-javaland/instructions/6-submit-for-certification.md new file mode 100755 index 0000000..79ec1f9 --- /dev/null +++ b/test-javaland/instructions/6-submit-for-certification.md @@ -0,0 +1,114 @@ +# Build An Alexa Skill with In-Skill Purchases - Premium Hello World + + + +## 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 [Skill Store](http://amazon.com/skills). This page will walk you through the remaining steps to launch your skill! + +1. Select the **Distribution** link from the top navigation menu. + +2. Fill out the form fields per the guidance on the screen. Hover over the question mark icons for details regarding each respective field. **Fields marked with an Asterisk, are required!** + * Take the time to get these right so that your skill will pass certification! + +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) and the [skills store](http://www.amazon.com/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?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs). | + | 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. **Create your skill's icons.** You need two sizes of your icon: 108x108px and 512x512px. When you upload an image, it will be automatically fit to the required dimensions. + + * **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:** + + * [Alexa Skill Icon Builder](https://developer.amazon.com/docs/tools/icon-builder.html) (a link to this is included in the console) + + * [GIMP](https://www.gimp.org/) (Windows/Mac/Linux) + * [Canva](https://www.canva.com/) (Web) + * [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/) + +6. Choose the most appropriate category for your skill. + +7. **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) or the [skill store](http://www.amazon.com/skills) 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. + +8. **Privacy Policy URL.** This is an optional field, and should not be required for this fact skill sample. You can leave it blank. + +9. **Terms of Use URL.** This is also optional, and you can leave it blank. + +10. When you're ready, click **Save and Continue** at the bottom of the screen to move onto **Privacy & Compliance** + +11. * **Does this skill allow users to make purchases or spend real money?** For this fact 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 fact 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 on the previous 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 fact 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. + +12. **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. + +13. **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 Sample, make sure to add a sentence to your Testing Instructions referencing the Sample you used. For example: + + ```text + This was built using the Fact Sample. + ``` + + This will let the testing team understand what you're providing them, and should decrease the testing time required. + + **Note:** More details on certification are [available here.](https://alexa.design/certification) + +1. Click the **Save and Continue** button at the bottom of the page to move on to **Availability**. + * You'll want to allow the Public to access the skill unless you are using [Alexa for Business](https://aws.amazon.com/a4b). + * Beta testing is a good idea for every skill, however since this is from a template and is very basic, we'll skip that for now. When you make your next skill, don't skip this step. Seriously. You won't regret it. + * It is recommended to allow your skill to be available in all countries and regions where Amazon distributes skills, unless you are using facts which aren't applicable to a given area. Reasons to restrict distribution include not having intellectual property rights to distribute to that area and the content being illegal, offensive or otherwise prohibited in that area. + +1. If you feel that your skill is ready for certification, click the **Save and Continue** button at the bottom of the page and you'll be taken to the certification tab. + +1. The **Validation** page will tell you if you have missed any steps along the way which will prevent your skill from being submitted. You shouldn't see anything on this page, but if you do, go back and fix the issues. + +1. Click on the **Functional test** section and click the **Run** button to run functional tests against your skill. You shouldn't see any errors on this page, but if you do, go back and fix the issues. + +1. Click on **Submission**, and the click **Submit for Review**. + +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://alexa.design/officehours). 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?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs), [here for the UK](https://developer.amazon.com/en-gb/alexa-skills-kit/alexa-developer-skill-promotion?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs), [here for Germany](https://developer.amazon.com/de-de/alexa-skills-kit/alexa-developer-skill-promotion?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs), [here for India](https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion-india?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs), [here for Japan](https://developer.amazon.com/ja/alexa-skills-kit/alexa-developer-skill-promotion?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs), [here for France](https://developer.amazon.com/fr/alexa-skills-kit/alexa-developer-skill-promotion?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=fact-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_fact-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs), and [here for Australia](https://developer.amazon.com/alexa-skills-kit/anz/alexa-developer-skill-promotion). \ No newline at end of file diff --git a/test-javaland/instructions/next.png b/test-javaland/instructions/next.png new file mode 100755 index 0000000..8fbebf7 Binary files /dev/null and b/test-javaland/instructions/next.png differ diff --git a/test-javaland/lambda/pom.xml b/test-javaland/lambda/pom.xml new file mode 100644 index 0000000..67b0585 --- /dev/null +++ b/test-javaland/lambda/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + alexa-skills-kit-samples + helloworld + jar + 1.0 + helloworld + http://developer.amazon.com/ask + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + Alexa Skills Kit + ask-sdk-java@amazon.com + Alexa + http://developer.amazon.com/ask + + + + scm:git:https://github.com/amzn/alexa-skills-kit-java.git + scm:git:https://github.com/amzn/alexa-skills-kit-java.git + https://github.com/amzn/alexa-skills-kit-java.git + + + + + com.amazon.alexa + ask-sdk + 2.20.2 + + + + + src + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + true + + + + + + + diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/HelloWorldStreamHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/HelloWorldStreamHandler.java new file mode 100644 index 0000000..c340d2a --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/HelloWorldStreamHandler.java @@ -0,0 +1,43 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.helloworld; + +import com.amazon.ask.Skill; +import com.amazon.ask.Skills; +import com.amazon.ask.SkillStreamHandler; +import com.amazon.ask.helloworld.handlers.CancelandStopIntentHandler; +import com.amazon.ask.helloworld.handlers.HelloWorldIntentHandler; +import com.amazon.ask.helloworld.handlers.HelpIntentHandler; +import com.amazon.ask.helloworld.handlers.SessionEndedRequestHandler; +import com.amazon.ask.helloworld.handlers.LaunchRequestHandler; +import com.amazon.ask.helloworld.handlers.FallbackIntentHandler; + +public class HelloWorldStreamHandler extends SkillStreamHandler { + + private static Skill getSkill() { + return Skills.standard() + .addRequestHandlers( + new CancelandStopIntentHandler(), + new HelloWorldIntentHandler(), + new HelpIntentHandler(), + new LaunchRequestHandler(), + new SessionEndedRequestHandler(), + new FallbackIntentHandler()) + // Add your skill id below + //.withSkillId("") + .build(); + } + + public HelloWorldStreamHandler() { + super(getSkill()); + } + +} diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/CancelandStopIntentHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/CancelandStopIntentHandler.java new file mode 100644 index 0000000..039e9d0 --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/CancelandStopIntentHandler.java @@ -0,0 +1,36 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + + +package com.amazon.ask.helloworld.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class CancelandStopIntentHandler implements RequestHandler { + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("AMAZON.StopIntent").or(intentName("AMAZON.CancelIntent"))); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Goodbye"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withSimpleCard("HelloWorld", speechText) + .build(); + } +} diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/FallbackIntentHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/FallbackIntentHandler.java new file mode 100644 index 0000000..363107b --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/FallbackIntentHandler.java @@ -0,0 +1,31 @@ +package com.amazon.ask.helloworld.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +// 2018-July-09: AMAZON.FallackIntent is only currently available in en-US locale. +// This handler will not be triggered except in that locale, so it can be +// safely deployed for any locale. +public class FallbackIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("AMAZON.FallbackIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Sorry, I don't know that. You can say try saying help!"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withSimpleCard("HelloWorld", speechText) + .withReprompt(speechText) + .build(); + } + +} diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/HelloWorldIntentHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/HelloWorldIntentHandler.java new file mode 100644 index 0000000..28c6519 --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/HelloWorldIntentHandler.java @@ -0,0 +1,37 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.helloworld.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class HelloWorldIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("HelloWorldIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Hello world"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withSimpleCard("HelloWorld", speechText) + .build(); + } + +} diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/HelpIntentHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/HelpIntentHandler.java new file mode 100644 index 0000000..adabc20 --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/HelpIntentHandler.java @@ -0,0 +1,37 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.helloworld.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class HelpIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("AMAZON.HelpIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "You can say hello to me!"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withSimpleCard("HelloWorld", speechText) + .withReprompt(speechText) + .build(); + } +} diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/LaunchRequestHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/LaunchRequestHandler.java new file mode 100644 index 0000000..100f825 --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/LaunchRequestHandler.java @@ -0,0 +1,39 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.helloworld.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.LaunchRequest; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.requestType; + +public class LaunchRequestHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(requestType(LaunchRequest.class)); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Welcome to the Alexa Skills Kit, you can say hello"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withSimpleCard("HelloWorld", speechText) + .withReprompt(speechText) + .build(); + } + +} diff --git a/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/SessionEndedRequestHandler.java b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/SessionEndedRequestHandler.java new file mode 100644 index 0000000..2d4f59d --- /dev/null +++ b/test-javaland/lambda/src/com/amazon/ask/helloworld/handlers/SessionEndedRequestHandler.java @@ -0,0 +1,35 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.helloworld.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; +import com.amazon.ask.model.SessionEndedRequest; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.requestType; + +public class SessionEndedRequestHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(requestType(SessionEndedRequest.class)); + } + + @Override + public Optional handle(HandlerInput input) { + // any cleanup logic goes here + return input.getResponseBuilder().build(); + } + +} diff --git a/test-javaland/skill-package/assets/en-US_largeIcon.png b/test-javaland/skill-package/assets/en-US_largeIcon.png new file mode 100644 index 0000000..28ee1aa Binary files /dev/null and b/test-javaland/skill-package/assets/en-US_largeIcon.png differ diff --git a/test-javaland/skill-package/assets/en-US_smallIcon.png b/test-javaland/skill-package/assets/en-US_smallIcon.png new file mode 100644 index 0000000..2d1e0da Binary files /dev/null and b/test-javaland/skill-package/assets/en-US_smallIcon.png differ diff --git a/test-javaland/skill-package/interactionModels/custom/en-US.json b/test-javaland/skill-package/interactionModels/custom/en-US.json new file mode 100644 index 0000000..1c6b40c --- /dev/null +++ b/test-javaland/skill-package/interactionModels/custom/en-US.json @@ -0,0 +1,38 @@ +{ + "interactionModel": { + "languageModel": { + "intents": [ + { + "name": "AMAZON.CancelIntent", + "samples": [] + }, + { + "name": "AMAZON.HelpIntent", + "samples": [] + }, + { + "name": "AMAZON.StopIntent", + "samples": [] + }, + { + "name": "HelloWorldIntent", + "samples": [ + "say hello", + "say hello world", + "hello", + "say hi", + "say hi world", + "hi", + "how are you" + ], + "slots": [] + }, + { + "name": "AMAZON.FallbackIntent", + "samples": [] + } + ], + "invocationName": "hello world" + } + } +} diff --git a/test-javaland/skill-package/skill.json b/test-javaland/skill-package/skill.json new file mode 100644 index 0000000..927908d --- /dev/null +++ b/test-javaland/skill-package/skill.json @@ -0,0 +1,30 @@ +{ + "manifest": { + "publishingInformation": { + "locales": { + "en-US": { + "summary": "Sample Short Description", + "examplePhrases": [ + "Alexa open hello world", + "hello", + "help" + ], + "name": "test-javaland", + "description": "Sample Full Description" + } + }, + "isAvailableWorldwide": true, + "testingInstructions": "Sample Testing Instructions.", + "category": "KNOWLEDGE_AND_TRIVIA", + "distributionCountries": [] + }, + "apis": { + "custom": { + "endpoint": { + "uri": "arn:aws:lambda:eu-west-1:618362251982:function:ask-test-javaland-default-default-1615986998257" + } + } + }, + "manifestVersion": "1.0" + } +} \ No newline at end of file