YNAB Alexa Skill: Budget Currency is not followed

I like the Alexa skill and I'm using it! But I think there's a mistake on the currency that Alexa is saying. I have a budget that is in Philippine Peso but when I asked for a balance, she says dollars and cents (should be pesos and centavos). Not sure if my use case has been considered by the engineering team. I'm actually a software developer so I'm not sure if this can be considered a bug or as an enhancement. Hope to see an update to Alexa skill soon! 👌

7replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Alfred !

    Thanks for letting us know! That does sound like a bug. Can you please fill out a Bug Report? One of our bug squashing experts 🐛 will follow up with you directly!

    Reply Like
      • Alfred
      • firnnauriel
      • 6 mths ago
      • Reported - view

      Nicole at YNAB I just submitted my bug report. I have some feedback on the form: Alexa is a different platform and should be added on most of the options there :)

      Reply Like
  • Hi Alfred ,

    I sent you an email but I also wanted to post here: our developers are now working on adding the Philippine Peso to Alexa, thanks to your feedback here. Keep an eye on our Release Notes for news when it has launched! :-)

    Happy [hands free 😉] budgeting!

    -Elena

    Reply Like
      • Alfred
      • firnnauriel
      • 6 mths ago
      • 1
      • Reported - view

      Elena  Awesome. Thanks for the update 👍. I'm excited to hear my currency spoken by Alexa!

      But I have a suggestion that could probably help developers too so that they won't have to wait for someone to request for other currencies. Here's the idea:

      • Check if the budget is in supported currencies (USD, EUR, GBP... soon PHP, yay!)
      • If yes, then use the corresponding whole and decimal units (dollar/cents, pesos/centavos, etc.)
      • If no,  then don't add any units or symbols (i.e. let Alexa say 100.25 instead of $100.25. In that way, Alexa will just read it as "one hundred point twenty-five")
      • In the future, add the remaining whole/decimal units for every currency listed in the Budget setting
      Reply Like 1
  • Alfred Great suggestions here! I also have some good news: we released an update today to add support for Philippine Pesos to the Alexa skill. So, you should see (or...hear?) that as an option now! 🎉

    Thanks again for originally bringing this to our attention, and for your latest idea too (I've shared that with our developers, too!).

    -Elena

    Reply Like
      • Alfred
      • firnnauriel
      • 6 mths ago
      • Reported - view

      Elena You guys are awesome! Saw the release notes, I love the Tagalog translation entry there too! 👍

      I made some testing and I would like to suggest an improvement to the implementation because my sample balance of P3,400.00 is presented in the card text as 'P3400.0' and spoken as 'thirty-four hundred dot zero'. In the Philippines, it is not typical to hear the usage of 'hundreds' (i.e. $2,500 = twenty five hundred dollars).

      And so I've spent a few hours today to investigate what's the best way for Alexa to say and present that as text (if device can display card like my phone and TV).  So here's my proposed implementation using JavaScript:

      function formatToPhilippinePeso(amount) {
          let response = '';
      
          let amountInNumber = Number(amount);
          let cleanedAmountString = amountInNumber.toString();
          let [wholePart, decimalPart] = cleanedAmountString.split('.');
      
          if(wholePart && !isNaN(wholePart)) {
              let wholePartWithComma = Number(wholePart).toLocaleString('en');
              if(wholePartWithComma) {
                  response = `\u20B1 ${wholePartWithComma}`;
              }
      
              if(!wholePartWithComma) response += '0';
              if(decimalPart) {
                  let decimalNumber = Math.round(Number('.' + decimalPart) * 100);
                  response += `.${decimalNumber.toString()}`;
              } else {
                  response += `.00`;
              }
          }
      
          return response || `\u20B1 0.00`;
      }
      
      function speakToPhilippinePeso(amount) {
          let response = '';
      
          let amountInNumber = Number(amount);
          let cleanedAmountString = amountInNumber.toString();
          let [wholePart, decimalPart] = cleanedAmountString.split('.');
      
          if(wholePart) {
              let wholeNumber = Number(wholePart);
              if(wholeNumber) {
                  response = `\u20B1 <say-as interpret-as='cardinal'>${wholeNumber}</say-as> ${addPesoUnit(wholeNumber)}`;
              }
      
              if(decimalPart) {
                  if(wholeNumber) response += ' and ';
                  let decimalNumber = Math.round(Number('.' + decimalPart) * 100);
                  response += `${decimalNumber} ${addCentavoUnit(decimalNumber)}`;
              }
          }
      
          return response || 0;
      
          function addPesoUnit(value) {
              return `peso${isMoreThanOne(value) ? 's' : ''}`;
          }
      
          function addCentavoUnit(value) {
              return `centavo${isMoreThanOne(value) ? 's' : ''}`;
          }
      
          function isMoreThanOne(value) {
              return Math.abs(value) > 1;
          }
      }

      I'm hoping that you guys are using JavaScript in the backend since it would be very easy to integrate those 2 methods I provided above. Here's a sample usage:

      // these 3 lines are inside identifyMessage().
      // it contains the invocation to the functions I provided above
      let inputAmount = '3400.0';
      message = "The balance is " + speakToPhilippinePeso(inputAmount);
      cardMessage = "The balance is " + formatToPhilippinePeso(inputAmount);
      
      ...
      
      // actual invocation of identifyMessage() to get the audio and card message
      let [message, cardMessage] = identifyMessage(req.body.request.intent.name);
      
      ...
      
      // sample response to Alexa
      let data = JSON.stringify({
          "version": "1.0",
          "response": {
              "outputSpeech": {
                  "type": "SSML",
                  "ssml": "<speak>" +
                      message +
                  "</speak>"
              },
              "card": {
                  "type": "Simple",
                  "title": "My Vector",
                  "content": cardMessage
              }
          },
          "sessionAttributes": {},
          "userAgent": "ask-node/2.0.0 Node/v8.10.0"
      });

      Please share this to the developers and let them review it. Sorry if I'm a bit strict on this (I'm not a QA btw 😉) but I would love to use Alexa every day and have a good experience/response when using it. Note that I've been using YNAB Classic from Aug 2013 to Jan 2019. My shift to YNAB online is a great decision because I know the power of the Cloud and you guys made a lot of improvements since then! Cheers to YNAB! 🥂

      Reply Like
  • Hi Alfred ,

    Wow, thank you for the detailed request here! This is so great, and I've made sure that our developers see your post. Really, can't thank you enough for this level of detail and thoughtfulness! :-)

    Also, thanks for being such a loyal YNABer! I'm really glad to hear that you've enjoyed YNAB all along the way. Happy budgeting!

    -Elena

    Reply Like
Like Follow
  • 6 mths agoLast active
  • 7Replies
  • 98Views
  • 4 Following