Skip to content

Fix #490: swap dead exchange rate API in !convert - #502

Open
prakhar2000 wants to merge 1 commit into
ServiceNowDevProgram:mainfrom
prakhar2000:fix-currency-converter-api
Open

prakhar2000 wants to merge 1 commit into
ServiceNowDevProgram:mainfrom
prakhar2000:fix-currency-converter-api

Conversation

@prakhar2000

Copy link
Copy Markdown

Fixes #490

!convert is broken because exchangeratesapi.io now requires a key (and even then the free tier only allows EUR as the base). The issue calls it !currency but the command is !convert.
Changes in Parsers/Currency Converter.js:

  1. Switched to Frankfurter v1 (https://api.frankfurter.dev/v1/latest)which is free, no API key, same { base, rates } response the parser already reads
  2. Uppercased currency codes so !convert 10 usd to eur actually hits rates.EUR
  3. Fixed the error message since it was using regular quotes so Slack posted ${fromCurrency} literally

I hit the Frankfurter endpoint and the response shape matches. Haven't run it on a live ServiceNow instance.
Not in this PR: decimal amounts ((\d+) is also the activation regex) and checking HTTP status before JSON.parse.

…erpolation

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

!currency is broken

1 participant