question

darianbjohnson avatar image
darianbjohnson asked

Amazon.Time slot does not indicate if user indicated AM or not

I am attempting to use Amazon.Time in a skill. I cannot determine if a user tells me 5 or 5 AM (both responses look like "05:00"). If the user only says "5", then i know to ask AM or PM. [Note: PM times show as military time, so I know 17:00 = 5PM). Is there any way to determine if a user says AM?

alexa skills kit
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

GadgetChannel avatar image
GadgetChannel answered

A way around this, which I have tested and appears to work, is to have two slots for your intent. One should have the type of AMAZON.TIME and the other should be a custom type with the values AM and PM. Your utterance would then be something likes this (assuming the slots are named Time and AMPM):

IntentName something {Time} {AMPM}

This will them stop Alexa from parsing the AM/PM as part of the time (and so they would always be passed to your skill as the AM time) and you can use the AMPM slot to determine whether it is AM, PM, or not defined.

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Krypton avatar image
Krypton answered

Is this method still working? I'm trying to use it in a dialog but AMPM always returns undefined.

1 comment
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi Krypton,

Thanks for posting. I would first recommend checking your Alexa history to see how a.m. and p.m. are most often interpreted, and then ensure that those values are included in your custom AMPM slot. Please see the following link for more information regarding best practices for custom slot values:

https://developer.amazon.com/docs/custom-skills/best-practices-for-sample-utterances-and-custom-slot-type-values.html#h3_custom_slot_values

0 Likes 0 ·