For this tutorial I'm going to be using this Currency API because it's free for up to 100 uses a day.
*IMPORTANT*: You'll need to use a member field in order to complete this tutorial. Follow that link and create a member field called message.
Step 1: Create an account for Currency API
They'll send you a verification email. Make sure you click the link in the email they send to get your API Key. You'll need that later.
Step 2: Create a custom slash command in BotDisco
Step 3: Rename the flow and give the command a name
Renaming the flow is optional, but I like to give my flows unique names. I named the command /convert-currency.
Step 4: Add the options
You need options for from, to, and amount. Make the amount option a decimal number.
Step 5: (optional) Add choices for currencies
Under the from option, click on ADVANCED. Add the currency options you want to give. This step is optional, but it makes it more convenient for the user to pick the currency type from a list of choices.
Be sure to also add choices to the to option.
Step 6: Add an external request action
Step 7: Add the URL to do the conversion
Add this URL:
https://api.getgeoapi.com/v2/currency/convert?api_key=YOUR_API_KEY&from={{0._options.from}}&to={{0._options.to}}&amount={{0._options.amount}}&format=json
Replace YOUR_API_KEY with the API key you got from step 1. You can find it here.
Step 8: Save the result to a member field
Open the "Response Mapping" tab and add this to the Path
$.rates.{{0._options.to}}.rate_for_amount
Set the Field to be the message member field of the user that ran the command.
Step 9: Show the conversion
Use a "Reply to Slash command" action to show the result.