5

I want to receive a dollar amount in my utterance. So, for example, if I ask Alexa:

Send $100.51 to Kroger.

(pronounced, One hundred dollars and fifty one cents) I want to receive the value 100.51 in a proper slot.

I have tried searching and I defined my utterance slots like this:

"slots": [
    {
        "name": "Amount",
        "type": "AMAZON.NUMBER"
    } 
]

But on JSON input I only get this result:

"slots": {
    "Amount": {
        "name": "Amount",
        "value": "?"
    }
}

How can I make Alexa accepts currency values?

2 Answers 2

6

I'm a bit confused by what you wrote in your last sentence and the code, but I'll confirm that there is no built-in intent or slot for handling currency.

So, you'll have to do it manually using AMAZON.NUMBER slot type as you seem to be trying.

I would imagine that you will want to create utterences with two AMAZON.NUMBER slots - one for dollars and one for cents.

3
  • If i understand what you're saying, do you mean create an utterance: Send {DollarAmount} dollars and {CentsAmount} cents?
    – ewassef
    Feb 16, 2017 at 15:29
  • @ewassef yes, that is what I mean.
    – Tom
    Feb 16, 2017 at 16:57
  • Here is an issue for the lack of a money/currency slot type. We can vote it up to hopefully make it a higher priority.
    – Danny Guo
    Apr 30, 2018 at 3:06
1

Easy, make a custom slot and just use $10.11, $.03, and $1003.84 as the sample's. It will work as currency now, accepting users dollars and cents utterances and converting them to a dollar $XX.XX format.

1
  • Not sure that is right. I tried and does not work. Created custom slot for dollar custom slot and added sample values like $10.11, $.03, and $1003.84. When evaluated with "1 dollar 20 cents", alexa returns "1 dollar 20 cents" for slot value instead of "$1.20".
    – Harshit
    Jun 7, 2020 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.