├── LICENSE
├── NOTICE
├── README.md
├── sampleTriviaPython.py
├── speechAssets
└── IntentSchema.json
└── step-by-step
├── 1-voice-user-interface-fig1.png
├── 1-voice-user-interface-fig2.png
├── 1-voice-user-interface-fig3.png
├── 1-voice-user-interface.md
├── 2-lambda-fig1.png
├── 2-lambda-fig2.png
├── 2-lambda-fig3.png
├── 2-lambda-fig4.png
├── 2-lambda-function.md
├── 3-connect-vui-to-code.md
├── 4-testing-fig1.png
├── 4-testing-fig2.png
├── 4-testing.md
└── lambda-role.md
/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 Trivia Skill in Python
2 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ** This repository has been archived **
2 | This repository is still available as a point-in-time reference, but no further updates or support will be prioritized.
3 |
4 | # _NOTE: This repo does not use the beta Python SDK which can be found here:_ https://github.com/alexa-labs/alexa-skills-kit-sdk-for-python/
5 | ### Samples based on the beta SDK can be found here: https://github.com/alexa-labs/alexa-skills-kit-sdk-for-python/tree/master/samples
6 |
7 | ---
8 |
9 | # Build An Alexa Trivia Skill in Python
10 |
11 |
12 | [](1-voice-user-interface.md)[](2-lambda-function.md)[](3-connect-vui-to-code.md)[](4-testing.md)
13 |
14 | ## What You Will Learn
15 | * [AWS Lambda](http://aws.amazon.com/lambda)
16 | * [Alexa Skills Kit (ASK)](https://developer.amazon.com/alexa-skills-kit)
17 | * Using the [Skill builder (beta)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/ask-define-the-vui-with-gui)
18 | * Voice User Interface (VUI) Design
19 |
20 |
21 | ## What You Will Need
22 | * [Amazon Developer Portal Account](http://developer.amazon.com)
23 | * [Amazon Web Services Account](http://aws.amazon.com/)
24 | * The sample code on [GitHub](https://github.com/alexa/skill-sample-nodejs-fact).
25 | * A basic understanding of Python.
26 |
27 | ## What Your Skill Will Do
28 | This simple "quiz" Skill will teach you how the different pieces of the Alexa Skill development process fit together. The Skill allows users to request a simple multiple choice trivia with 5 random questions about Reindeer.
29 |
30 | We use will use the new Skill builder UI to build the Skill although the quiz itself does not employ the new "Dialog-Delegate interface" model.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/sampleTriviaPython.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """ Trivia quiz.. """
3 | from __future__ import print_function
4 | import math
5 | import string
6 | import random
7 |
8 | GAME_STATE_TRIVIA = "TRIVIA"
9 | GAME_STATE_START = "START"
10 | GAME_STATE_HELP = "HELP"
11 |
12 | GAME_QUESTIONS_KEY = "gameQuestions"
13 | ANSWERTEXT_KEY = "correctAnswerText"
14 | SCORE = "score"
15 | CORRECTANSWERINDEX = "correctAnswerIndex"
16 | SPEECHOUTPUT_KEY = "speechOutput"
17 | REPROMPT_KEY = "repromptText"
18 | CURRENTQUESTION_KEY = "currentQuestionIndex"
19 | STATE_KEY = "state"
20 | LOCALE = "locale"
21 |
22 | COUNTER = 0
23 | QUIZSCORE = 0
24 | GAME_LENGTH = 5
25 | ANSWER_COUNT = 4
26 |
27 | game_state = GAME_STATE_START
28 |
29 | """
30 | * When editing your questions pay attention to your punctuation. Make sure you use question marks or periods.
31 | * Make sure the first answer is the correct one. Set at least ANSWER_COUNT answers, any extras will be shuffled in.
32 | """
33 |
34 | languageSupport = {
35 | "en-US": {
36 | "translation": {
37 | "QUESTIONS": [
38 | {
39 | "Reindeer have very thick coats, how many hairs per square inch do they have?":
40 | ["13,000", "1,200", "5,000", "700", "1,000", "120,000" ]},
41 | {
42 | "The 1964 classic Rudolph The Red Nosed Reindeer was filmed in. ":
43 | ["Japan", "United States", "Finland", "Germany", "Canada", "Norway", "France"]
44 | },
45 | {
46 | "Santas reindeer are cared for by one of the Christmas elves, what is his name?":
47 | ["Wunorse Openslae", "Alabaster Snowball", "Bushy Evergreen", "Pepper Minstix"]
48 | },
49 | {
50 | "If all of Santas reindeer had antlers while pulling his Christmas sleigh, they would all be. ":
51 | ["Girls", "Boys", "Girls and boys", "No way to tell"]
52 | },
53 | {
54 | "What do Reindeer eat?":
55 | ["Lichen", "Grasses", "Leaves" ,"Berries"]
56 | },
57 | {
58 | "What of the following is not true?":
59 | ["Caribou live on all continents",
60 | "Both reindeer and Caribou are the same species",
61 | "Caribou are bigger than reindeer",
62 | "Reindeer live in Scandinavia and Russia"]
63 | },
64 | {
65 | "In what year did Rudolph make his television debut?":
66 | ["1964", "1979", "2000", "1956"]
67 | },
68 | {
69 | "Who was the voice of Rudolph in the 1964 classic?":
70 | ["Billie Mae Richards", "Burl Ives", "Paul Soles", "Lady Gaga"]
71 | },
72 | {
73 | "In 1939 what retailer used the story of Rudolph the Red Nose Reindeer?":
74 | ["Montgomery Ward", "Sears", "Macys", "Kmart"]
75 | },
76 | {
77 | "Santa's reindeer named Donner was originally named what?":
78 | ["Dunder", "Donny", "Dweedle", "Dreamy"]
79 | },
80 | {
81 | "Who invented the story of Rudolph?":
82 | ["Robert May", "Johnny Marks", "Santa", "J.K. Rowling"]
83 | },
84 | {
85 | "In what location will you not find reindeer?":
86 | ["North Pole", "Lapland", "Korvatunturi mountain", "Finland"]
87 | },
88 | {
89 | "What Makes Santa's Reindeer Fly?":
90 | ["Magical Reindeer Dust", "Fusion", "Amanita muscaria", "Elves"]
91 | },
92 | {
93 | "Including Rudolph, how many reindeer hooves are there?":
94 | ["36", "24", "16", "8"]
95 | },
96 | {
97 | "Santa only has one female reindeer. Which one is it?": [
98 | "Vixen", "Clarice", "Cupid", "Comet"]
99 | },
100 | {
101 | "In the 1964 classic Rudolph The Red Nosed Reindeer, what was the snowman narrators name?": [
102 | "Sam", "Frosty", "Burl", "Snowy"]
103 | },
104 | {
105 | "What was Rudolph's father's name?": [
106 | "Donner", "Dasher", "Blixen", "Comet"]
107 | },
108 | {
109 | "In the 1964 movie, What was the name of the coach of the Reindeer Games?": [
110 | "Comet", "Blixen", "Donner", "Dasher"]
111 | },
112 | {
113 | "In the 1964 movie, what is the name of the deer that Rudolph befriends at the reindeer games?": [
114 | "Fireball", "Clarice", "Jumper", "Vixen"]
115 | },
116 | {
117 | "In the 1964 movie, How did Donner, Rudolph's father, try to hide Rudolph's nose?": [
118 | "Black mud", "Bag", "Pillow case", "Sock"]
119 | },
120 | {
121 | "In the 1964 movie, what does the Misfit Elf want to be instead of a Santa Elf?": [
122 | "Dentist", "Reindeer", "Toy maker", "Candlestick maker"]
123 | },
124 | {
125 | "In the 1964 movie,what was the Bumble's one weakness?": [
126 | "Could not swim", "Always hungry", "Candy canes", "Cross eyed"]
127 | },
128 | {
129 | "In the 1964 movie, what is Yukon Cornelius really in search of?": [
130 | "Peppermint", "Gold", "India", "Polar Bears"]
131 | },
132 | {
133 | "In the 1964 movie, why is the train on the Island of Misfit Toys?": [
134 | "Square wheels", "No Engine", "Paint does not match", "It does not toot"]
135 | },
136 | {
137 | "In the 1964 movie, what is the name of the Jack in the Box?": [
138 | "Charlie", "Sam", "Billy", "Jack"]
139 | },
140 | {
141 | "In the 1964 movie, why did Santa Claus almost cancel Christmas?": [
142 | "Storm", "No snow", "No toys", "The Reindeer were sick"]
143 | },
144 | {
145 | "In the 1964 movie, what animal noise did the elf make to distract the Bumble?": [
146 | "Oink", "Growl", "Bark", "Meow"]
147 | },
148 | {
149 | "In the 1964 movie, what is the name of the prospector?": [
150 | "Yukon Cornelius", "Slider Sam", "Bumble", "Jack"]
151 | },
152 | {
153 | "How far do reindeer travel when they migrate?": [
154 | "3000 miles", "700 miles", "500 miles", "0 miles"]
155 | },
156 | {
157 | "How fast can a reindeer run?": [
158 | "48 miles per hour", "17 miles per hour", "19 miles per hour", "14 miles per hour", "52 miles per hour", "41 miles per hour"]
159 | }
160 | ],
161 | "GAME_NAME" : "American Reindeer Trivia", # Be sure to change this for your skill.
162 | "HELP_MESSAGE": "I will ask you {0} multiple choice questions. Respond with the number of the answer. " +
163 | "For example, say one, two, three, or four. To start a new game at any time, say, start game. ",
164 | "REPEAT_QUESTION_MESSAGE": "To repeat the last question, say, repeat. ",
165 | "ASK_MESSAGE_START": " What would you like to do? ",
166 | "HELP_REPROMPT": "To give an answer to a question, respond with the number of the answer. ",
167 | "STOP_MESSAGE": "Ok, we'll play another time. Goodbye!",
168 | "CANCEL_MESSAGE": "Ok, let's play again soon.",
169 | "NO_MESSAGE": "Ok, we'll play another time. Goodbye!",
170 | "TRIVIA_UNHANDLED": "Try saying a number between 1 and %s",
171 | "HELP_UNHANDLED": "Say yes to continue, or no to end the game.",
172 | "START_UNHANDLED": "Say start to start a new game.",
173 | "NEW_GAME_MESSAGE": "Welcome to {0}. ",
174 | "WELCOME_MESSAGE": "I will ask you {0} questions, try to get as many right as you can. Just say the number of the answer. Let's begin. ",
175 | "ANSWER_CORRECT_MESSAGE": "correct. ",
176 | "ANSWER_WRONG_MESSAGE": "wrong. ",
177 | "CORRECT_ANSWER_MESSAGE": "The correct answer is {0}: {1}. ",
178 | "ANSWER_IS_MESSAGE": "That answer is ",
179 | "TELL_QUESTION_MESSAGE": "Question {0}. {1} ",
180 | "GAME_OVER_MESSAGE": "You got {0} out of {1} questions correct. Thank you for playing!",
181 | "SCORE_IS_MESSAGE": "Your score is {0}. "
182 | },
183 | },
184 | "en-GB": {
185 | "translation": {
186 | "QUESTIONS": [
187 | {
188 | "Reindeer have very thick coats, how many hairs per square inch do they have?":
189 | ["13,000", "1,200", "5,000", "700", "1,000", "120,000" ]},
190 | {
191 | "The 1964 classic Rudolph The Red Nosed Reindeer was filmed in. ":
192 | ["Japan", "United States", "Finland", "Germany", "Canada", "Norway", "France"]
193 | },
194 | {
195 | "Santas reindeer are cared for by one of the Christmas elves, what is his name?":
196 | ["Wunorse Openslae", "Alabaster Snowball", "Bushy Evergreen", "Pepper Minstix"]
197 | },
198 | {
199 | "If all of Santas reindeer had antlers while pulling his Christmas sleigh, they would all be. ":
200 | ["Girls", "Boys", "Girls and boys", "No way to tell"]
201 | },
202 | {
203 | "What do Reindeer eat?":
204 | ["Lichen", "Grasses", "Leaves" ,"Berries"]
205 | },
206 | {
207 | "What of the following is not true?":
208 | ["Caribou live on all continents",
209 | "Both reindeer and Caribou are the same species",
210 | "Caribou are bigger than reindeer",
211 | "Reindeer live in Scandinavia and Russia"]
212 | },
213 | {
214 | "In what year did Rudolph make his television debut?":
215 | ["1964", "1979", "2000", "1956"]
216 | },
217 | {
218 | "Who was the voice of Rudolph in the 1964 classic?":
219 | ["Billie Mae Richards", "Burl Ives", "Paul Soles", "Lady Gaga"]
220 | },
221 | {
222 | "In 1939 what retailer used the story of Rudolph the Red Nose Reindeer?":
223 | ["Montgomery Ward", "Sears", "Macys", "Kmart"]
224 | },
225 | {
226 | "Santa's reindeer named Donner was originally named what?":
227 | ["Dunder", "Donny", "Dweedle", "Dreamy"]
228 | },
229 | {
230 | "Who invented the story of Rudolph?":
231 | ["Robert May", "Johnny Marks", "Santa", "J.K. Rowling"]
232 | },
233 | {
234 | "In what location will you not find reindeer?":
235 | ["North Pole", "Lapland", "Korvatunturi mountain", "Finland"]
236 | },
237 | {
238 | "What Makes Santa's Reindeer Fly?":
239 | ["Magical Reindeer Dust", "Fusion", "Amanita muscaria", "Elves"]
240 | },
241 | {
242 | "Including Rudolph, how many reindeer hooves are there?":
243 | ["36", "24", "16", "8"]
244 | },
245 | {
246 | "Santa only has one female reindeer. Which one is it?": [
247 | "Vixen", "Clarice", "Cupid", "Comet"]
248 | },
249 | {
250 | "In the 1964 classic Rudolph The Red Nosed Reindeer, what was the snowman narrators name?": [
251 | "Sam", "Frosty", "Burl", "Snowy"]
252 | },
253 | {
254 | "What was Rudolph's father's name?": [
255 | "Donner", "Dasher", "Blixen", "Comet"]
256 | },
257 | {
258 | "In the 1964 movie, What was the name of the coach of the Reindeer Games?": [
259 | "Comet", "Blixen", "Donner", "Dasher"]
260 | },
261 | {
262 | "In the 1964 movie, what is the name of the deer that Rudolph befriends at the reindeer games?": [
263 | "Fireball", "Clarice", "Jumper", "Vixen"]
264 | },
265 | {
266 | "In the 1964 movie, How did Donner, Rudolph's father, try to hide Rudolph's nose?": [
267 | "Black mud", "Bag", "Pillow case", "Sock"]
268 | },
269 | {
270 | "In the 1964 movie, what does the Misfit Elf want to be instead of a Santa Elf?": [
271 | "Dentist", "Reindeer", "Toy maker", "Candlestick maker"]
272 | },
273 | {
274 | "In the 1964 movie,what was the Bumble's one weakness?": [
275 | "Could not swim", "Always hungry", "Candy canes", "Cross eyed"]
276 | },
277 | {
278 | "In the 1964 movie, what is Yukon Cornelius really in search of?": [
279 | "Peppermint", "Gold", "India", "Polar Bears"]
280 | },
281 | {
282 | "In the 1964 movie, why is the train on the Island of Misfit Toys?": [
283 | "Square wheels", "No Engine", "Paint does not match", "It does not toot"]
284 | },
285 | {
286 | "In the 1964 movie, what is the name of the Jack in the Box?": [
287 | "Charlie", "Sam", "Billy", "Jack"]
288 | },
289 | {
290 | "In the 1964 movie, why did Santa Claus almost cancel Christmas?": [
291 | "Storm", "No snow", "No toys", "The Reindeer were sick"]
292 | },
293 | {
294 | "In the 1964 movie, what animal noise did the elf make to distract the Bumble?": [
295 | "Oink", "Growl", "Bark", "Meow"]
296 | },
297 | {
298 | "In the 1964 movie, what is the name of the prospector?": [
299 | "Yukon Cornelius", "Slider Sam", "Bumble", "Jack"]
300 | },
301 | {
302 | "How far do reindeer travel when they migrate?": [
303 | "3000 miles", "700 miles", "500 miles", "0 miles"]
304 | },
305 | {
306 | "How fast can a reindeer run?": [
307 | "48 miles per hour", "17 miles per hour", "19 miles per hour", "14 miles per hour", "52 miles per hour", "41 miles per hour"]
308 | }
309 | ],
310 | "GAME_NAME" : "British Reindeer Trivia", # Be sure to change this for your skill.
311 | "HELP_MESSAGE": "I will ask you {0} multiple choice questions. Respond with the number of the answer. " +
312 | "For example, say one, two, three, or four. To start a new game at any time, say, start game. ",
313 | "REPEAT_QUESTION_MESSAGE": "To repeat the last question, say, repeat. ",
314 | "ASK_MESSAGE_START": " What would you like to do? ",
315 | "HELP_REPROMPT": "To give an answer to a question, respond with the number of the answer. ",
316 | "STOP_MESSAGE": "Ok, we'll play another time. Goodbye!",
317 | "CANCEL_MESSAGE": "Ok, let's play again soon.",
318 | "NO_MESSAGE": "Ok, we'll play another time. Goodbye!",
319 | "TRIVIA_UNHANDLED": "Try saying a number between 1 and %s",
320 | "HELP_UNHANDLED": "Say yes to continue, or no to end the game.",
321 | "START_UNHANDLED": "Say start to start a new game.",
322 | "NEW_GAME_MESSAGE": "Welcome to {0}. ",
323 | "WELCOME_MESSAGE": "I will ask you {0} questions, try to get as many right as you can. Just say the number of the answer. Let's begin. ",
324 | "ANSWER_CORRECT_MESSAGE": "correct. ",
325 | "ANSWER_WRONG_MESSAGE": "wrong. ",
326 | "CORRECT_ANSWER_MESSAGE": "The correct answer is {0}: {1}. ",
327 | "ANSWER_IS_MESSAGE": "That answer is ",
328 | "TELL_QUESTION_MESSAGE": "Question {0}. {1} ",
329 | "GAME_OVER_MESSAGE": "You got {0} out of {1} questions correct. Thank you for playing!",
330 | "SCORE_IS_MESSAGE": "Your score is {0}. "
331 | },
332 | },
333 | "de-DE": {
334 | "translation": {
335 | "QUESTIONS" : [
336 | {
337 | "Rentiere haben ein sehr dickes Fell. Wie viele Haare pro Quadratzentimeter haben sie?": [
338 | "13,000", "1,200", "5,000", "700", "1,000", "120,000"]
339 | },
340 | {
341 | "Der Klassiker aus dem Jahr 1964, Rudolph mit der roten Nase, wurde gedreht in. ": [
342 | "Japan", "USA", "Finnland", "Deutschland", "Kanada", "Norwegen", "Frankreich"]
343 | },
344 | {
345 | "Um die Rentiere des Weihnachtsmanns kümmert sich eine der Weihnachtselfen. Wie heißt sie?": [
346 | "Wunorse Openslae", "Alabaster Snowball", "Bushy Evergreen", "Pfeffer Minstix"]
347 | },
348 | {
349 | "Wenn alle Rentiere des Weihnachtsmanns Geweihe hätten, während sie seinen Weihnachtsschlitten ziehen, wären sie alle. ": [
350 | "Weiblich", "Männlich", "Weiblich und männlich", "Kann man nicht sagen"]
351 | },
352 | {
353 | "Was essen Rentiere?": [
354 | "Flechten", "Gras", "Blätter", "Beeren"]
355 | },
356 | {
357 | "Welche Aussage ist nicht richtig?": [
358 | "Karibus leben auf allen Kontinenten", "Karibus und Rentiere gehören derselben Gattung an ",
359 | "Karibus sind größer als Rentiere", "Rentiere leben in Skandinavien und Russland"]
360 | },
361 | {
362 | "In welchem Jahr kam Rudolph ins Fernsehen?": [
363 | "1964", "1979", "2000", "1956"]
364 | },
365 | {
366 | "Wer war der Sprecher für Rudolph im klassischen Film aus dem Jahr 1964?": [
367 | "Billie Mae Richards", "Burl Ives", "Paul Soles", "Lady Gaga"]
368 | },
369 | {
370 | "Welche Handelskette verwendete 1939 die Geschichte von Rudolph mit der roten Nase?": [
371 | "Montgomery Ward", "Sears", "Macys", "Kmart"]
372 | },
373 | {
374 | "Wie hieß das Rentier des Weihnachtsmanns namens Donner ursprünglich?": [
375 | "Dunder", "Donny", "Dweedle", "Dreamy"]
376 | },
377 | {
378 | "Wer hat die Geschichte von Rudolph erfunden?": [
379 | "Robert May", "Johnny Marks", "Santa", "J.K. Rowling"]
380 | },
381 | {
382 | "Wo findest du keine Rentiere?": [
383 | "Nordpol", "Lappland", "Korvatunturi-Berge", "Finnland"]
384 | },
385 | {
386 | "Warum können die Rentiere des Weihnachtsmanns fliegen?": [
387 | "Magischer Staub der Rentiere", "Fusion", "Amanita muscaria", "Elfen"]
388 | },
389 | {
390 | "Wieviele Rentierhufe gibt es hier einschließlich Rudolph?": [
391 | "36", "24", "16", "8"]
392 | },
393 | {
394 | "Der Weihnachtsmann hat nur ein weibliches Rentier. Wie heißt es?": [
395 | "Blitzen", "Clarice", "Cupid", "Comet"]
396 | },
397 | {
398 | "Wie war der Name des erzählenden Schneemanns im klassischen Film Rudolph mit der roten Nase aus dem Jahr 1964?": [
399 | "Sam", "Frosty", "Burl", "Snowy"]
400 | },
401 | {
402 | "Wie hieß der Vater von Rudolph?": [
403 | "Donner", "Dasher", "Blixen", "Comet"]
404 | },
405 | {
406 | "Wie war der Name des Trainers der Rentierspiele im klassischen Film aus dem Jahr 1964?": [
407 | "Comet", "Blixen", "Donner", "Dasher"]
408 | },
409 | {
410 | "Wie war im klassichen Film aus 1964 der Name des Hirsches, mit dem sich Rudolph befreundete?": [
411 | "Fireball", "Clarice", "Jumper", "Vixen"]
412 | },
413 | {
414 | "Wie hat der Vater von Rudolph, Donner, im Film aus dem Jahr 1964 versucht, die Nase von Rudolph zu verbergen?": [
415 | "Schwarzer Schlamm", "Sack", "Kissenbezug", "Socke"]
416 | },
417 | {
418 | "Was möchte die Misfit-Elfe im Film aus dem Jahr 1964 werden anstatt eine Elfe für den Weihnachtsmann?": [
419 | "Zahnarzt", "Rentier", "Spielzeugmacher", "Kerzenmacher"]
420 | },
421 | {
422 | "Was war die einzige Schwäche von Bumble im Film aus dem Jahr 1964?": [
423 | "Konnte nicht schwimmen", "War immer hungrig", "Zuckerstangen", "Schielte"]
424 | },
425 | {
426 | "Was sucht Yukon Cornelius in Wirklichkeit im Film aus dem Jahr 1964?": [
427 | "Pfefferminz", "Gold", "Indien", "Polarbären"]
428 | },
429 | {
430 | "Warum befindet sich der Zug im Film aus dem Jahr 1964 auf der Insel des fehlerhaften Spielzeugs?": [
431 | "Viereckige Räder", "Keine Dampfmaschine", "Farbe stimmt nicht", "Pfeift nicht"]
432 | },
433 | {
434 | "Wie lautet der Name des Schachtelmännchens im Film aus dem Jahr 1964?": [
435 | "Charlie", "Sam", "Billy", "Jack"]
436 | },
437 | {
438 | "Warum hat der Weihnachtsmann im Film aus dem Jahr 1964 Weihnachten beinahe abgesagt?": [
439 | "Sturm", "Kein Schnee", "Kein Spielzeug", "Die Rentiere waren krank"]
440 | },
441 | {
442 | "Welches tierische Geräusch machte die Elfe im Film aus dem Jahr 1964, um den Bumble abzulenken?": [
443 | "Oink", "Knurr", "Wauwau", "Miau"]
444 | },
445 | {
446 | "Wie lautet der Name des Goldsuchers im Film aus dem Jahr 1964?": [
447 | "Yukon Cornelius", "Slider Sam", "Bumble", "Jack"]
448 | },
449 | {
450 | "Wie weit ziehen Rentiere auf ihren Wanderungen?": [
451 | "4800 km", "1100 km", "800 km", "0 km"]
452 | },
453 | {
454 | "Wie schnell läuft ein Rentier?": [
455 | "77 km pro Stunde", "27 km pro Stunde", "30 km pro Stunde", "22 km pro Stunde", "83 km pro Stunde", "65 km pro Stunde"]
456 | }
457 | ],
458 | "GAME_NAME" : "Wissenswertes über Rentiere in Deutsch", # Be sure to change this for your skill.
459 | "HELP_MESSAGE": "Ich stelle dir {0} Multiple-Choice-Fragen. Antworte mit der Zahl, die zur richtigen Antwort gehört. " +
460 | "Sage beispielsweise eins, zwei, drei oder vier. Du kannst jederzeit ein neues Spiel beginnen, sage einfach „Spiel starten“. ",
461 | "REPEAT_QUESTION_MESSAGE": "Wenn die letzte Frage wiederholt werden soll, sage „Wiederholen“ ",
462 | "ASK_MESSAGE_START": "Möchten Sie beginnen?",
463 | "HELP_REPROMPT": "Wenn du eine Frage beantworten willst, antworte mit der Zahl, die zur richtigen Antwort gehört. ",
464 | "STOP_MESSAGE": "OK, spielen wir ein andermal. Auf Wiedersehen!",
465 | "CANCEL_MESSAGE": "OK, dann lass uns bald mal wieder spielen.",
466 | "NO_MESSAGE": "OK, spielen wir ein andermal. Auf Wiedersehen!",
467 | "TRIVIA_UNHANDLED": "Sagt eine Zahl beispielsweise zwischen 1 und %s",
468 | "HELP_UNHANDLED": "Sage ja, um fortzufahren, oder nein, um das Spiel zu beenden.",
469 | "START_UNHANDLED": "Du kannst jederzeit ein neues Spiel beginnen, sage einfach „Spiel starten“.",
470 | "NEW_GAME_MESSAGE": "Willkommen bei {0}. ",
471 | "WELCOME_MESSAGE": "Ich stelle dir {0} Fragen und du versuchst, so viele wie möglich richtig zu beantworten. "
472 | "Sage einfach die Zahl, die zur richtigen Antwort passt. Fangen wir an. ",
473 | "ANSWER_CORRECT_MESSAGE": "Richtig. ",
474 | "ANSWER_WRONG_MESSAGE": "Falsch. ",
475 | "CORRECT_ANSWER_MESSAGE": "Die richtige Antwort ist {0}: {1}. ",
476 | "ANSWER_IS_MESSAGE": "Diese Antwort ist ",
477 | "TELL_QUESTION_MESSAGE": "Frage {0}. {1} ",
478 | "GAME_OVER_MESSAGE": "Du hast {0} von {1} richtig beantwortet. Danke fürs Mitspielen!",
479 | "SCORE_IS_MESSAGE": "Dein Ergebnis ist {0}. "
480 | }
481 | }
482 | }
483 |
484 | # --------------- entry point -----------------
485 |
486 | def lambda_handler(event, context):
487 | """ App entry point """
488 | if event['request']['type'] == "LaunchRequest":
489 | return on_launch(event['request'], event['session'])
490 | elif event['request']['type'] == "IntentRequest":
491 | return on_intent(event['request'], event['session'])
492 | elif event['request']['type'] == "SessionEndedRequest":
493 | return on_session_ended()
494 |
495 | # --------------- response handlers -----------------
496 |
497 | def on_intent(request, session):
498 | """ called on Intent """
499 | intent = request['intent']
500 | intent_name = request['intent']['name']
501 | #print("on_intent " +intent_name)
502 | #print(request)
503 |
504 | getstate(session)
505 | locale = getlocale(request, session)
506 |
507 | if get_game_state() == GAME_STATE_TRIVIA:
508 | return rungame(request, session, locale, intent, session)
509 |
510 | return help_handler(False, request, locale, session)
511 |
512 | def rungame(request, newgame, locale, intent, session):
513 | """ process the game questions and user response """
514 | intent_name = request['intent']['name']
515 | resource = getresource(locale)
516 |
517 | if 'dialogState' in request:
518 | #delegate to Alexa until dialog sequence is complete
519 | if request['dialogState'] == "STARTED" or request['dialogState'] == "IN_PROGRESS":
520 | attributes = {"locale":locale}
521 | return dialog_response(attributes, False)
522 |
523 | if intent_name == "AMAZON.StartOverIntent":
524 | return start_game(request, True, locale)
525 | elif intent_name == "AMAZON.RepeatIntent":
526 | reprompt = session['attributes'][REPROMPT_KEY]
527 | return rebuild_response(request, locale, session, reprompt )
528 | elif intent_name == "AMAZON.CancelIntent":
529 | return cancel_response(locale)
530 | elif intent_name == "AMAZON.StopIntent":
531 | return cancel_response(locale)
532 | elif intent_name == "AMAZON.HelpIntent":
533 | return dohelp(request, False, locale)
534 | elif intent_name == "AnswerIntent":
535 | return processuserguess(False, request, session, intent, locale)
536 | elif intent_name == "DontKnowIntent":
537 | return processuserguess(True, request, session, intent, locale)
538 | return dohelp(request, False, locale)
539 |
540 | def processuserguess(usergaveup, request, session, intent, locale):
541 | """ process the users response, builf next question if required """
542 |
543 | resource = getresource(locale)
544 | speech_output = ""
545 |
546 | game_questions = session['attributes'][GAME_QUESTIONS_KEY]
547 | correct_answer_index_previous_question = int(session['attributes'][CORRECTANSWERINDEX])
548 | current_score = int(session['attributes'][SCORE])
549 | current_question_index_previous_question = int(session['attributes'][CURRENTQUESTION_KEY])
550 | correct_answer = session['attributes'][ANSWERTEXT_KEY]
551 |
552 | if match_guess_with_answer(intent, correct_answer_index_previous_question):
553 | current_score += 1
554 | speech_output = resource["ANSWER_CORRECT_MESSAGE"]
555 | else:
556 | if usergaveup == False:
557 | speech_output = resource["ANSWER_WRONG_MESSAGE"]
558 |
559 | speech_output += resource["CORRECT_ANSWER_MESSAGE"].format(correct_answer_index_previous_question, correct_answer)
560 |
561 | if current_question_index_previous_question >= (GAME_LENGTH - 1):
562 | speech_message = ""
563 | if usergaveup == False:
564 | speech_message = resource["ANSWER_IS_MESSAGE"]
565 |
566 | speech_message += speech_output + resource["GAME_OVER_MESSAGE"].format(str(current_score), str(GAME_LENGTH))
567 | return response("", response_plain_text(speech_message, True))
568 |
569 | current_question_index_next_question = current_question_index_previous_question + 1
570 | correct_answer_index_next_question = random.randrange(0, ANSWER_COUNT-1, 1)
571 |
572 | new_questions = game_questions[current_question_index_next_question]
573 |
574 | round_answers = populate_round_answers(new_questions,
575 | current_question_index_next_question, correct_answer_index_next_question)
576 |
577 | correct_answer_text_next_question = round_answers[correct_answer_index_next_question]
578 |
579 | reprompt = get_answers_text(game_questions[current_question_index_next_question], round_answers,
580 | current_question_index_next_question, locale)
581 |
582 | if usergaveup == False:
583 | speech_message = resource["ANSWER_IS_MESSAGE"]
584 | else:
585 | speech_message = ""
586 | speech_message += speech_output + " " + resource["SCORE_IS_MESSAGE"].format(str(current_score)) + " " + reprompt
587 |
588 | correct_answer_index_next_question += 1
589 | set_game_state(GAME_STATE_TRIVIA)
590 |
591 | attributes = { SPEECHOUTPUT_KEY: reprompt,
592 | REPROMPT_KEY: reprompt,
593 | CURRENTQUESTION_KEY: str(current_question_index_next_question),
594 | CORRECTANSWERINDEX: str(correct_answer_index_next_question),
595 | GAME_QUESTIONS_KEY: game_questions,
596 | SCORE: str(current_score),
597 | ANSWERTEXT_KEY: correct_answer_text_next_question,
598 | STATE_KEY: get_game_state(),
599 | LOCALE: locale
600 | }
601 |
602 | return response(attributes, speech_response_prompt_card(resource["GAME_NAME"],speech_message, reprompt, False))
603 |
604 |
605 | def match_guess_with_answer(intent, correctAnswerIndex):
606 | """ check if answer matches """
607 | if 'slots' in intent:
608 | slots = intent['slots']
609 | for key, val in slots.items():
610 | if val.get('value'):
611 | if (val.get('value')).isdigit():
612 | lval = int(val['value'].lower())
613 | if lval == correctAnswerIndex and lval <= ANSWER_COUNT and lval > 0:
614 | #print("user answered " + str(lval) + " correct answer number is: " + str(correctAnswerIndex))
615 | return True
616 | return False
617 |
618 |
619 | def cancel_response(locale):
620 | """ """
621 | resource = getresource(locale)
622 | speechmessage = resource["CANCEL_MESSAGE"]
623 | return response("", response_plain_text(speechmessage, True))
624 |
625 | def rebuild_response(request, locale, session, speech_message):
626 | """ """
627 |
628 | speech_output = session['attributes'][SPEECHOUTPUT_KEY]
629 | reprompt = session['attributes'][REPROMPT_KEY]
630 | game_questions = session['attributes'][GAME_QUESTIONS_KEY]
631 | correct_answer_index = session['attributes'][CORRECTANSWERINDEX]
632 | current_score = session['attributes'][SCORE]
633 | current_question_index = session['attributes'][CURRENTQUESTION_KEY]
634 | correct_answer_text = session['attributes'][ANSWERTEXT_KEY]
635 | set_game_state(GAME_STATE_TRIVIA)
636 |
637 | attributes = { SPEECHOUTPUT_KEY: reprompt,
638 | REPROMPT_KEY: reprompt,
639 | CURRENTQUESTION_KEY: current_question_index,
640 | CORRECTANSWERINDEX: correct_answer_index,
641 | GAME_QUESTIONS_KEY: game_questions,
642 | SCORE: current_score,
643 | ANSWERTEXT_KEY: correct_answer_text,
644 | STATE_KEY: get_game_state(),
645 | LOCALE: locale
646 | }
647 |
648 | return response(attributes, response_plain_text_promt(speech_message, speech_message, False))
649 |
650 | def dohelp(request, newgame, locale):
651 | """ display help for selected locale """
652 |
653 | resource = getresource(locale)
654 | askmessage = resource["REPEAT_QUESTION_MESSAGE"] +" " +resource["ASK_MESSAGE_START"]
655 | speech_message = resource["HELP_MESSAGE"].format(resource["GAME_NAME"]) + askmessage
656 |
657 | set_game_state(GAME_STATE_HELP)
658 | attributes = {
659 | STATE_KEY: get_game_state()
660 | }
661 | return response(attributes, response_plain_text_promt(speech_message, speech_message, False))
662 |
663 | def help_handler(newgame, request, locale, session):
664 | """ help handler """
665 |
666 | intent_name = request['intent']['name']
667 | resource = getresource(locale)
668 | if newgame == True:
669 | askmessage = resource["ASK_MESSAGE_START"]
670 | else:
671 | askmessage = resource["REPEAT_QUESTION_MESSAGE"] + resource["ASK_MESSAGE_START"]
672 |
673 | if intent_name == "AMAZON.StartOverIntent":
674 | print("help state: startover intent")
675 | set_game_state(GAME_STATE_START)
676 | return start_game(request, False, locale)
677 |
678 | elif intent_name == "AMAZON.RepeatIntent":
679 | print("help state: repeat intent")
680 | if SPEECHOUTPUT_KEY in session['attributes']:
681 | if not( session['attributes'][SPEECHOUTPUT_KEY] is None) and not(session['attributes'][REPROMPT_KEY] is None):
682 | return dohelp(False, request, session, locale)
683 | return dohelp(request, True, locale)
684 |
685 | elif intent_name == "AMAZON.CancelIntent":
686 | return cancel_response(locale)
687 |
688 | elif intent_name == "AMAZON.StopIntent":
689 | return cancel_response(locale)
690 |
691 | elif intent_name == "AMAZON.HelpIntent":
692 | if SPEECHOUTPUT_KEY in session['attributes']:
693 | if not( session['attributes'][SPEECHOUTPUT_KEY] is None) and not(session['attributes'][REPROMPT_KEY] is None):
694 | return dohelp(request, False, locale)
695 | return dohelp(request, True, locale)
696 |
697 | speechmessage = resource["HELP_MESSAGE"].format(GAME_LENGTH) + askmessage
698 | set_game_state(GAME_STATE_HELP)
699 | attributes = {
700 | STATE_KEY: get_game_state()
701 | }
702 | return response(attributes, response_plain_text(speechmessage, False))
703 |
704 | def on_launch(request, session):
705 | """ start """
706 | #print("launch")
707 | set_game_state(GAME_STATE_TRIVIA)
708 | return start_game(request, True, getlocale(request, session))
709 |
710 | def start_game(request, newgame, locale):
711 | """ start a new game """
712 |
713 | resource = getresource(locale)
714 |
715 | speechOutput = ""
716 | if newgame == True:
717 | speechOutput = resource["NEW_GAME_MESSAGE"].format(resource["GAME_NAME"]) + resource["WELCOME_MESSAGE"].format(str(GAME_LENGTH))
718 |
719 | current_question_index = 0
720 |
721 | questions = get_question_list(locale)
722 | correct_answer_index = random.randrange(0, ANSWER_COUNT - 1, 1)
723 |
724 | round_answers = populate_round_answers(questions[current_question_index],
725 | current_question_index, correct_answer_index)
726 | correct_answer_text = round_answers[correct_answer_index]
727 |
728 | reprompt = get_answers_text(questions[current_question_index], round_answers, current_question_index, locale)
729 | speech_message = speechOutput + reprompt
730 |
731 | correct_answer_index += 1
732 | set_game_state(GAME_STATE_TRIVIA)
733 |
734 | attributes = { SPEECHOUTPUT_KEY: speech_message,
735 | REPROMPT_KEY: reprompt,
736 | CURRENTQUESTION_KEY: str(current_question_index),
737 | CORRECTANSWERINDEX: str(correct_answer_index),
738 | GAME_QUESTIONS_KEY: questions,
739 | SCORE: "0",
740 | ANSWERTEXT_KEY: correct_answer_text,
741 | STATE_KEY: get_game_state(),
742 | LOCALE: locale
743 | }
744 |
745 | return response(attributes, speech_response_prompt_card(resource["GAME_NAME"],speech_message, reprompt, False))
746 |
747 | def populate_round_answers(question, correct_question_index, correct_answer_index):
748 | """ get answers for a given question, place correct answer at the spot marked by the/
749 | correctAnswerIndex.
750 | """
751 | for theanswers in question.values():
752 | tmp_answer = theanswers[0]
753 | theanswers.remove(tmp_answer)
754 | theanswers_randomised = random.sample(theanswers, len(theanswers) )
755 | theanswers_randomised.insert(correct_answer_index, tmp_answer)
756 | theanswers.insert(correct_question_index, tmp_answer)
757 | return theanswers_randomised
758 |
759 | def getstate(session):
760 | """ get and set the current state """
761 |
762 | if STATE_KEY in session['attributes']:
763 | set_game_state(session['attributes'][STATE_KEY])
764 | else:
765 | set_game_state(GAME_STATE_START)
766 |
767 | def get_answers_text(question, reorderedquestion, current_question_index, locale):
768 | """ get text for the answer """
769 | number = current_question_index + 1
770 | resource = getresource(locale)
771 | k = list(question.keys())
772 | questiontext = k[0]
773 | outtext = resource["TELL_QUESTION_MESSAGE"].format(str(number), questiontext) + " "
774 |
775 | index = 0
776 | for qtext in reorderedquestion:
777 | outtext += str(index + 1) + ". " + qtext +". "
778 | index += 1
779 | if index == ANSWER_COUNT:
780 | break
781 |
782 | return outtext[:-1]
783 |
784 | def get_game_state():
785 | """ """
786 | global game_state
787 | return game_state
788 |
789 | def set_game_state(state):
790 | """ """
791 | global game_state
792 | game_state = state
793 |
794 | def getresource(locale):
795 | """ """
796 | return languageSupport[locale]["translation"]
797 |
798 | def getlocale(request,session):
799 | """ """
800 | locale = request['locale']
801 | if locale == "":
802 | attributes = session['attributes']
803 | attributes['locale']
804 |
805 | if locale == "":
806 | locale = "en-US"
807 |
808 | return locale
809 |
810 | def on_session_ended():
811 | """ called on session end """
812 | #print(on_session_ended)
813 |
814 |
815 | def get_question_list(locale):
816 | """ """
817 | global GAME_LENGTH
818 | questions = []
819 | res = getresource(locale)
820 | ilen = len(res["QUESTIONS"])
821 | questionsample = random.sample(range(0, ilen), GAME_LENGTH)
822 | for index in questionsample:
823 | questions.append(res["QUESTIONS"][index])
824 | return questions
825 |
826 | # --------------- speech response handlers -----------------
827 | # build the json responses
828 |
829 | def response_plain_text(output, endsession):
830 | """ create a simple json plain text response """
831 | return {
832 | 'outputSpeech': {
833 | 'type': 'PlainText',
834 | 'text': output
835 | },
836 | 'shouldEndSession': endsession
837 | }
838 |
839 | def response_plain_text_promt(output, reprompt_text, endsession):
840 | """ create a simple json plain text response """
841 | return {
842 | 'outputSpeech': {
843 | 'type': 'PlainText',
844 | 'text': output
845 | },
846 | 'reprompt': {
847 | 'outputSpeech': {
848 | 'type': 'PlainText',
849 | 'text': reprompt_text
850 | }
851 | },
852 | 'shouldEndSession': endsession
853 | }
854 |
855 | def response_ssml_text(output, endsession):
856 | """ create a simple json plain text response """
857 | return {
858 | 'outputSpeech': {
859 | 'type': 'SSML',
860 | 'ssml': "" +output +""
861 | },
862 | 'shouldEndSession': endsession
863 | }
864 |
865 | def response_ssml_text_card_image(title, output, endsession, cardtext, smallimage, largeimage):
866 | """ create a simple json plain text response """
867 | return {
868 | 'card': {
869 | 'type': 'Standard',
870 | 'title': title,
871 | 'text': cardtext,
872 | 'image':{
873 | 'smallimageurl':smallimage,
874 | 'largeimageurl':largeimage
875 | },
876 | },
877 | 'outputSpeech': {
878 | 'type': 'SSML',
879 | 'ssml': "" +output +""
880 | },
881 | 'shouldEndSession': endsession
882 | }
883 |
884 | def response_ssml_text_card(title, output, endsession):
885 | """ create a simple json plain text response """
886 | return {
887 | 'card': {
888 | 'type': 'Simple',
889 | 'title': title,
890 | 'content': output
891 | },
892 | 'outputSpeech': {
893 | 'type': 'SSML',
894 | 'ssml': "" +output +""
895 | },
896 | 'shouldEndSession': endsession
897 | }
898 |
899 | def speech_response_prompt_card(title, output, reprompt_text, endsession):
900 | """ create a simple json response with a card """
901 | return {
902 | 'outputSpeech': {
903 | 'type': 'PlainText',
904 | 'text': output
905 | },
906 | 'card': {
907 | 'type': 'Simple',
908 | 'title': title,
909 | 'content': reprompt_text
910 | },
911 | 'reprompt': {
912 | 'outputSpeech': {
913 | 'type': 'PlainText',
914 | 'text': reprompt_text
915 | }
916 | },
917 | 'shouldEndSession': endsession
918 | }
919 |
920 |
921 | def response_ssml_text_reprompt(title, output, endsession, repromt_text):
922 | """ create a simple json response with a card """
923 | return {
924 | 'outputSpeech': {
925 | 'type': 'SSML',
926 | 'ssml': "" +output +""
927 | },
928 | 'reprompt': {
929 | 'outputSpeech': {
930 | 'type': 'SSML',
931 | 'ssml': "" +repromt_text +""
932 | }
933 | },
934 | 'shouldEndSession': endsession
935 | }
936 |
937 | def dialog_response(attributes, endsession):
938 | """ create a simple json response with card """
939 | return {
940 | 'version': '1.0',
941 | 'sessionAttributes': attributes,
942 | 'response':{
943 | 'directives': [
944 | {
945 | 'type': 'Dialog.Delegate'
946 | }
947 | ],
948 | 'shouldEndSession': endsession
949 | }
950 | }
951 |
952 | def response(attributes, speech_response):
953 | """ create a simple json response """
954 | return {
955 | 'version': '1.0',
956 | 'sessionAttributes': attributes,
957 | 'response': speech_response
958 | }
959 |
--------------------------------------------------------------------------------
/speechAssets/IntentSchema.json:
--------------------------------------------------------------------------------
1 | {
2 | "intents": [
3 | {
4 | "name": "AMAZON.CancelIntent",
5 | "samples": []
6 | },
7 | {
8 | "name": "AMAZON.HelpIntent",
9 | "samples": []
10 | },
11 | {
12 | "name": "AMAZON.RepeatIntent",
13 | "samples": []
14 | },
15 | {
16 | "name": "AMAZON.StartOverIntent",
17 | "samples": [
18 | "start game",
19 | "new game",
20 | "start",
21 | "start new game"
22 | ]
23 | },
24 | {
25 | "name": "AMAZON.StopIntent",
26 | "samples": []
27 | },
28 | {
29 | "name": "AnswerIntent",
30 | "samples": [
31 | "the answer is {Answer}",
32 | "my answer is {Answer}",
33 | "is it {Answer}",
34 | "{Answer} is my answer",
35 | "{Answer}"
36 | ],
37 | "slots": [
38 | {
39 | "name": "Answer",
40 | "type": "AMAZON.NUMBER",
41 | "samples": []
42 | }
43 | ]
44 | },
45 | {
46 | "name": "DontKnowIntent",
47 | "samples": [
48 | "i don't know",
49 | "don't know",
50 | "skip",
51 | "i don't know that",
52 | "who knows",
53 | "i don't know this question",
54 | "i don't know that one",
55 | "dunno"
56 | ],
57 | "slots": []
58 | }
59 | ],
60 | "types": [
61 | {
62 | "name": "Answer",
63 | "values": [
64 | {
65 | "name": {
66 | "value": "1"
67 | }
68 | },
69 | {
70 | "name": {
71 | "value": "2"
72 | }
73 | },
74 | {
75 | "name": {
76 | "value": "3"
77 | }
78 | },
79 | {
80 | "name": {
81 | "value": "4"
82 | }
83 | }
84 | ]
85 | }
86 | ]
87 | }
--------------------------------------------------------------------------------
/step-by-step/1-voice-user-interface-fig1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/1-voice-user-interface-fig1.png
--------------------------------------------------------------------------------
/step-by-step/1-voice-user-interface-fig2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/1-voice-user-interface-fig2.png
--------------------------------------------------------------------------------
/step-by-step/1-voice-user-interface-fig3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/1-voice-user-interface-fig3.png
--------------------------------------------------------------------------------
/step-by-step/1-voice-user-interface.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Trivia Skill
2 | [](1-voice-user-interface.md)[](2-lambda-function.md)[](3-connect-vui-to-code.md)[](4-testing.md)
3 |
4 | ## Setting up Your Alexa Skill in the Developer Portal
5 |
6 | There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/defining-the-voice-interface). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that on [page #2](https://github.com/alexa/skill-sample-nodejs-fact/blob/master/step-by-step/2-lambda-function.md) of this step-by-step guide.
7 |
8 | 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.)
9 |
10 |
11 |
12 | 2. **Once you have signed in, click the Alexa button at the top of the screen.**
13 |
14 |
15 |
16 | 3. **On the Alexa page, choose the "Get Started" button for the Alexa Skills Kit.**
17 |
18 |
19 |
20 | 4. **Select "Add A New Skill."** This will get you to the first page of your new Alexa skill.
21 |
22 |
23 |
24 | 5. **Fill out the Skill Information screen.** Make sure to review the tips we provide below the screenshot.
25 |
26 |
27 |
28 | ### Skill Information Tips
29 | 1. **Skill Type** For this skill, we are creating a skill using the Custom Interaction Model. This is the default choice.
30 |
31 | 2. **Language** Choose the first language you want to support. You can add additional languages in the future, but we need to start with one. (This guide is using U.S. English to start.)
32 |
33 | 3. **Name** This is the name that will be shown in the Alexa Skills Store, and the name your users will refer to.
34 |
35 | 4. **Invocation Name** This is the name that your users will need to say to start your skill. We have provided some common issues developers encounter in the list below, but you should also review the entire [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill).
36 |
37 | | Invocation Name Requirements | Examples of incorrect invocation names |
38 | | ---------------------------- | -------------------------------------- |
39 | | The skill invocation name must not infringe upon the intellectual property rights of an entity or person. | korean air; septa check |
40 | | Invocation names should be more than one word (unless it is a brand or intellectual property), and must not be a name or place | horoscope; trivia; guide; new york |
41 | | Two word invocation names are not allowed when one of the words is a definite article, indefinite article, or a preposition | any poet; the bookie; the fool |
42 | | The invocation name must not contain any of the Alexa skill launch phrases and connecting words. Launch phrase examples include "launch," "ask," "tell," "load," and "begin." Connecting word examples include "to," "from," "by," "if," "and," "whether." | trivia game for star wars; better with bacon |
43 | | The invocation name must not contain the wake words "Alexa," "Amazon," "Echo," or the words "skill" or "app." | hackster initial skill; word skills |
44 | | The invocation name must be written in each language you choose to support. For example, the German version of your skill must have an invocation name written in German, while the English (US) version must have an invocation name written in English. | kitchen stories (German skill) |
45 |
46 | 5. **Audio Player** For this Quiz skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player).
47 |
48 | 6. **Click the Next button to move to the Interaction Model.**
49 |
50 |
51 |
52 | 7. Click on the **Launch Skill Builder** (Beta) button. This will launch the new Skill Builder Dashboard.
53 |
54 | 
55 |
56 | 8. Click on the "Add+" button near **Intents** on the top left corner of the dashboard.
57 |
58 | 
59 |
60 | OPTIONAL: You can choose to upload a file to fill out your interaction model. To do that for this sample click on the > Code Editor tab and drag the JSON file, IntentSchema.json, from the speechAssets folder of the sample code to the cloud upload icon. Once you're done, click Apply Changes. You can follow along with the rest of steps to see how things work or move onto step 9.
61 |
62 | 9. Select **Use an existing intent from the built-in library**. In the textbox provided enter **AMAZON.StartOverIntent** or select that intent from the list of matching intents as they appear, then click the **Add Intent** button.
63 |
64 | 
65 |
66 | 10. Repeat the above adding and add the **AMAZON.RepeatIntent**.
67 |
68 | 11. Next we will create a custom intent that will allow users to answer questions. Click on the "Add+" button near **Intents** on the top left corner of the dashboard. Select **Create a new custom intent** and enter **AnswerIntent** in the textbox.
69 |
70 | 12. Add some sample utterances for the intent. These are the things a user might say to answer a multiple choice question. The word {Answer} within the {} will be mapped to the number of the multiple choice question. Enter the following:
71 |
72 | * it is {Answer}
73 | * my answer is {Answer}
74 | * the answer is {Answer}
75 | * {Answer} is my answer
76 | * {Answer}
77 |
78 | As you type the utterances you notice that words within the {} are automatically converted into "slots" (right hand panel). When we have completed entering the utterances we will configure the slots so that they can be used in our code.
79 |
80 | 
81 |
82 | 13. Define the **Slot Type** for newly created **Slot**. In the right hand panel select the slot called **Answer** and click on its **Edit** icon. From the **Slot Type** dropdown select the predefined slot type **AMAZON.NUMBER**.
83 |
84 | 13. Now we must define the range of "numbers" supported by the **Answer** slot of type **AMAZON.NUMBER**. Select the **Answer** Slot from the **Slot Types** panel in the lower left of the screen and enter the following numbers into the Slot Values field:
85 |
86 | * 1
87 | * 2
88 | * 3
89 | * 4
90 |
91 | 
92 |
93 | 14. Next we will add a Custom intent to allow users to skip a question or answer that they "don't know". Click on the "Add+" intent button and select **Create a new custom intent** then enter **DontKnowIntent** in the textbox. Add the following to the **Sample Utterances**:
94 |
95 | * I don't know that one
96 | * I don't know that
97 | * don't know the answer
98 | * who knows
99 | * skip
100 | * don't know
101 |
102 | 15. Finally Click on the **Save Model** button, and then click on the **Build Model** button.
103 |
104 | 
105 |
106 | If you get an error from your interaction model, check through this list:
107 | * **Did you copy & paste the provided code into the appropriate boxes?**
108 | * **Did you accidentally add any characters to the Interaction Model or Sample Utterances?**
109 |
110 | In the next step of this guide, we will create 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).
111 |
112 | 
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/step-by-step/2-lambda-fig1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/2-lambda-fig1.png
--------------------------------------------------------------------------------
/step-by-step/2-lambda-fig2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/2-lambda-fig2.png
--------------------------------------------------------------------------------
/step-by-step/2-lambda-fig3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/2-lambda-fig3.png
--------------------------------------------------------------------------------
/step-by-step/2-lambda-fig4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/2-lambda-fig4.png
--------------------------------------------------------------------------------
/step-by-step/2-lambda-function.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Trivia Skill
2 | [](1-voice-user-interface.md)[](2-lambda-function.md)[](3-connect-vui-to-code.md)[](4-testing.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 a 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 Lambda is where our code lives. When a user asks Alexa to use our skill, it is our 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. [Check out this quick walkthrough for setting up a new AWS account](https://github.com/alexa/alexa-cookbook/blob/master/aws/set-up-aws.md).
9 |
10 |
11 |
12 | 2. **Choose "Services" at the top of the screen, and type "Lambda" in the search box.** You can also find it in the list of services. It is in the "Compute" section.
13 |
14 |
15 |
16 | 3. **Check your AWS region.** Lambda only works with the Alexa Skills Kit in two regions: US East (N. Virginia) and EU (Ireland). Make sure you choose the region closest to your customers.
17 |
18 |
19 |
20 | 4. **Click the "Create a Lambda function" button.** It should be near the top of your screen.
21 |
22 |
23 |
24 | 5. **Choose the blueprint named "Blank Function".** The Python code for this sample does not require an SDK so there is nothing to configure here.
25 |
26 | 
27 |
28 |
29 | 6. **Configure your trigger.** There are many different AWS services that can trigger a Lambda function, but for the purposes of this guide, we need to select "Alexa Skills Kit." If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page.
30 |
31 |
32 |
33 | Once you have selected Alexa Skills Kit, click the **Next** button.
34 |
35 | 7. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "samplePythonQuiz" is sufficient if you don't have another idea for a name.
36 |
37 | 
38 | 8. **Paste the provided code into the Lambda function code box.** We have provided the code for this skill on [GitHub](../sampleTriviaPython.py), copy and paste it into the 'lambda_function.py' file in the code editor (if copying form the github page, make sure to click the **'Raw'** button first to remove markup).
39 |
40 | 9. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](lambda-role.md). If you have done this before, you only need to set your **Existing role** value to "lambda_basic_execution."
41 |
42 | 
43 |
44 | 10. **For this guide, you can skip all of the Advanced settings.** You can just click the **Next** button to move to the Review screen.
45 |
46 |
47 |
48 | 11. **The Review screen is just a summary of your choices**. Click the **Create function** button in the bottom left corner.
49 |
50 |
51 |
52 | 12. **As a final step, copy the ARN value from the top right corner of the screen.** You will need this value in the next section of this guide.
53 |
54 | 
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/step-by-step/3-connect-vui-to-code.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Trivia Skill
2 | [](1-voice-user-interface.md)[](2-lambda-function.md)[](3-connect-vui-to-code.md)[](4-testing.md)
3 | ## Connecting Your Voice User Interface To Your Lambda Function
4 |
5 | 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 [step #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.
6 |
7 | 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.
8 |
9 | 2. **Open the "Configuration" tab on the left side.**
10 |
11 |
12 |
13 | 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).
14 |
15 |
16 |
17 | 4. **Select "North America" or "Europe" as your geographical region.** IMPORTANT: Make sure you select the same region that you created your Lambda in. Remember, Alexa skills using AWS Lambda can only run in N. Virginia (North America) and Ireland (Europe).
18 |
19 |
20 |
21 | 5. **Paste your Lambda's ARN (Amazon Resource Name) into the textbox provided.** It should look similar to the screenshot above and should be everything after the "ARN-" so it's: arn:aws:lambda:us-east:xxxxxxxxxxxx:function:YourFunctionName
22 |
23 | 6. **Leave "Account Linking" set to "No."** For this skill, we won't be using Account Linking, but you can learn more about [Linking an Alexa User with a User in Your System.](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/linking-an-alexa-user-with-a-user-in-your-system)
24 |
25 | 7. **Click the "Next" button to continue to page #4 of this guide.**
26 |
27 | [](https://github.com/alexa/skill-sample-nodejs-fact/blob/master/step-by-step/4-testing.md)
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/step-by-step/4-testing-fig1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/4-testing-fig1.png
--------------------------------------------------------------------------------
/step-by-step/4-testing-fig2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexa-samples/skill-sample-python-trivia/5cd7f2c617207e2b587877e6dce46db4a6ed6554/step-by-step/4-testing-fig2.png
--------------------------------------------------------------------------------
/step-by-step/4-testing.md:
--------------------------------------------------------------------------------
1 | # Build An Alexa Trivia Skill
2 | [](1-voice-user-interface.md)[](2-lambda-function.md)[](3-connect-vui-to-code.md)[](4-testing.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-lambda.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" tab on the left side.**
11 |
12 |
13 |
14 | 3. **Understand the voice simulator.** While it's not specific to your skill, the Voice Simulator is a valuable testing tool for every skill. Type a word into the box, and click the "Listen" button to hear how Alexa will
15 | pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Language [(SSML)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference) to modify how Alexa will interpret text to speech. Try these examples:
16 |
17 | ```html
18 | 12345
19 | ```
20 |
21 | ```html
22 | 12345
23 | ```
24 |
25 | ```html
26 | 12345
27 | ```
28 |
29 |
30 |
31 | Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect.
32 |
33 | 4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "python trivia" to invoke the skill.
34 | 
35 |
36 | ### Service Simulator Tips
37 | * After you click the "Ask [Your Skill Name]" button, you should see the **Lambda Request** and **Lambda Response** boxes get populated with JSON data like in the screenshot above.
38 | * Click the **Listen** button in the bottom right corner to hear Alexa read the response.
39 | * If you receive a response that reads: *"The remote endpoint could not be called, or the response it returned was invalid,"* this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill.
40 |
41 | 5. **Configure a test event in AWS Lambda.** Now that you are familiar with the **request** and **response** boxes in the Service Simulator, it's important for you to know that you can use your **requests** to directly test your Lambda function every time you update it. To do this:
42 |
43 | 1. **Create & copy a new response with the Service Simulator.**
44 | 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test event."**
45 |
46 |
47 |
48 | 3. **Choose "Alexa Start Session" from the Sample Event Template dropdown list.** You can choose any item in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember. This will also be the sample request that fires every time you update and "Save and Test" your Lambda code.
49 |
50 |
51 |
52 | 4. **Delete the contents of the box, and paste your request into the box.**
53 | 
54 |
55 | 5. **Click the "Save and test" button.** This will save your test event, and run it against your Lambda function.
56 |
57 |
58 |
59 | This gives you visibility into four things:
60 |
61 | * **Your response, listed in the "Execution Result."**
62 |
63 |
64 |
65 | * **A Summary of the statistics for your request.** This includes things like duration, resources, and memory used.
66 |
67 |
68 |
69 | * **Log output.** By effectively using print() statements in your Lambda Python 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.
70 |
71 |
72 | * **Log output.**
73 | A link to your [CloudWatch](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1) 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.
74 | (It is the "[Click here](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:)" link in the Log Output description.)
75 |
76 | 6. **Other testing methods to consider:**
77 |
78 | * [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.
79 | * [Unit Testing with Alexa](https://github.com/alexa/alexa-cookbook/blob/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).
80 |
--------------------------------------------------------------------------------
/step-by-step/lambda-role.md:
--------------------------------------------------------------------------------
1 | # Setting Up Your First Lambda Role
2 |
3 | If you're reading this page, you're probably setting up your first role for a Lambda function. While it's an easy process, we want to make sure you understand all of the "whys" that go into this process.
4 |
5 | 1. **Choose "Create a custom role" from the Role dropdown.** This will launch a new tab in your browser, so make sure that popups are enabled when you attempt this.
6 |
7 | 
8 |
9 | 2. **You are now creating a new IAM role.** IAM stands for Identity and Access Management. ([You can read more about IAM here.](http://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)) By creating this role, you are enabling your Lambda function to be able to create Amazon CloudWatch logs for your function. ([You can read more about managing permissions with IAM roles here.](https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role))
10 |
11 | 3. **You don't need to make any changes. Click the Allow button in the bottom right corner.**
12 |
13 | 
14 |
15 | 4. **This should close the new tab, and populate your Lambda function appropriately.** If your "Lambda function handler and role" section doesn't look like the screenshot below, try refreshing your page and selecting your new role from the "existing role" dropdown.
16 |
17 | 
18 |
19 | 5. **You can now return to what you were doing.**
20 |
--------------------------------------------------------------------------------