I would like my skill to catch a mention of a 4 to 5 character code that can contain letters and numbers like AB05
or ABC12
. How can I design the slots and utterances for Alexa to understand these and pass them to my skill?
This skill https://github.com/maihde/alexa-qrz does it in the following way:
IntentSchema
1 {
2 "intents": [
3 {
4 "intent": "GetQRZ",
5 "slots": [
6 {
7 "name": "CallSignA",
8 "type": "LETTER_OR_NUMBER"
9 },
10 {
11 "name": "CallSignB",
12 "type": "LETTER_OR_NUMBER"
13 },
14 {
15 "name": "CallSignC",
16 "type": "LETTER_OR_NUMBER"
17 },
18 {
19 "name": "CallSignD",
20 "type": "LETTER_OR_NUMBER"
21 },
22 {
23 "name": "CallSignE",
24 "type": "LETTER_OR_NUMBER"
25 },
26 {
27 "name": "CallSignF",
28 "type": "LETTER_OR_NUMBER"
29 },
30 {
31 "name": "CallSignG",
32 "type": "LETTER_OR_NUMBER"
33 }
34 ]
35 },
36 {
37 "intent": "AMAZON.YesIntent"
38 },
39 {
40 "intent": "AMAZON.NoIntent"
41 },
42 {
43 "intent": "AMAZON.StopIntent"
44 },
45 {
46 "intent": "AMAZON.CancelIntent"
47 }
48 ]
49 }
Custom slots LETTER_OR_NUMBER
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
zero
one
two
three
four
five
six
seven
eight
nine
alfa
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliett
juliet
kilo
lima
mike
november
oscar
papa
quebec
romeo
sierra
tango
uniform
victor
whiskey
x-ray
xray
yankee
zulu
Sample utterances:
GetQRZ {CallSignA} {CallSignB} {CallSignC}
GetQRZ {CallSignA} {CallSignB} {CallSignC} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} over
enter code here
You should be able to use AMAZON.LITERAL
as your slot type
{
"intent": "GetCodeIntent",
"slots": [
{
"name": "code",
"type": "AMAZON.LITERAL"
}
]
}
For your utterances its a little weird as in you potentially have to define the longest your utterance may be from my experience but if the longest it will be is 5 characters you should be able to do something like
GetCodeIntent update code {one two three four five|code}
GetCodeIntent set code {one two three four five|code}
GetCodeIntent change code {one two three four five|code}
You will still refer to your intent slot using the code var
"GetCodeIntent": function (intent, session, response) {
var codeSlot = intent.slots.code;
//Do all of your amazingness with your code here
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With