├── .github
└── PULL_REQUEST_TEMPLATE.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── NOTICE
├── README.md
├── ask-resources.json
├── data
├── books.js
├── monarchs.js
├── states.js
└── videogames.js
├── instructions
├── 0-intro.md
├── 1-voice-user-interface.md
├── 2-lambda-function.md
├── 3-connect-vui-to-code.md
├── 4-testing.md
├── 5-customization.md
└── 6-publication.md
├── lambda
└── custom
│ ├── pom.xml
│ ├── quiz.iml
│ └── src
│ └── main
│ └── java
│ ├── META-INF
│ └── MANIFEST.MF
│ └── com
│ └── amazon
│ └── ask
│ └── quiz
│ ├── QuizSkillStreamHandler.java
│ ├── handlers
│ ├── AnswerIntentHandler.java
│ ├── ExitSkillHandler.java
│ ├── HelpIntentHandler.java
│ ├── LaunchRequestHandler.java
│ ├── NoAnswerIntentHandler.java
│ ├── QuizAndStartOverIntentHandler.java
│ ├── RepeatIntentHandler.java
│ └── SessionEndedHandler.java
│ ├── model
│ ├── Attributes.java
│ ├── Constants.java
│ ├── State.java
│ └── StateProperty.java
│ └── util
│ └── QuestionUtils.java
└── skill-package
├── interactionModels
└── custom
│ └── en-US.json
└── skill.json
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | *Issue #, if available:*
2 |
3 | *Description of changes:*
4 |
5 |
6 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
7 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4 | documentation, we greatly value feedback and contributions from our community.
5 |
6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7 | information to effectively respond to your bug report or contribution.
8 |
9 |
10 | ## Reporting Bugs/Feature Requests
11 |
12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features.
13 |
14 | When filing an issue, please check [existing open](https://github.com/alexa/skill-sample-java-quiz-game/issues), or [recently closed](https://github.com/alexa/skill-sample-java-quiz-game/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
16 |
17 | * A reproducible test case or series of steps
18 | * The version of our code being used
19 | * Any modifications you've made relevant to the bug
20 | * Anything unusual about your environment or deployment
21 |
22 |
23 | ## Contributing via Pull Requests
24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
25 |
26 | 1. You are working against the latest source on the *master* branch.
27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
29 |
30 | To send us a pull request, please:
31 |
32 | 1. Fork the repository.
33 | 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.
34 | 3. Ensure local tests pass.
35 | 4. Commit to your fork using clear commit messages.
36 | 5. Send us a pull request, answering any default questions in the pull request interface.
37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
38 |
39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
41 |
42 |
43 | ## Finding contributions to work on
44 | 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-quiz-game/labels/help%20wanted) issues is a great place to start.
45 |
46 |
47 | ## Code of Conduct
48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
50 | opensource-codeofconduct@amazon.com with any additional questions or comments.
51 |
52 |
53 | ## Security issue notifications
54 | 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.
55 |
56 |
57 | ## Licensing
58 |
59 | See the [LICENSE](https://github.com/alexa/skill-sample-java-quiz-game/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
60 |
61 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
62 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Amazon Software License 1.0
2 |
3 | This Amazon Software License ("License") governs your use, reproduction, and
4 | distribution of the accompanying software as specified below.
5 |
6 | 1. Definitions
7 |
8 | "Licensor" means any person or entity that distributes its Work.
9 |
10 | "Software" means the original work of authorship made available under this
11 | License.
12 |
13 | "Work" means the Software and any additions to or derivative works of the
14 | Software that are made available under this License.
15 |
16 | The terms "reproduce," "reproduction," "derivative works," and
17 | "distribution" have the meaning as provided under U.S. copyright law;
18 | provided, however, that for the purposes of this License, derivative works
19 | shall not include works that remain separable from, or merely link (or bind
20 | by name) to the interfaces of, the Work.
21 |
22 | Works, including the Software, are "made available" under this License by
23 | including in or with the Work either (a) a copyright notice referencing the
24 | applicability of this License to the Work, or (b) a copy of this License.
25 |
26 | 2. License Grants
27 |
28 | 2.1 Copyright Grant. Subject to the terms and conditions of this License,
29 | each Licensor grants to you a perpetual, worldwide, non-exclusive,
30 | royalty-free, copyright license to reproduce, prepare derivative works of,
31 | publicly display, publicly perform, sublicense and distribute its Work and
32 | any resulting derivative works in any form.
33 |
34 | 2.2 Patent Grant. Subject to the terms and conditions of this License, each
35 | Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free
36 | patent license to make, have made, use, sell, offer for sale, import, and
37 | otherwise transfer its Work, in whole or in part. The foregoing license
38 | applies only to the patent claims licensable by Licensor that would be
39 | infringed by Licensor's Work (or portion thereof) individually and
40 | excluding any combinations with any other materials or technology.
41 |
42 | 3. Limitations
43 |
44 | 3.1 Redistribution. You may reproduce or distribute the Work only if
45 | (a) you do so under this License, (b) you include a complete copy of this
46 | License with your distribution, and (c) you retain without modification
47 | any copyright, patent, trademark, or attribution notices that are present
48 | in the Work.
49 |
50 | 3.2 Derivative Works. You may specify that additional or different terms
51 | apply to the use, reproduction, and distribution of your derivative works
52 | of the Work ("Your Terms") only if (a) Your Terms provide that the use
53 | limitation in Section 3.3 applies to your derivative works, and (b) you
54 | identify the specific derivative works that are subject to Your Terms.
55 | Notwithstanding Your Terms, this License (including the redistribution
56 | requirements in Section 3.1) will continue to apply to the Work itself.
57 |
58 | 3.3 Use Limitation. The Work and any derivative works thereof only may be
59 | used or intended for use with the web services, computing platforms or
60 | applications provided by Amazon.com, Inc. or its affiliates, including
61 | Amazon Web Services, Inc.
62 |
63 | 3.4 Patent Claims. If you bring or threaten to bring a patent claim against
64 | any Licensor (including any claim, cross-claim or counterclaim in a
65 | lawsuit) to enforce any patents that you allege are infringed by any Work,
66 | then your rights under this License from such Licensor (including the
67 | grants in Sections 2.1 and 2.2) will terminate immediately.
68 |
69 | 3.5 Trademarks. This License does not grant any rights to use any
70 | Licensor's or its affiliates' names, logos, or trademarks, except as
71 | necessary to reproduce the notices described in this License.
72 |
73 | 3.6 Termination. If you violate any term of this License, then your rights
74 | under this License (including the grants in Sections 2.1 and 2.2) will
75 | terminate immediately.
76 |
77 | 4. Disclaimer of Warranty.
78 |
79 | THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
80 | EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
81 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
82 | NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
83 | THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN
84 | IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
85 |
86 | 5. Limitation of Liability.
87 |
88 | EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
89 | THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
90 | SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
91 | INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR
92 | RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK (INCLUDING
93 | BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS
94 | OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER COMM ERCIAL DAMAGES
95 | OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF
96 | SUCH DAMAGES.
97 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Alexa Skill Sample (Quiz Game)
2 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 |
3 |
4 | [](./instructions/1-voice-user-interface.md)[](./instructions/2-lambda-function.md)[](./instructions/3-connect-vui-to-code.md)[](./instructions/4-testing.md)[](./instructions/5-customization.md)[](./instructions/6-publication.md)
5 |
6 | This Alexa sample skill is a template for a basic quiz game skill. Provided a list of interesting facts about a topic, Alexa will quiz a user with facts from the list.
7 |
8 | You can see an example of this skill in action - just enable the [United States Quiz](https://www.amazon.com/Jeff-Blankenburg-United-States-Quiz/dp/B06X9GQBRL) from the [Alexa app](http://amazon.com/skills).
9 |
10 | ## Pre-requisites
11 | * [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
12 | * [Maven](https://maven.apache.org/)
13 | * Register for an [AWS Account](https://aws.amazon.com/)
14 | * Register for an [Amazon Developer Account](https://developer.amazon.com/)
15 |
16 |
17 |
18 |
19 |
20 |
21 | Be sure to take a look at the [Additional Resources](#additional-resources) at the bottom of this page!
22 |
23 |
24 | ### Usage
25 |
26 | ```text
27 | Alexa, ask Quizgame to start a quiz.
28 | >> OK. I will ask you 10 questions about the United States.
29 |
30 | Alexa, start Quiz Game
31 | ```
32 |
33 | ### Repository Contents
34 | * `data` - Alternate datasets for quiz games
35 | * `/lambda/custom` - Back-End Logic for the Alexa Skill hosted on [AWS Lambda](https://aws.amazon.com/lambda/)
36 | * `/models` - Voice User Interface and Language Specific Interaction Models
37 | * `/instructions` - Step-by-Step Instructions for Getting Started
38 | * `skill.json` - [Skill Manifest](https://developer.amazon.com/docs/smapi/skill-manifest.html)
39 |
40 | ## Additional Resources
41 |
42 | ### Community
43 | * [Amazon Developer Forums](https://forums.developer.amazon.com/spaces/165/index.html) - Join the conversation!
44 | * [Hackster.io](https://www.hackster.io/amazon-alexa) - See what others are building with Alexa.
45 |
46 | ### Tutorials & Guides
47 | * [Voice Design Guide](https://developer.amazon.com/designing-for-voice/) - A great resource for learning conversational and voice user interface design.
48 | * [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!
49 |
50 | ### Documentation
51 | * [Official Alexa Skills Kit Java SDK](https://github.com/alexa/alexa-skills-kit-sdk-for-java) - The Official Java SDK Documentation
52 | * [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
53 |
--------------------------------------------------------------------------------
/ask-resources.json:
--------------------------------------------------------------------------------
1 | {
2 | "askcliResourcesVersion": "2020-03-31",
3 | "profiles": {
4 | "default": {
5 | "skillMetadata": {
6 | "src": "./skill-package"
7 | },
8 | "code": {
9 | "default": {
10 | "src": "lambda/custom"
11 | }
12 | },
13 | "skillInfrastructure": {
14 | "userConfig": {
15 | "runtime": "nodejs10.x",
16 | "handler": "index.handler",
17 | "awsRegion": "us-east-1"
18 | },
19 | "type": "@ask-cli/lambda-deployer"
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/data/books.js:
--------------------------------------------------------------------------------
1 | //=========================================================================================================================================
2 | //This data quizzes users about the author and publication dates of well-known books.
3 | //Data for this list came from: https://en.wikipedia.org/wiki/List_of_best-selling_books
4 | //=========================================================================================================================================
5 |
6 |
7 |
8 | var data = [
9 | {BookTitle: "Don Quixote", Author: "Miguel de Cervantes", OriginalPublicationDate:1612},
10 | {BookTitle: "A Tale of Two Cities", Author: "Charles Dickens", OriginalPublicationDate:1859},
11 | {BookTitle: "The Fellowship of the Ring", Author: "J. R. R. Tolkien", OriginalPublicationDate:1954},
12 | {BookTitle: "The Two Towers", Author: "J. R. R. Tolkien", OriginalPublicationDate:1954},
13 | {BookTitle: "The Hobbit", Author: "J. R. R. Tolkien", OriginalPublicationDate:1937},
14 | {BookTitle: "The Little Prince", Author: "Antoine de Saint-Exupery", OriginalPublicationDate:1943},
15 | {BookTitle: "The Return of the King", Author: "J. R. R. Tolkien", OriginalPublicationDate:1955},
16 | {BookTitle: "Harry Potter and the Philosopher's Stone", Author: "J. K. Rowling", OriginalPublicationDate:1997},
17 | {BookTitle: "And Then There Were None", Author: "Agatha Christie", OriginalPublicationDate:1939},
18 | {BookTitle: "Alice In Wonderland", Author: "Lewis Carroll", OriginalPublicationDate:1865}
19 | ];
20 |
--------------------------------------------------------------------------------
/data/monarchs.js:
--------------------------------------------------------------------------------
1 | var data = [
2 | { Name:"Queen Anne", YearOfCoronation:1707, Predecessor:"none", Successor:"King George the First", YearOfDeath:1714},
3 | { Name:"King George the 1st", YearOfCoronation:1714, Predecessor:"Queen Anne", Successor:"King George the Second", YearOfDeath:1727},
4 | { Name:"King George the 2nd", YearOfCoronation:1727, Predecessor:"King George the 1st", Successor:"King George the 3rd", YearOfDeath:1760},
5 | { Name:"King George the 3rd", YearOfCoronation:1760, Predecessor:"King George the 2nd", Successor:"King George the 4th", YearOfDeath:1820},
6 | { Name:"King George the 4th", YearOfCoronation:1820, Predecessor:"King George the 3rd", Successor:"King William the 4th", YearOfDeath:1830},
7 | { Name:"King William the 4th", YearOfCoronation:1830, Predecessor:"King George the 4th", Successor:"Queen Victoria", YearOfDeath:1837},
8 | { Name:"Queen Victoria", YearOfCoronation:1837, Predecessor:"King William the 4th", Successor:"King Edward the 7th", YearOfDeath:1901},
9 | { Name:"King Edward the 7th", YearOfCoronation:1901, Predecessor:"Queen Victoria", Successor:"King George the 5th", YearOfDeath:1910},
10 | { Name:"King George the 5th", YearOfCoronation:1910, Predecessor:"King Edward the 7th", Successor:"King Edward the 8th", YearOfDeath:1936},
11 | { Name:"King Edward the 8th", YearOfCoronation:1936, Predecessor:"King George the 5th", Successor:"King George the 6th", YearOfDeath:1972},
12 | { Name:"King George the 6th", YearOfCoronation:1936, Predecessor:"King Edward the 8th", Successor:"Queen Elizabeth the 2nd",YearOfDeath:1952},
13 | { Name:"Queen Elizabeth the 2nd", YearOfCoronation:1952, Predecessor:"King George the 6th"}
14 | ]
--------------------------------------------------------------------------------
/data/states.js:
--------------------------------------------------------------------------------
1 | //=========================================================================================================================================
2 | //This data quizzes users about the abbreviations, capitals, statehood years and statehood orders for the 50 United States.
3 | //=========================================================================================================================================
4 |
5 | var data = [
6 | {StateName: "Alabama", Abbreviation: "AL", Capital: "Montgomery", StatehoodYear: 1819, StatehoodOrder: 22 },
7 | {StateName: "Alaska", Abbreviation: "AK", Capital: "Juneau", StatehoodYear: 1959, StatehoodOrder: 49 },
8 | {StateName: "Arizona", Abbreviation: "AZ", Capital: "Phoenix", StatehoodYear: 1912, StatehoodOrder: 48 },
9 | {StateName: "Arkansas", Abbreviation: "AR", Capital: "Little Rock", StatehoodYear: 1836, StatehoodOrder: 25 },
10 | {StateName: "California", Abbreviation: "CA", Capital: "Sacramento", StatehoodYear: 1850, StatehoodOrder: 31 },
11 | {StateName: "Colorado", Abbreviation: "CO", Capital: "Denver", StatehoodYear: 1876, StatehoodOrder: 38 },
12 | {StateName: "Connecticut", Abbreviation: "CT", Capital: "Hartford", StatehoodYear: 1788, StatehoodOrder: 5 },
13 | {StateName: "Delaware", Abbreviation: "DE", Capital: "Dover", StatehoodYear: 1787, StatehoodOrder: 1 },
14 | {StateName: "Florida", Abbreviation: "FL", Capital: "Tallahassee", StatehoodYear: 1845, StatehoodOrder: 27 },
15 | {StateName: "Georgia", Abbreviation: "GA", Capital: "Atlanta", StatehoodYear: 1788, StatehoodOrder: 4 },
16 | {StateName: "Hawaii", Abbreviation: "HI", Capital: "Honolulu", StatehoodYear: 1959, StatehoodOrder: 50 },
17 | {StateName: "Idaho", Abbreviation: "ID", Capital: "Boise", StatehoodYear: 1890, StatehoodOrder: 43 },
18 | {StateName: "Illinois", Abbreviation: "IL", Capital: "Springfield", StatehoodYear: 1818, StatehoodOrder: 21 },
19 | {StateName: "Indiana", Abbreviation: "IN", Capital: "Indianapolis", StatehoodYear: 1816, StatehoodOrder: 19 },
20 | {StateName: "Iowa", Abbreviation: "IA", Capital: "Des Moines", StatehoodYear: 1846, StatehoodOrder: 29 },
21 | {StateName: "Kansas", Abbreviation: "KS", Capital: "Topeka", StatehoodYear: 1861, StatehoodOrder: 34 },
22 | {StateName: "Kentucky", Abbreviation: "KY", Capital: "Frankfort", StatehoodYear: 1792, StatehoodOrder: 15 },
23 | {StateName: "Louisiana", Abbreviation: "LA", Capital: "Baton Rouge", StatehoodYear: 1812, StatehoodOrder: 18 },
24 | {StateName: "Maine", Abbreviation: "ME", Capital: "Augusta", StatehoodYear: 1820, StatehoodOrder: 23 },
25 | {StateName: "Maryland", Abbreviation: "MD", Capital: "Annapolis", StatehoodYear: 1788, StatehoodOrder: 7 },
26 | {StateName: "Massachusetts", Abbreviation: "MA", Capital: "Boston", StatehoodYear: 1788, StatehoodOrder: 6 },
27 | {StateName: "Michigan", Abbreviation: "MI", Capital: "Lansing", StatehoodYear: 1837, StatehoodOrder: 26 },
28 | {StateName: "Minnesota", Abbreviation: "MN", Capital: "St. Paul", StatehoodYear: 1858, StatehoodOrder: 32 },
29 | {StateName: "Mississippi", Abbreviation: "MS", Capital: "Jackson", StatehoodYear: 1817, StatehoodOrder: 20 },
30 | {StateName: "Missouri", Abbreviation: "MO", Capital: "Jefferson City", StatehoodYear: 1821, StatehoodOrder: 24 },
31 | {StateName: "Montana", Abbreviation: "MT", Capital: "Helena", StatehoodYear: 1889, StatehoodOrder: 41 },
32 | {StateName: "Nebraska", Abbreviation: "NE", Capital: "Lincoln", StatehoodYear: 1867, StatehoodOrder: 37 },
33 | {StateName: "Nevada", Abbreviation: "NV", Capital: "Carson City", StatehoodYear: 1864, StatehoodOrder: 36 },
34 | {StateName: "New Hampshire", Abbreviation: "NH", Capital: "Concord", StatehoodYear: 1788, StatehoodOrder: 9 },
35 | {StateName: "New Jersey", Abbreviation: "NJ", Capital: "Trenton", StatehoodYear: 1787, StatehoodOrder: 3 },
36 | {StateName: "New Mexico", Abbreviation: "NM", Capital: "Santa Fe", StatehoodYear: 1912, StatehoodOrder: 47 },
37 | {StateName: "New York", Abbreviation: "NY", Capital: "Albany", StatehoodYear: 1788, StatehoodOrder: 11 },
38 | {StateName: "North Carolina", Abbreviation: "NC", Capital: "Raleigh", StatehoodYear: 1789, StatehoodOrder: 12 },
39 | {StateName: "North Dakota", Abbreviation: "ND", Capital: "Bismarck", StatehoodYear: 1889, StatehoodOrder: 39 },
40 | {StateName: "Ohio", Abbreviation: "OH", Capital: "Columbus", StatehoodYear: 1803, StatehoodOrder: 17 },
41 | {StateName: "Oklahoma", Abbreviation: "OK", Capital: "Oklahoma City", StatehoodYear: 1907, StatehoodOrder: 46 },
42 | {StateName: "Oregon", Abbreviation: "OR", Capital: "Salem", StatehoodYear: 1859, StatehoodOrder: 33 },
43 | {StateName: "Pennsylvania", Abbreviation: "PA", Capital: "Harrisburg", StatehoodYear: 1787, StatehoodOrder: 2 },
44 | {StateName: "Rhode Island", Abbreviation: "RI", Capital: "Providence", StatehoodYear: 1790, StatehoodOrder: 13 },
45 | {StateName: "South Carolina", Abbreviation: "SC", Capital: "Columbia", StatehoodYear: 1788, StatehoodOrder: 8 },
46 | {StateName: "South Dakota", Abbreviation: "SD", Capital: "Pierre", StatehoodYear: 1889, StatehoodOrder: 40 },
47 | {StateName: "Tennessee", Abbreviation: "TN", Capital: "Nashville", StatehoodYear: 1796, StatehoodOrder: 16 },
48 | {StateName: "Texas", Abbreviation: "TX", Capital: "Austin", StatehoodYear: 1845, StatehoodOrder: 28 },
49 | {StateName: "Utah", Abbreviation: "UT", Capital: "Salt Lake City", StatehoodYear: 1896, StatehoodOrder: 45 },
50 | {StateName: "Vermont", Abbreviation: "VT", Capital: "Montpelier", StatehoodYear: 1791, StatehoodOrder: 14 },
51 | {StateName: "Virginia", Abbreviation: "VA", Capital: "Richmond", StatehoodYear: 1788, StatehoodOrder: 10 },
52 | {StateName: "Washington", Abbreviation: "WA", Capital: "Olympia", StatehoodYear: 1889, StatehoodOrder: 42 },
53 | {StateName: "West Virginia", Abbreviation: "WV", Capital: "Charleston", StatehoodYear: 1863, StatehoodOrder: 35 },
54 | {StateName: "Wisconsin", Abbreviation: "WI", Capital: "Madison", StatehoodYear: 1848, StatehoodOrder: 30 },
55 | {StateName: "Wyoming", Abbreviation: "WY", Capital: "Cheyenne", StatehoodYear: 1890, StatehoodOrder: 44 }
56 | ];
57 |
--------------------------------------------------------------------------------
/data/videogames.js:
--------------------------------------------------------------------------------
1 | //=========================================================================================================================================
2 | //This data quizzes users about the publisher and release year of video games.
3 | //Data for this list came from: https://en.wikipedia.org/wiki/List_of_Nintendo_Entertainment_System_games
4 | //=========================================================================================================================================
5 |
6 | var data = [
7 | {Title: "10-Yard Fight", ReleaseYear: 1985, Publisher: "Nintendo"},
8 | {Title: "Adventure Island", ReleaseYear: 1988, Publisher: "Hudson Soft"},
9 | {Title: "Bad Dudes", ReleaseYear: 1990, Publisher: "Data East"},
10 | {Title: "Baseball Stars", ReleaseYear: 1989, Publisher: "SNK"},
11 | {Title: "Castlevania", ReleaseYear: 1987, Publisher: "Konami"},
12 | {Title: "Double Dragon", ReleaseYear: 1988, Publisher: "Tradewest"},
13 | {Title: "Elevator Action", ReleaseYear: 1987, Publisher: "Taito"},
14 | {Title: "Final Fantasy", ReleaseYear: 1990, Publisher: "Nintendo"},
15 | {Title: "Gyruss", ReleaseYear: 1989, Publisher: "Ultra Games"}
16 | ];
17 |
--------------------------------------------------------------------------------
/instructions/0-intro.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 |
3 |
4 | [](1-voice-user-interface.md)[](2-lambda-function.md)[](3-connect-vui-to-code.md)[](4-testing.md)[](5-customization.md)[](6-publication.md)
5 |
6 |
7 | ## What You Will Learn
8 | * [AWS Lambda](http://aws.amazon.com/lambda)
9 | * [Alexa Skills Kit (ASK)](https://developer.amazon.com/alexa-skills-kit)
10 | * Voice User Interface (VUI) Design
11 | * Skill Certification
12 | * State Management
13 | * [Speechcons](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speechcon-reference)
14 |
15 | ## What You Will Need
16 | * [Amazon Developer Portal Account](http://developer.amazon.com)
17 | * [Amazon Web Services Account](http://aws.amazon.com/)
18 | * [The Java 8 JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
19 | - You can use the following command to check your Java version:
20 | ```bash
21 | java -version
22 | ```
23 | * [Apache Maven](https://maven.apache.org/download.cgi)
24 | - The following command will display your Maven version:
25 | ```bash
26 | mvn --version
27 | ```
28 | * The sample code on [GitHub](https://github.com/alexa/skill-sample-java-quiz-game).
29 | * Simple graphical editing tool
30 | * At least 25 rows of interesting data to quiz your users with.
31 | * Examples: [U.S. States](.data/states.js), [Video Games](.data/videogames.js), [Books](data/books.js), [British Monarchs](data/monarchs.js)
32 |
33 | ## What Your Skill Will Do
34 | We all hold interesting data in our heads. Maybe it's a list of all the action figures we played with as a kid, specific details about the 50 states, or a historical list of the starting quarterbacks for our favorite football team. When we're with friends, sometimes we'll even quiz each other on these nuanced categories of information. It's a fun, interactive way to share our knowledge and learn more about our favorite topics.
35 |
36 | You can now bring that experience to Alexa using our new quiz skill template. You provide the data and the number of properties in that data, and Alexa will dynamically build a quiz game for you. In the quiz, Alexa will ask questions like:
37 | * "What is the capital of Vermont?"
38 | * "How many career home runs did Mickey Mantle hit?"
39 | * "What year was Harry Potter and the Sorcerer's Stone first published?"
40 |
41 | You get to provide the data, as well as the number of properties in that data, and Alexa will dynamically build a quiz game for you. In the quiz, Alexa will ask questions like:
42 | * "Alexa, ask United States Quiz about Ohio."
43 | * "Alexa, ask Hockey Quiz about Wayne Gretzky."
44 | * "Alexa, ask Video Game Quiz about River City Ransom."
45 |
46 | We've also included [speechcons](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speechcon-reference) feature for Alexa skill development. Speechcons are special words and phrases that Alexa pronounces more expressively. We use them in this quiz game to let the user know whether they gave a correct or incorrect answer during the quiz. Different speechcons are available in each region, so make sure you use the correct ones.
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/instructions/1-voice-user-interface.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 | [](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
3 |
4 | ## Setting up Your Alexa Skill in the Developer Portal
5 | 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.)
6 |
7 |
8 | 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 (New)** Link.
9 |
10 |
11 | 3. From the **Alexa Skills Console (New Console)** select the **Create Skill** button near the top of the screen.
12 |
13 |
14 | 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. Push Next.
15 |
16 | 5. Select the **Custom** model at the top of the page to add to your skill and select the **Create Skill** button at the top right.
17 |
18 | 6. **Build the Interaction Model for your skill**
19 | 1. On the left hand navigation panel. Select the **Invocation** tab. Enter a **Skill Inovcation Name**. This is the name that your users will need to say to start your skill.
20 | 2. Next, select the **JSON Editor** tab. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](../skill-package/interactionModels/custom/en-US.json), then click "Build Model".
21 |
22 | **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/define-the-interaction-model-in-json-and-text.html).
23 |
24 | 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.
25 |
26 |
27 | 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 on [Page #3: Connect VUI to Code](./3-connect-vui-to-code.md).
28 |
29 |
30 |
31 | If you get an error from your interaction model, check through this list:
32 |
33 | * **Did you copy & paste the provided code correctly?**
34 | * **Did you accidentally add any characters to the Interaction Model or Sample Utterances?**
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/instructions/2-lambda-function.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 | [](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
3 |
4 | ## Setting Up A Lambda Function Using Amazon Web Services
5 |
6 | In the [first step of this guide](./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.
7 |
8 | 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://alexa.design/create-aws-account).
9 |
10 |
11 |
12 | 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.
13 |
14 |
15 |
16 | 3. **Check your AWS region.** AWS Lambda only works with the Alexa Skills Kit in three regions: US East (N. Virginia), US West (Oregon), and EU (Ireland). Make sure you choose the region closest to your customers.
17 |
18 |
19 |
20 | 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.)
21 |
22 |
23 |
24 | 5. **There are two boxes labeled "Author from scratch" and "Blueprints". Click the radio button in the box titled "Author from scratch".** Then type a name for you lambda function, choose "Java 8" as the runtime.
25 |
26 | 6. **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://alexa.design/create-lambda-role). If you have done this before, set your **Existing role** value to "lambda_basic_execution."
27 |
28 |
29 |
30 | 7. **Click Create Function in the bottom right corner.** You will need to scroll down to find **Create Function.**
31 |
32 |
33 |
34 |
35 | 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.
36 |
37 |
38 |
39 | 9. Once you have selected Alexa Skills Kit, scroll down. Under Configure triggers, select Enable for Skill ID verification. A skill ID Edit box should appear. We will now retrieve your Skill ID from the developer portal.
40 |
41 | 10. Now lets secure this lambda function, so that it can only be invoked by your skill. Open up the [developer portal](https://developer.amazon.com/edw/home.html#/skills). Copy your **skill's ID** from the list of skills, it **starts with "amzn1"** and is located under the skill's name.
42 |
43 | 11. Click the Skill Information Link.
44 |
45 |
46 |
47 | 12. Copy the **Application ID** provided in the main window. This is also known as a skill ID, and is unique to your skill.
48 |
49 | 13. Return to your lambda function in the browser. You may already have this browser tab open from **Step 11**. Otherwise, open the lambda console by clicking here: [AWS Console](https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions) and select the appropriate function. Scroll down to **Configure triggers**, paste the Skill ID in the Skill ID edit box.
50 |
51 | 14. 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.
52 | 
53 | Scroll down to the box called "Function code".
54 |
55 | 15. **Compile and package the [provided code](https://github.com/alexa/skill-sample-java-quiz-game/blob/master/lambda/custom/) into the Lambda function.** We have provided the code for this skill on [GitHub](https://github.com/alexa/skill-sample-nodejs-java-game/blob/master/lambda/custom/).
56 | * Downlod it, or clone this repo.
57 | * Open a terminal or command line window, and navigate to the **folder where you downloaded the source code**
58 | * Under lambda/custom you should find the **_pom.xml_** file, from this directory use the following Maven command to compile it and package it as a JAR with its dependencies.
59 | ```bash
60 | mvn assembly:assembly -DdescriptorId=jar-with-dependencies package
61 | ```
62 | * You can find the generated JAR in the 'target' folder.
63 |
64 | 16. **Upload the code to Lambda**
65 | Back in the AWS Lambda console, scroll down to 'Function Code' box, and from the 'Code entry type' drop box select 'Upload a .ZIP file'. Click the 'Upload' button, select the **JAR with dependencies** you created in the previous step using Maven. Click the **'Save'** button in the top right corner.
66 |
67 | 17. **Set your function's Handler**
68 | In the 'Function Code' box you'll see a field labeled 'Handler' set the value as follows:
69 | ```text
70 | com.amazon.ask.quiz.QuizSkillStreamHandler
71 | ```
72 | This is the fully qualified name for this skills main handler.
73 |
74 | 18. **After you're done, the ARN value for this Lambda function should be in the top right corner of the page. Copy this value for use in the next section of the guide.**
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/instructions/3-connect-vui-to-code.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 | [](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
3 |
4 | ## Connecting Your Voice User Interface To Your Lambda Function
5 |
6 | On [page #1](./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](./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.
7 |
8 | 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.
9 |
10 | 2. Select the **Endpoint** tab on the left side navigation panel.
11 |
12 | 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).
13 |
14 | 4. Paste your Lambda's ARN (Amazon Resource Name) into the textbox provided for **Default Region**.
15 |
16 | 5. Click the **Save Endpoints** button at the top of the main panel.
17 |
18 | 6. **Click the "Next" button to continue to page #4 of this guide.**
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/instructions/4-testing.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 | [](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
3 |
4 | ## Testing Your Alexa Skill
5 |
6 | So far, we have [created a Voice User Interface](./1-voice-user-interface.md) and [a Lambda function](./2-lambda-function.md), and [connected the two together](./3-connect-vui-to-code.md). Your skill is now ready to test.
7 |
8 | 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.
9 |
10 | 2. Open the **Test** Pane, by selecting the **Test** link from the top navigation menu.
11 |
12 | 3. Enable Testing by activating the **Test is enabled for this skill** slider. It should be underneath the top navigation menu.
13 |
14 | 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.
15 | 1. **Type** "Open" followed by the invocation name you gave your skill in [Step 1](./1-voice-user-interface.md). For example, "Open Quiz Game".
16 | 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.
17 | 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.
18 |
19 | 5. Ensure your skill works the way that you designed it to.
20 | * 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.
21 | * 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.
22 |
23 | 6. **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:
24 | 1. Enter an utterance in the service simulator, and copy the generated Lambda Request for the next step.
25 |
26 | 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test events."**
27 |
28 |
29 |
30 | 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.
31 |
32 |
33 |
34 | 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.
35 |
36 |
37 |
38 | 5. **Click the "Create" button.** This will save your test event and bring you back to the main configuration for your lambda function.
39 |
40 | 6. **Click the "Test" button to execute the "startSession" test event.**
41 |
42 |
43 |
44 | This gives you visibility into four things:
45 |
46 | * **Your response, listed in the "Execution Result."**
47 |
48 |
49 |
50 | * **A Summary of the statistics for your request.** This includes things like duration, resources, and memory used.
51 |
52 |
53 |
54 | * **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.
55 |
56 |
57 |
58 | * **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.)
59 |
60 | 7. **Other testing methods to consider:**
61 |
62 | * [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.
63 | * [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).
64 |
65 | 8. **If your sample skill is working properly, you can now customize your skill.**
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/instructions/5-customization.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 | [](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
3 |
4 |
5 |
6 | ## Customize the Skill to be Yours
7 |
8 | At this point, you should have a working copy of our United States Quiz Game 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:
9 |
10 | 1. **New data.** You will need to create a new dataset for your skill that *isn't* the 50 United States of America. If you are looking for an idea, check out the [Wikipedia List of Lists of Lists](https://en.wikipedia.org/wiki/List_of_lists_of_lists).
11 |
12 | 1. **Edit the java source files.** [You can find a copy here on GitHub](https://github.com/alexa/skill-sample-java-quiz-game/blob/master/lambda/custom/). You could use a lightweight code editor like [Atom](http://atom.io), or [Sublime Text](http://sublimetext.com) to edit the code and use Maven to build it. But you most likely will want to use an IDE like [IntelliJ IDEA](https://www.jetbrains.com/idea/download/), independent of your IDE choice, you'll have to use Maven to build a JAR and upload your code for your changes to take effect.s
13 |
14 | 2. **Search for the places where data is referenced.** This is the data for our skill. You can see that there is a row for each state, represented by five data values: **StateName**, **Abbreviation**, **Capital**, **StatehoodYear**, and **StatehoodOrder**.
15 |
16 | You can provide as few or as many properties for your data as you would like, but we recommend a minimum of three to keep your skill interesting. (Two is the fewest that will make any sense for a quiz.) You should provide at least 25 rows of data for your quiz by replacing the data that we provided with your content. To see other examples of appropriate data structures for a quiz game skill, we have created a few sample data sets for you to look at.
17 |
18 | * [Video Games](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/data/videogames.js)
19 | * [Books](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/data/books.js)
20 | * [U.S. States](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/data/states.js)
21 | * [British Monarchs](https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/data/monarchs.js)
22 |
23 | 3. **Consider using built-in slot values.** We recommend considering data from the built-in slot values provided by Amazon. You still need to build your entire dataset, but using values from the built-in slots will make your work in the next few steps easier. We have provided a few examples below, but you can see the [entire list of built-in slot values here](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#list-types).
24 |
25 | | Slot Name | Description | Sample Values | Supported Languages |
26 | | --------- | ----------- | ------------- | ------------------- |
27 | | [AMAZON.Actor](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#actor) | Names of actors and actresses | Alan Rickman, Amy Adams, Daniel Radcliffe, Emma Watson | US |
28 | | [AMAZON.Airline](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#airline) | Name of a variety of airlines | Alaska Airlines, British Airways, Dolphin Air, Maestro | US |
29 | | [AMAZON.Animal](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#animal) | Names of many different animals | blister beetle, common frog, moray eel, opossum, spider monkey | US |
30 | | [AMAZON.Comic](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#comic) | Titles of comic books | Justice League, Runaways, The Amazing Spiderman, Watchmen, X-Men | US |
31 | | [AMAZON.EUROPE_CITY](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#europe_city) | European and world cities | Kempten, Lourdes, Paris, London, Barcelona | US, UK, DE |
32 | | [AMAZON.Sport](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#sport) | Names of sports | basketball, college football, football, gymnastics, team handball | US |
33 | | [AMAZON.VideoGame](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#videogame) | Titles of video games | Doom Two, Lemmings, The Sims, Worms | US |
34 |
35 | 4. **Once you have your data, here are a couple of tips to remember as we move forward:**
36 |
37 | * **Alexa will read your property names, so each property name should be readable in your questions.** These names are also used in **cards** in the Alexa app, so you should capitalize the first letter of each word. The skill will automatically separate words and add spaces as necessary.
38 | * **The first property in each item is typically used in the questions.** For example, in the U.S state data, most of the questions take a form like "What is the capital of Ohio?", where "capital" came from the property name, and "Ohio" was the first property. (You can customize this for your skill.) Otherwise, the order does not matter at all.
39 |
40 | 5. **When you have replaced the data in index.js, copy the contents of your file to your Lambda function.** This should be as simple as copying the text, and pasting it into the code box for your Lambda.
41 |
42 |
43 |
44 | 2. **New Interaction Model for your AnswerIntent.** If your data is changing, then the type of data you receive from your users must change as well.
45 |
46 | 1. **Open your skill in the Developer Portal, and go to the Skill Builder Beta.**
47 |
48 | 2. **Update the slot values for AnswerIntent** In our original Interaction Model, we defined a slot for each property in our data, and they had the exact same names as the properties of our data. You should do the same with your intent schema.
49 |
50 | ### Tips for Your Intent Customization
51 |
52 | * **Make sure you have a slot for every property in your data.**
53 | * **Use built-in slot values when possible.** This will generally make your life easier, but if you need a custom slot, [they're easy to make](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference#custom-slot-syntax). You should have noticed that we created one custom slot for our U.S. states quiz for US state abbreviations.
54 |
55 | 3. **Create any new custom slots you need.** You will need a custom slot for every data value that you can't use a built-in slot value for. While a custom slot doesn't need to be every possible value, it certainly helps to make the list as representative of your expected data as possible.
56 |
57 | 4. **Update your sample utterances.** There is a sample utterance for AnswerIntent for each data type we created. You need to update this list of utterances to represent your data structure instead.
58 |
59 | * **Remember that if you are creating this skill for another language other than English, your sample utterances need to be written in that language, not English.
60 |
61 | 5. **Click the "Save" button when you have completed.**
62 |
63 |
64 |
65 | 3. **New sentences to respond to your users.** There are several sentences and responses that you will want to customize for your skill.
66 |
67 | 1. **Go back to your copy of [index.js]((https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/lambda/src/index.js)).**
68 |
69 | 2. **Look for the comment "TODO: The items below this comment need your attention."** This is the beginning of the section where you need to customize several text strings for your skill. Rather than document all of them here, we have left comments in [index.js]((https://github.com/alexa/skill-sample-nodejs-quiz-game/blob/master/lambda/src/index.js)) to help you understand the purpose of each one.
70 |
71 | 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.
72 |
73 | 4. **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.
74 |
75 | * 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.
76 |
77 | 5. **Once you have made the updates listed on this page, you can click "Next" to move on to Publishing and Certification of your skill.**
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/instructions/6-publication.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Quiz Game Skill
2 | [](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
3 |
4 | ## Get Your Skill Certified and Published
5 |
6 | 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 to launch your skill!
7 |
8 | 1. Select the **Launch** link from the top navigation menu.
9 |
10 | 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!**
11 | * Take the time to get these right so that your skill will pass certification!
12 |
13 | 3. **Write your skill descriptions.**
14 |
15 | * **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).
16 |
17 | 4. **For your example phrases, come up with the three most exciting ways a user can talk to your skill.**
18 |
19 | * **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:
20 |
21 | | Common Failure Points for Example Phrases |
22 | | ----------------------------------------- |
23 | | 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). |
24 | | Example phrases **must** be based on sample utterances specified in your Intent Schema. |
25 | | Your first example phrase **must** include a wake word and your invocation name. |
26 | | Example phrases **must** provide a contextual response. |
27 |
28 | * **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.
29 |
30 | 5. **Create your skill's icons.** You need two sizes of your icon: 108x108px and 512x512px.
31 |
32 |
33 | * **Make sure you have the rights to the icons you create.** Please don't violate any trademarks or copyrights.
34 | * **If you don't have software to make icons, try one of these free options:**
35 |
36 | * [GIMP](https://www.gimp.org/) (Windows/Mac/Linux)
37 | * [Paint.NET](http://www.getpaint.net/index.html) (Windows)
38 | * [Inkscape](http://inkscape.org) (Windows/Mac/Linux)
39 | * [Iconion](http://iconion.com/) (Windows/Mac)
40 |
41 | * To make it easier to get started, we've created blank versions of these icons in both sizes for many formats:
42 |
43 | * [PSD](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/psd._TTH_.zip)
44 | * [PNG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/png._TTH_.zip)
45 | * [GIF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/gif._TTH_.zip)
46 | * [PDF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdf._TTH_.zip)
47 | * [JPG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/jpg._TTH_.zip)
48 | * [SVG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/svg._TTH_.zip)
49 | * [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)
50 | * [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/)
51 |
52 | 6. Choose the most appropriate category for your skill.
53 |
54 | 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) 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.
55 |
56 | 8. **Privacy Policy URL.** This is an optional field, and should not be required for this Quiz Game skill sample. You can leave it blank.
57 |
58 | 9. **Terms of Use URL.** This is also optional, and you can leave it blank.
59 |
60 |
61 | 10. When you're ready, click **Save and Continue** at the bottom of the screen to move onto **Privacy & Compliance**
62 |
63 | 11. * **Does this skill allow users to make purchases or spend real money?** For this quiz game skill, the answer is no. For future skills, make sure you answer this appropriately.
64 |
65 | * **Does this Alexa skill collect users' personal information?** Again, for this quiz game 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.
66 | * Answering "yes" to this question will also require you to provide a link to your Privacy Policy at the bottom of the page.
67 |
68 | * **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 quiz game skill, the answer is **no** because it doesn't target a specific age group.
69 | * Factors to consider in determining if this skill is directed to children under 13 include:
70 | * Subject matter of the skill
71 | * Presence of child-oriented activities and incentives
72 | * Type of language used in the skill
73 | * Music and other audio content in the skill
74 | * How the skill is described and marketed
75 | * Intended audience for the skill
76 |
77 | 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.
78 |
79 | 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.
80 |
81 | 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.
82 |
83 | * Since you are using our Sample, make sure to add a sentence to your Testing Instructions referencing the Sample you used. For example:
84 |
85 | ```
86 | This was built using the Quiz Game Sample.
87 | ```
88 |
89 | This will let the testing team understand what you're providing them, and should decrease the testing time required.
90 |
91 | **Note:** More details on certification are [available here.](https://alexa.design/certification)
92 |
93 | 14. If you feel that your skill is ready for certification, click the **Save and Continue** button at the bottom of the page.
94 |
95 |
96 | 15. **You're done with your submission!** Here are a few things you might need to know:
97 |
98 | * **Certification can take several days to complete.** Please be patient. It takes time because we want to get it right.
99 |
100 | * **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.
101 |
102 | * **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).
103 |
--------------------------------------------------------------------------------
/lambda/custom/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | alexa-skills-kit-samples
5 | quiz
6 | jar
7 | 1.0
8 | quiz
9 | http://developer.amazon.com/ask
10 |
11 |
12 | The Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0.txt
14 |
15 |
16 |
17 |
18 | Alexa Skills Kit
19 | ask-sdk-java@amazon.com
20 | Alexa
21 | http://developer.amazon.com/ask
22 |
23 |
24 |
25 | scm:git:https://github.com/amzn/alexa-skills-kit-java.git
26 | scm:git:https://github.com/amzn/alexa-skills-kit-java.git
27 | https://github.com/amzn/alexa-skills-kit-java.git
28 |
29 |
30 |
31 |
32 | com.amazon.alexa
33 | ask-sdk
34 | 2.5.5
35 |
36 |
37 |
38 |
39 | src
40 |
41 |
42 |
43 | org.apache.maven.plugins
44 | maven-compiler-plugin
45 | 3.7.0
46 |
47 | 1.8
48 | 1.8
49 | true
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/lambda/custom/quiz.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: com.amazon.ask.quiz.QuizSkillStreamHandler
3 |
4 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/QuizSkillStreamHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz;
2 |
3 | import com.amazon.ask.Skills;
4 | import com.amazon.ask.SkillStreamHandler;
5 | import com.amazon.ask.quiz.handlers.ExitSkillHandler;
6 | import com.amazon.ask.quiz.handlers.HelpIntentHandler;
7 | import com.amazon.ask.quiz.handlers.LaunchRequestHandler;
8 | import com.amazon.ask.quiz.handlers.NoAnswerIntentHandler;
9 | import com.amazon.ask.quiz.handlers.AnswerIntentHandler;
10 | import com.amazon.ask.quiz.handlers.QuizAndStartOverIntentHandler;
11 | import com.amazon.ask.quiz.handlers.RepeatIntentHandler;
12 | import com.amazon.ask.quiz.handlers.SessionEndedHandler;
13 |
14 | public class QuizSkillStreamHandler extends SkillStreamHandler {
15 |
16 | public QuizSkillStreamHandler() {
17 | super(Skills.standard()
18 | .addRequestHandlers(new LaunchRequestHandler(), new QuizAndStartOverIntentHandler(), new NoAnswerIntentHandler(),
19 | new AnswerIntentHandler(), new RepeatIntentHandler(), new HelpIntentHandler(),
20 | new ExitSkillHandler(), new SessionEndedHandler())
21 | .build());
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/AnswerIntentHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.IntentRequest;
6 | import com.amazon.ask.model.Response;
7 | import com.amazon.ask.model.Slot;
8 | import com.amazon.ask.quiz.model.Attributes;
9 | import com.amazon.ask.quiz.model.Constants;
10 | import com.amazon.ask.quiz.model.StateProperty;
11 | import com.amazon.ask.quiz.model.State;
12 | import com.amazon.ask.quiz.util.QuestionUtils;
13 | import com.fasterxml.jackson.databind.ObjectMapper;
14 |
15 | import java.util.LinkedHashMap;
16 | import java.util.List;
17 | import java.util.Map;
18 | import java.util.Optional;
19 | import java.util.Random;
20 |
21 | import static com.amazon.ask.quiz.util.QuestionUtils.getPropertyOfState;
22 | import static com.amazon.ask.request.Predicates.intentName;
23 | import static com.amazon.ask.request.Predicates.sessionAttribute;
24 |
25 | public class AnswerIntentHandler implements RequestHandler {
26 |
27 | private static final Random RANDOM = new Random();
28 | private static final ObjectMapper MAPPER = new ObjectMapper();
29 |
30 | @Override
31 | public boolean canHandle(HandlerInput input) {
32 | return input.matches(intentName("AnswerIntent").and(sessionAttribute(Attributes.STATE_KEY, Attributes.QUIZ_STATE)));
33 | }
34 |
35 | @Override
36 | public Optional handle(HandlerInput input) {
37 | Map sessionAttributes = input.getAttributesManager().getSessionAttributes();
38 |
39 | String responseText;
40 | String speechOutput;
41 |
42 | Map quizItem = (LinkedHashMap)sessionAttributes.get(Attributes.QUIZ_ITEM_KEY);
43 | State state = MAPPER.convertValue(quizItem, State.class);
44 |
45 | StateProperty stateProperty = StateProperty.valueOf((String) sessionAttributes.get(Attributes.QUIZ_PROPERTY_KEY));
46 | int counter = (int) sessionAttributes.get(Attributes.COUNTER_KEY);
47 | int quizScore = (int) sessionAttributes.get(Attributes.QUIZ_SCORE_KEY);
48 |
49 | IntentRequest intentRequest = (IntentRequest) input.getRequestEnvelope().getRequest();
50 | boolean correct = compareSlots(intentRequest.getIntent().getSlots(), getPropertyOfState(stateProperty, state));
51 |
52 | if (correct) {
53 | quizScore++;
54 | responseText = getSpeechCon(true);
55 | sessionAttributes.put(Attributes.QUIZ_SCORE_KEY, quizScore);
56 | } else {
57 | responseText = getSpeechCon(false);
58 | }
59 |
60 | responseText += getAnswerText(stateProperty, state);
61 |
62 | if (counter < 10) {
63 | responseText += "Your current score is " + quizScore + " out of " + counter + ". ";
64 | sessionAttributes.put(Attributes.RESPONSE_KEY, responseText);
65 | return QuestionUtils.generateQuestion(input);
66 | } else {
67 | responseText += "Your final score is " + quizScore + " out of " + counter + ". ";
68 | speechOutput = responseText + " " + Constants.EXIT_SKILL_MESSAGE;
69 | return input.getResponseBuilder()
70 | .withSpeech(speechOutput)
71 | .withShouldEndSession(true)
72 | .build();
73 | }
74 | }
75 |
76 | private String getAnswerText(StateProperty stateProperty, State state) {
77 | switch(stateProperty) {
78 | case ABBREVIATION:
79 | return "The " + stateProperty.getValue() + " of " + state.getName() + " is " + getPropertyOfState(stateProperty, state) + ". ";
80 | default:
81 | return "The " + stateProperty.getValue() + " of " + state.getName() + " is " + getPropertyOfState(stateProperty, state) + ". ";
82 | }
83 | }
84 |
85 | private String getSpeechCon(boolean correct) {
86 | if (correct) {
87 | return "" + getRandomItem(Constants.CORRECT_RESPONSES) + "! ";
88 | } else {
89 | return "" + getRandomItem(Constants.INCORRECT_RESPONSES) + " ";
90 | }
91 | }
92 |
93 | private T getRandomItem(List list) {
94 | return list.get(RANDOM.nextInt(list.size()));
95 | }
96 |
97 | private boolean compareSlots(Map slots, String correctAnswer) {
98 | for (Slot slot : slots.values()) {
99 | if (slot.getValue() != null && slot.getValue().toLowerCase().equals(correctAnswer.toLowerCase())) {
100 | return true;
101 | }
102 | }
103 | return false;
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/ExitSkillHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.Response;
6 | import com.amazon.ask.quiz.model.Constants;
7 |
8 | import java.util.Optional;
9 |
10 | import static com.amazon.ask.request.Predicates.intentName;
11 |
12 | public class ExitSkillHandler implements RequestHandler {
13 |
14 | public boolean canHandle(HandlerInput input) {
15 | return input.matches(intentName("AMAZON.StopIntent")
16 | .or(intentName("AMAZON.PauseIntent")
17 | .or(intentName("AMAZON.CancelIntent"))));
18 | }
19 |
20 | public Optional handle(HandlerInput input) {
21 | return input.getResponseBuilder().withSpeech(Constants.EXIT_SKILL_MESSAGE).build();
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/HelpIntentHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.Response;
6 | import com.amazon.ask.quiz.model.Constants;
7 |
8 | import java.util.Optional;
9 |
10 | import static com.amazon.ask.request.Predicates.intentName;
11 |
12 | public class HelpIntentHandler implements RequestHandler {
13 |
14 | @Override
15 | public boolean canHandle(HandlerInput input) {
16 | return input.matches(intentName("AMAZON.HelpIntent"));
17 | }
18 |
19 | @Override
20 | public Optional handle(HandlerInput input) {
21 | return input.getResponseBuilder()
22 | .withSpeech(Constants.HELP_MESSAGE)
23 | .withReprompt(Constants.HELP_MESSAGE)
24 | .withShouldEndSession(false)
25 | .build();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/LaunchRequestHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.LaunchRequest;
6 | import com.amazon.ask.model.Response;
7 | import com.amazon.ask.quiz.model.Attributes;
8 | import com.amazon.ask.quiz.model.Constants;
9 |
10 | import java.util.Map;
11 | import java.util.Optional;
12 |
13 | import static com.amazon.ask.request.Predicates.requestType;
14 |
15 | public class LaunchRequestHandler implements RequestHandler {
16 |
17 | @Override
18 | public boolean canHandle(HandlerInput input) {
19 | return input.matches(requestType(LaunchRequest.class));
20 | }
21 |
22 | @Override
23 | public Optional handle(HandlerInput input) {
24 | Map sessionAttributes = input.getAttributesManager().getSessionAttributes();
25 | sessionAttributes.put(Attributes.STATE_KEY, Attributes.START_STATE);
26 | return input.getResponseBuilder()
27 | .withSpeech(Constants.WELCOME_MESSAGE)
28 | .withReprompt(Constants.HELP_MESSAGE)
29 | .withShouldEndSession(false)
30 | .build();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/NoAnswerIntentHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.IntentRequest;
6 | import com.amazon.ask.model.Response;
7 | import com.amazon.ask.model.ui.Image;
8 | import com.amazon.ask.quiz.model.Attributes;
9 | import com.amazon.ask.quiz.model.Constants;
10 | import com.amazon.ask.quiz.model.State;
11 |
12 | import java.util.Map;
13 | import java.util.Optional;
14 |
15 | import static com.amazon.ask.quiz.util.QuestionUtils.getState;
16 | import static com.amazon.ask.request.Predicates.intentName;
17 | import static com.amazon.ask.request.Predicates.sessionAttribute;
18 |
19 | public class NoAnswerIntentHandler implements RequestHandler {
20 |
21 | @Override
22 | public boolean canHandle(HandlerInput input) {
23 | return input.matches(intentName("AnswerIntent").and(sessionAttribute(Attributes.STATE_KEY, Attributes.QUIZ_STATE).negate()));
24 | }
25 |
26 | @Override
27 | public Optional handle(HandlerInput input) {
28 | Map sessionAttributes = input.getAttributesManager().getSessionAttributes();
29 | sessionAttributes.put(Attributes.STATE_KEY, Attributes.START_STATE);
30 |
31 | IntentRequest intentRequest = (IntentRequest) input.getRequestEnvelope().getRequest();
32 | Optional state = getState(intentRequest.getIntent().getSlots());
33 |
34 | if (state.isPresent()) {
35 | if (Constants.USE_CARDS_FLAG) {
36 | Image image = Image.builder()
37 | .withSmallImageUrl(getSmallImage(state.get()))
38 | .withSmallImageUrl(getLargeImage(state.get()))
39 | .build();
40 | return input.getResponseBuilder()
41 | .withSpeech(getSpeechDescription(state.get()))
42 | .withReprompt(Constants.REPROMPT_MESSAGE)
43 | .withStandardCard(state.get().getName(), getTextDescription(state.get()), image)
44 | .withShouldEndSession(false)
45 | .build();
46 |
47 | } else {
48 | return input.getResponseBuilder()
49 | .withSpeech(getSpeechDescription(state.get()))
50 | .withReprompt(Constants.REPROMPT_MESSAGE)
51 | .withShouldEndSession(false)
52 | .build();
53 | }
54 | } else {
55 | String unknownAnswerText = "I'm sorry. That is not something I know very much about in this skill. " + Constants.HELP_MESSAGE;
56 | return input.getResponseBuilder()
57 | .withSpeech(unknownAnswerText)
58 | .withReprompt(unknownAnswerText)
59 | .withShouldEndSession(false)
60 | .build();
61 | }
62 | }
63 |
64 | private String getTextDescription(State state) {
65 | return "Abbreviation: " + state.getAbbreviation() + "\n"
66 | + "Capital: " + state.getCapital() + "\n"
67 | + "Statehood Year: " + state.getStatehoodYear() + "\n"
68 | + "Statehood Order: " + state.getStatehoodOrder();
69 | }
70 |
71 | private String getSpeechDescription(State state) {
72 | return state.getName() + " is the " + state.getStatehoodOrder() + "th state, admitted to the Union in "
73 | + state.getStatehoodYear() + ". The capital of " + state.getStatehoodOrder() + " is " + state.getCapital()
74 | + ", and the abbreviation for " + state.getName() + " is "
75 | + state.getAbbreviation() + ". I've added " + state.getName() + " to your Alexa app. Which other state or capital would you like to know about?";
76 | }
77 |
78 | private String getSmallImage(State state) {
79 | return "https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/quiz-game/state_flag/720x400/" + state.getAbbreviation() + "._TTH_.png";
80 | }
81 |
82 | private String getLargeImage(State state) {
83 | return "https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/quiz-game/state_flag/1200x800/" + state.getAbbreviation() + "._TTH_.png";
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/QuizAndStartOverIntentHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.Response;
6 | import com.amazon.ask.quiz.model.Attributes;
7 | import com.amazon.ask.quiz.util.QuestionUtils;
8 |
9 | import java.util.Map;
10 | import java.util.Optional;
11 |
12 | import static com.amazon.ask.request.Predicates.intentName;
13 | import static com.amazon.ask.request.Predicates.sessionAttribute;
14 |
15 | public class QuizAndStartOverIntentHandler implements RequestHandler {
16 |
17 | @Override
18 | public boolean canHandle(HandlerInput input) {
19 | return input.matches(intentName("QuizIntent").and(sessionAttribute(Attributes.STATE_KEY, Attributes.QUIZ_STATE).negate()))
20 | || input.matches(intentName("AMAZON.StartOverIntent"));
21 | }
22 |
23 | @Override
24 | public Optional handle(HandlerInput input) {
25 | Map sessionAttributes = input.getAttributesManager().getSessionAttributes();
26 | sessionAttributes.put(Attributes.STATE_KEY, Attributes.QUIZ_STATE);
27 | sessionAttributes.put(Attributes.RESPONSE_KEY, "");
28 | sessionAttributes.put(Attributes.COUNTER_KEY, 0);
29 | sessionAttributes.put(Attributes.QUIZ_SCORE_KEY, 0);
30 |
31 | return QuestionUtils.generateQuestion(input);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/RepeatIntentHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.Response;
6 | import com.amazon.ask.quiz.model.Attributes;
7 | import com.amazon.ask.quiz.model.StateProperty;
8 | import com.amazon.ask.quiz.model.State;
9 |
10 | import java.util.Map;
11 | import java.util.Optional;
12 |
13 | import static com.amazon.ask.quiz.util.QuestionUtils.getQuestionText;
14 | import static com.amazon.ask.request.Predicates.intentName;
15 | import static com.amazon.ask.request.Predicates.sessionAttribute;
16 |
17 | public class RepeatIntentHandler implements RequestHandler {
18 |
19 | @Override
20 | public boolean canHandle(HandlerInput input) {
21 | return input.matches(intentName("AMAZON.RepeatIntent").and(sessionAttribute(Attributes.STATE_KEY, Attributes.QUIZ_STATE)));
22 | }
23 |
24 | @Override
25 | public Optional handle(HandlerInput input) {
26 | Map sessionAttributes = input.getAttributesManager().getSessionAttributes();
27 | int counter = (int) sessionAttributes.get(Attributes.COUNTER_KEY);
28 | StateProperty stateProperty = (StateProperty) sessionAttributes.get(Attributes.QUIZ_PROPERTY_KEY);
29 | State state = (State) sessionAttributes.get(Attributes.QUIZ_ITEM_KEY);
30 |
31 | String question = getQuestionText(counter, stateProperty, state);
32 | return input.getResponseBuilder()
33 | .withSpeech(question)
34 | .withReprompt(question)
35 | .withShouldEndSession(false)
36 | .build();
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/handlers/SessionEndedHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.handlers;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.dispatcher.request.handler.RequestHandler;
5 | import com.amazon.ask.model.Response;
6 | import com.amazon.ask.model.SessionEndedRequest;
7 | import org.slf4j.Logger;
8 |
9 | import java.util.Optional;
10 |
11 | import static com.amazon.ask.request.Predicates.requestType;
12 | import static org.slf4j.LoggerFactory.getLogger;
13 |
14 | public class SessionEndedHandler implements RequestHandler {
15 |
16 | private static Logger LOG = getLogger(SessionEndedHandler.class);
17 |
18 | @Override
19 | public boolean canHandle(HandlerInput input) {
20 | return input.matches(requestType(SessionEndedRequest.class));
21 | }
22 |
23 | @Override
24 | public Optional handle(HandlerInput input) {
25 | SessionEndedRequest sessionEndedRequest = (SessionEndedRequest) input.getRequestEnvelope().getRequest();
26 | LOG.debug("Session ended with reason: " + sessionEndedRequest.getReason().toString());
27 | return Optional.empty();
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/model/Attributes.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.model;
2 |
3 | public final class Attributes {
4 |
5 | public static final String STATE_KEY = "state";
6 | public static final String QUIZ_ITEM_KEY = "quizitem";
7 | public static final String QUIZ_SCORE_KEY = "quizscore";
8 | public static final String QUIZ_PROPERTY_KEY = "quizproperty";
9 | public static final String COUNTER_KEY = "counter";
10 | public static final String RESPONSE_KEY = "response";
11 |
12 | public static final String START_STATE = "_START";
13 | public static final String QUIZ_STATE = "_QUIZ";
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/model/Constants.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.model;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class Constants {
7 |
8 | public static final List STATES = Arrays.asList(
9 | new State("Alabama", "AL","Montgomery", "1819", "22"),
10 | new State("Alaska", "AK","Juneau", "1959", "49"),
11 | new State("Arizona", "AZ","Phoenix", "1912", "48"),
12 | new State("Arkansas", "AR","Little Rock", "1836", "25"),
13 | new State("California", "CA","Sacramento", "1850", "31"),
14 | new State("Colorado", "CO","Denver", "1876", "38"),
15 | new State("Connecticut", "CT","Hartford", "1788", "5"),
16 | new State("Delaware", "DE","Dover", "1787", "1"),
17 | new State("Florida", "FL","Tallahassee", "1845", "27"),
18 | new State("Georgia", "GA","Atlanta", "1788", "4"),
19 | new State("Hawaii", "HI","Honolulu", "1959", "50"),
20 | new State("Idaho", "ID","Boise", "1890", "43"),
21 | new State("Illinois", "IL","Springfield", "1818", "21"),
22 | new State("Indiana", "IN","Indianapolis", "1816", "19"),
23 | new State("Iowa", "IA","Des Moines", "1846", "29"),
24 | new State("Kansas", "KS","Topeka", "1861", "34"),
25 | new State("Kentucky", "KY","Frankfort", "1792", "15"),
26 | new State("Louisiana", "LA","Baton Rouge", "1812", "18"),
27 | new State("Maine", "ME","Augusta", "1820", "23"),
28 | new State("Maryland", "MD","Annapolis", "1788", "7"),
29 | new State("Massachusetts", "MA","Boston", "1788", "6"),
30 | new State("Michigan", "MI","Lansing", "1837", "26"),
31 | new State("Minnesota", "MN","St. Paul", "1858", "32"),
32 | new State("Mississippi", "MS","Jackson", "1817", "20"),
33 | new State("Missouri", "MO","Jefferson City", "1821", "24"),
34 | new State("Montana", "MT","Helena", "1889", "41"),
35 | new State("Nebraska", "NE","Lincoln", "1867", "37"),
36 | new State("Nevada", "NV","Carson City", "1864", "36"),
37 | new State("New Hampshire", "NH","Concord", "1788", "9"),
38 | new State("New Jersey", "NJ","Trenton", "1787", "3"),
39 | new State("New Mexico", "NM","Santa Fe", "1912", "47"),
40 | new State("New York", "NY","Albany", "1788", "11"),
41 | new State("North Carolina", "NC","Raleigh", "1789", "12"),
42 | new State("North Dakota", "ND","Bismarck", "1889", "39"),
43 | new State("Ohio", "OH","Columbus", "1803", "17"),
44 | new State("Oklahoma", "OK","Oklahoma City", "1907", "46"),
45 | new State("Oregon", "OR","Salem", "1859", "33"),
46 | new State("Pennsylvania", "PA","Harrisburg", "1787", "2"),
47 | new State("Rhode Island", "RI","Providence", "1790", "13"),
48 | new State("South Carolina", "SC","Columbia", "1788", "8"),
49 | new State("South Dakota", "SD","Pierre", "1889", "40"),
50 | new State("Tennessee", "TN","Nashville", "1796", "16"),
51 | new State("Texas", "TX","Austin", "1845", "28"),
52 | new State("Utah", "UT","Salt Lake City", "1896", "45"),
53 | new State("Vermont", "VT","Montpelier", "1791", "14"),
54 | new State("Virginia", "VA","Richmond", "1788", "10"),
55 | new State("Washington", "WA","Olympia", "1889", "42"),
56 | new State("West Virginia", "WV","Charleston", "1863", "35"),
57 | new State("Wisconsin", "WI","Madison", "1848", "30"),
58 | new State("Wyoming", "WY","Cheyenne", "1890", "44")
59 | );
60 |
61 | public static boolean USE_CARDS_FLAG = true;
62 |
63 | public static String WELCOME_MESSAGE = "Welcome to the United States Quiz Game! You can ask me about any of the fifty states and their capitals, or you can ask me to start a quiz. What would you like to do?";
64 |
65 | public static String START_QUIZ_MESSAGE = "OK. I will ask you 10 questions about the United States.";
66 |
67 | // This is the message a user will hear when they try to cancel or stop the
68 | // skill, or when they finish a quiz.
69 | public static String EXIT_SKILL_MESSAGE = "Thank you for playing the United States Quiz Game! Let's play again soon!";
70 |
71 | // This is the message a user will hear after they ask (and hear) about a
72 | // specific data element.
73 | public static String REPROMPT_MESSAGE = "Which other state or capital would you like to know about?";
74 |
75 | // This is the message a user will hear when they ask Alexa for help in your
76 | // skill.
77 | public static String HELP_MESSAGE = "I know lots of things about the United States. You can ask me about a state or a capital, and I'll tell you what I know. You can also test your knowledge by asking me to start a quiz. What would you like to do?";
78 |
79 | public static List CORRECT_RESPONSES = Arrays.asList("Booya", "All righty", "Bam", "Bazinga", "Bingo", "Boom", "Bravo", "Cha Ching", "Cheers", "Dynomite",
80 | "Hip hip hooray", "Hurrah", "Hurray", "Huzzah", "Oh dear. Just kidding. Hurray", "Kaboom", "Kaching", "Oh snap", "Phew",
81 | "Righto", "Way to go", "Well done", "Whee", "Woo hoo", "Yay", "Wowza", "Yowsa");
82 |
83 | public static List INCORRECT_RESPONSES = Arrays.asList("Argh", "Aw man", "Blarg", "Blast", "Boo", "Bummer", "Darn", "D'oh", "Dun dun dun", "Eek", "Honk", "Le sigh",
84 | "Mamma mia", "Oh boy", "Oh dear", "Oof", "Ouch", "Ruh roh", "Shucks", "Uh oh", "Wah wah", "Whoops a daisy", "Yikes");
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/model/State.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.model;
2 |
3 | public class State {
4 |
5 | private String name;
6 | private String abbreviation;
7 | private String capital;
8 | private String statehoodYear;
9 | private String statehoodOrder;
10 |
11 | public State() {}
12 |
13 | public State(String name, String abbreviation, String capital, String statehoodYear, String statehoodOrder) {
14 | this.name = name;
15 | this.abbreviation = abbreviation;
16 | this.capital = capital;
17 | this.statehoodYear = statehoodYear;
18 | this.statehoodOrder = statehoodOrder;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public String getAbbreviation() {
26 | return abbreviation;
27 | }
28 |
29 | public String getCapital() {
30 | return capital;
31 | }
32 |
33 | public String getStatehoodYear() { return statehoodYear; }
34 |
35 | public String getStatehoodOrder() {
36 | return statehoodOrder;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public void setAbbreviation(String abbreviation) {
44 | this.abbreviation = abbreviation;
45 | }
46 |
47 | public void setCapital(String capital) {
48 | this.capital = capital;
49 | }
50 |
51 | public void setStatehoodYear(String statehoodYear) {
52 | this.statehoodYear = statehoodYear;
53 | }
54 |
55 | public void setStatehoodOrder(String statehoodOrder) {
56 | this.statehoodOrder = statehoodOrder;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/model/StateProperty.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.model;
2 |
3 | public enum StateProperty {
4 |
5 | NAME("name"),
6 | ABBREVIATION("abbreviation"),
7 | CAPITAL("capital"),
8 | STATEHOOD_YEAR("statehood year"),
9 | STATEHOOD_ORDER("statehood order");
10 |
11 | private String value;
12 |
13 | public String getValue() {
14 | return value;
15 | }
16 |
17 | StateProperty(String value) {
18 | this.value = value;
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/lambda/custom/src/main/java/com/amazon/ask/quiz/util/QuestionUtils.java:
--------------------------------------------------------------------------------
1 | package com.amazon.ask.quiz.util;
2 |
3 | import com.amazon.ask.dispatcher.request.handler.HandlerInput;
4 | import com.amazon.ask.model.Response;
5 | import com.amazon.ask.model.Slot;
6 | import com.amazon.ask.quiz.model.Attributes;
7 | import com.amazon.ask.quiz.model.StateProperty;
8 | import com.amazon.ask.quiz.model.State;
9 |
10 | import java.util.Map;
11 | import java.util.Optional;
12 | import java.util.Random;
13 |
14 | import static com.amazon.ask.quiz.model.Constants.START_QUIZ_MESSAGE;
15 | import static com.amazon.ask.quiz.model.Constants.STATES;
16 |
17 | public class QuestionUtils {
18 |
19 | private static final Random RANDOM = new Random();
20 |
21 | public static Optional generateQuestion(HandlerInput input) {
22 | Map sessionAttributes = input.getAttributesManager().getSessionAttributes();
23 |
24 | int counter = (int)sessionAttributes.get(Attributes.COUNTER_KEY);
25 |
26 | if (counter == 0) {
27 | sessionAttributes.put(Attributes.RESPONSE_KEY, START_QUIZ_MESSAGE + " ");
28 | }
29 |
30 | counter++;
31 | State state = getRandomState();
32 | StateProperty stateProperty = getRandomProperty();
33 |
34 | sessionAttributes.put(Attributes.QUIZ_ITEM_KEY, state);
35 | sessionAttributes.put(Attributes.QUIZ_PROPERTY_KEY, stateProperty);
36 | sessionAttributes.put(Attributes.COUNTER_KEY, counter);
37 |
38 | String question = getQuestionText(counter, stateProperty, state);
39 | String speech = sessionAttributes.get(Attributes.RESPONSE_KEY) + question;
40 |
41 | return input.getResponseBuilder()
42 | .withSpeech(speech)
43 | .withReprompt(question)
44 | .withShouldEndSession(false)
45 | .build();
46 | }
47 |
48 | public static String getQuestionText(int counter, StateProperty stateProperty, State state) {
49 | return "Here is your " + counter + "th question. What is the " + stateProperty.getValue() + " of " + state.getName() + "?";
50 | }
51 |
52 | public static Optional getState(Map slots) {
53 | for (Slot slot : slots.values()) {
54 | String value = slot.getValue();
55 | for (StateProperty stateProperty : StateProperty.values()) {
56 | Optional state = STATES.stream()
57 | .filter(s -> getPropertyOfState(stateProperty, s).equals(value))
58 | .findAny();
59 | if (state.isPresent()) {
60 | return state;
61 | }
62 | }
63 | }
64 | return Optional.empty();
65 | }
66 |
67 | public static String getPropertyOfState(StateProperty stateProperty, State state) {
68 | switch (stateProperty) {
69 | case NAME:
70 | return state.getName();
71 | case ABBREVIATION:
72 | return state.getAbbreviation();
73 | case CAPITAL:
74 | return state.getCapital();
75 | case STATEHOOD_YEAR:
76 | return state.getStatehoodYear();
77 | case STATEHOOD_ORDER:
78 | return state.getStatehoodOrder();
79 | }
80 | throw new IllegalStateException("Invalid stateProperty");
81 | }
82 |
83 | private static State getRandomState() {
84 | return STATES.get(RANDOM.nextInt(STATES.size()));
85 | }
86 |
87 | private static StateProperty getRandomProperty() {
88 | return StateProperty.values()[RANDOM.nextInt(StateProperty.values().length -1) + 1];
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/skill-package/interactionModels/custom/en-US.json:
--------------------------------------------------------------------------------
1 | {
2 | "interactionModel": {
3 | "languageModel": {
4 | "invocationName": "quiz game",
5 | "intents": [
6 | {
7 | "name": "AMAZON.CancelIntent",
8 | "samples": []
9 | },
10 | {
11 | "name": "AMAZON.HelpIntent",
12 | "samples": []
13 | },
14 | {
15 | "name": "AMAZON.PauseIntent",
16 | "samples": []
17 | },
18 | {
19 | "name": "AMAZON.StartOverIntent",
20 | "samples": []
21 | },
22 | {
23 | "name": "AMAZON.StopIntent",
24 | "samples": []
25 | },
26 | {
27 | "name": "AnswerIntent",
28 | "samples": [
29 | "{StateName}",
30 | "{Capital}",
31 | "{StatehoodYear}",
32 | "{StatehoodOrder}",
33 | "{Abbreviation}",
34 | "tell me about {StateName}",
35 | "tell me about {Capital}",
36 | "tell me about {StatehoodYear}",
37 | "tell me about {StatehoodOrder}",
38 | "tell me about {Abbreviation}",
39 | "what do you know about {StateName}",
40 | "what do you know about {Capital}",
41 | "what do you know about {StatehoodYear}",
42 | "what do you know about {StatehoodOrder}",
43 | "what do you know about {Abbreviation}",
44 | "{StateName} information",
45 | "{Capital} information",
46 | "{StatehoodYear} information",
47 | "{StatehoodOrder} information",
48 | "{Abbreviation} information"
49 | ],
50 | "slots": [
51 | {
52 | "name": "StateName",
53 | "type": "AMAZON.US_STATE",
54 | "samples": []
55 | },
56 | {
57 | "name": "Capital",
58 | "type": "AMAZON.US_CITY",
59 | "samples": []
60 | },
61 | {
62 | "name": "StatehoodYear",
63 | "type": "AMAZON.FOUR_DIGIT_NUMBER",
64 | "samples": []
65 | },
66 | {
67 | "name": "Abbreviation",
68 | "type": "US_STATE_ABBR",
69 | "samples": []
70 | },
71 | {
72 | "name": "StatehoodOrder",
73 | "type": "AMAZON.NUMBER",
74 | "samples": []
75 | }
76 | ]
77 | },
78 | {
79 | "name": "QuizIntent",
80 | "samples": [
81 | "start a quiz",
82 | "start a quiz game",
83 | "and start a quiz",
84 | "and quiz me",
85 | "for a quiz",
86 | "a quiz"
87 | ],
88 | "slots": []
89 | }
90 | ],
91 | "types": [
92 | {
93 | "name": "US_STATE_ABBR",
94 | "values": [
95 | {
96 | "name": {
97 | "value": "AK"
98 | }
99 | },
100 | {
101 | "name": {
102 | "value": "AL"
103 | }
104 | },
105 | {
106 | "name": {
107 | "value": "AZ"
108 | }
109 | },
110 | {
111 | "name": {
112 | "value": "AR"
113 | }
114 | },
115 | {
116 | "name": {
117 | "value": "CA"
118 | }
119 | },
120 | {
121 | "name": {
122 | "value": "CO"
123 | }
124 | },
125 | {
126 | "name": {
127 | "value": "CT"
128 | }
129 | },
130 | {
131 | "name": {
132 | "value": "DE"
133 | }
134 | },
135 | {
136 | "name": {
137 | "value": "FL"
138 | }
139 | },
140 | {
141 | "name": {
142 | "value": "GA"
143 | }
144 | },
145 | {
146 | "name": {
147 | "value": "HI"
148 | }
149 | },
150 | {
151 | "name": {
152 | "value": "ID"
153 | }
154 | },
155 | {
156 | "name": {
157 | "value": "IL"
158 | }
159 | },
160 | {
161 | "name": {
162 | "value": "IN"
163 | }
164 | },
165 | {
166 | "name": {
167 | "value": "IA"
168 | }
169 | },
170 | {
171 | "name": {
172 | "value": "KS"
173 | }
174 | },
175 | {
176 | "name": {
177 | "value": "KY"
178 | }
179 | },
180 | {
181 | "name": {
182 | "value": "LA"
183 | }
184 | },
185 | {
186 | "name": {
187 | "value": "ME"
188 | }
189 | },
190 | {
191 | "name": {
192 | "value": "MD"
193 | }
194 | },
195 | {
196 | "name": {
197 | "value": "MA"
198 | }
199 | },
200 | {
201 | "name": {
202 | "value": "MI"
203 | }
204 | },
205 | {
206 | "name": {
207 | "value": "MN"
208 | }
209 | },
210 | {
211 | "name": {
212 | "value": "MS"
213 | }
214 | },
215 | {
216 | "name": {
217 | "value": "MO"
218 | }
219 | },
220 | {
221 | "name": {
222 | "value": "MT"
223 | }
224 | },
225 | {
226 | "name": {
227 | "value": "NE"
228 | }
229 | },
230 | {
231 | "name": {
232 | "value": "NV"
233 | }
234 | },
235 | {
236 | "name": {
237 | "value": "NH"
238 | }
239 | },
240 | {
241 | "name": {
242 | "value": "NJ"
243 | }
244 | },
245 | {
246 | "name": {
247 | "value": "NM"
248 | }
249 | },
250 | {
251 | "name": {
252 | "value": "NY"
253 | }
254 | },
255 | {
256 | "name": {
257 | "value": "NC"
258 | }
259 | },
260 | {
261 | "name": {
262 | "value": "ND"
263 | }
264 | },
265 | {
266 | "name": {
267 | "value": "OH"
268 | }
269 | },
270 | {
271 | "name": {
272 | "value": "OK"
273 | }
274 | },
275 | {
276 | "name": {
277 | "value": "OR"
278 | }
279 | },
280 | {
281 | "name": {
282 | "value": "PA"
283 | }
284 | },
285 | {
286 | "name": {
287 | "value": "RI"
288 | }
289 | },
290 | {
291 | "name": {
292 | "value": "SC"
293 | }
294 | },
295 | {
296 | "name": {
297 | "value": "SD"
298 | }
299 | },
300 | {
301 | "name": {
302 | "value": "TN"
303 | }
304 | },
305 | {
306 | "name": {
307 | "value": "TX"
308 | }
309 | },
310 | {
311 | "name": {
312 | "value": "UT"
313 | }
314 | },
315 | {
316 | "name": {
317 | "value": "VT"
318 | }
319 | },
320 | {
321 | "name": {
322 | "value": "VA"
323 | }
324 | },
325 | {
326 | "name": {
327 | "value": "WA"
328 | }
329 | },
330 | {
331 | "name": {
332 | "value": "WV"
333 | }
334 | },
335 | {
336 | "name": {
337 | "value": "WI"
338 | }
339 | },
340 | {
341 | "name": {
342 | "value": "WY"
343 | }
344 | }
345 | ]
346 | }
347 | ]
348 | }
349 | }
350 | }
351 |
--------------------------------------------------------------------------------
/skill-package/skill.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest": {
3 | "publishingInformation": {
4 | "locales": {
5 | "en-US": {
6 | "summary": "Test your knowledge of the US states and their capitals.",
7 | "examplePhrases": [
8 | "Alexa, open States Quiz",
9 | "Alexa, play States Quiz"
10 | ],
11 | "keywords": [
12 | "quiz",
13 | "games",
14 | "geography"
15 | ],
16 | "name": "States Quiz",
17 | "description": "Test your knowledge of the US states and their capitals.\n\nTo start, just say \"Alexa, launch States Quiz\" or \"Alexa, open States Quiz\" to start the game\".\n\nAt anytime, you can stop the game by saying \"Alexa, stop\""
18 | },
19 | "en-GB": {
20 | "summary": "Test your knowledge of the US states and their capitals..",
21 | "examplePhrases": [
22 | "Alexa, open States Quiz",
23 | "Alexa, play States Quiz"
24 | ],
25 | "keywords": [
26 | "quiz",
27 | "games",
28 | "geography"
29 | ],
30 | "name": "States Quiz",
31 | "description": "Test your knowledge of the US states and their capitals.\n\nTo start, just say \"Alexa, launch States Quiz\" or \"Alexa, open States Quiz\" to start the game\".\n\nAt anytime, you can stop the game by saying \"Alexa, stop\""
32 | }
33 | }
34 | },
35 | "apis": {
36 | "custom": {}
37 | },
38 | "manifestVersion": "1.0"
39 | }
40 | }
41 |
--------------------------------------------------------------------------------