Currency Amount (INCurrencyAmount) parameter not working.

I have a few Custom Intents defined in an intents definitions file. One of these intents allow the user to capture an expense. Naturally, one of the parameters for the expense is the amount charged.

When I initially created these intents in November 2022, this intent worked brilliantly. The user specified the amount, in the way you would usually communicate a currency amount by including words like "dollar" or "cents", and all worked well.

About a month ago, a user informed me about a problem with the intent. All parameter values resolved except for the expense amount parameter. No matter what you provided for the expense amount, Siri would reply with "expense amount cannot be negative". Investigating the issue confirmed the problem. I'm unable to determine exactly when this started happening as most of our users don't use the Siri integration and not all users inform us about issues they find.

I implemented a temporary workaround and finally have the time to spend to resolve this problem.

I added a breakpoint to the intent handler's "resolveParameterExpenseAmount" method to see where the breakdown in communication was. First, the breakpoint was never hit. Siri would still reply with "expense amount cannot be negative".

I realised the Validation Errors defined in the parameter's settings were catching the value before I was asked to resolve it in the intent handler.

So I removed all of the validation errors (you can't remove them with the minus sign below, I just hit back space on the keyboard on each one). This time, the breakpoint was hit, but the expense amount was nil.

To make sure I wasn't messing something up with this parameter being part of a whole bunch of other parameters, I decided to create just a simple Test intent.

This is the properties on the custom intent:

There is one parameter, configured like this:

The section under Shortcuts app:

The section under Suggestions:

As for the response section, I kept it very basic:

Finally, the intent handler for this test intent:

This is a very basic test. Once again, after invoking the intent, Siri asks me for the test amount. Upon giving it to her, the reply: "Test Amount can't be negative".

To change things up a little regarding "the negative number validation", I change the minimum value to -1, allowing the value to be negative.

This time, no matter the amount I specify (including amounts like "one" and "zero"), the standard reply is: "Test Amount can't be higher than one hundred thousand".

The one thing I'm uncertain about, is the "Currency Codes" section in the parameter settings:

I don't know if I have to add the currencies the user can possibly talk about there? I can't find any proper documentation on the parameter settings specifically related to Currency Amount.

For now, the work around remains in place. I changed my expense amount to type "Decimal". The drawback is that Siri cannot infer $542.62 from "Five hundred and forty two dollars and sixty two cents". I had to change the prompt to: "What is the expense amount? Specify only the numeric value and do not include currency metrics like dollar and cents."

Really? That's just ridiculous! Especially since the Currency Amount parameter worked absolutely fine a few months ago.

Are my settings wrong in the definition file? Is there an issue with SiriKit's validation on Currency Amounts? Must I specify currency codes somewhere?

I'm not sure what else to try.

Any advice will be greatly appreciated.

Replies

Logged in Feedback Assistant: FB12645837