Use the backend to make the call:
- if you need this to be secure,
- if you need the backend to process the result
- if the call(s) may be long running
If long running put it in a Job.
That will require some Ruby in a Plugin and one of the above mentioned gems.
It’s not necessarily all that easy to get into Discourse plugin development, it’s a big complex, opinionated platform, but there are good official guides on here and LOTS of existing open source plugins to look through (see #plugin and links to github). Try to find one that does something similar and look at how it is solved in code.
If it’s superficial consider a Theme Component. Look at the Theme Development guides on here.
Look at examples, like this one: discourse-tc-quote-of-the-day/get-quote.js.es6 at master · merefield/discourse-tc-quote-of-the-day (github.com)