Cryptocurrency Converter — Confluence Cloud Macro
The macro sets the amount to convert and the currencies for conversion, constructs an API URL to fetch the conversion rate, and calculates the converted amount.
User Parameters
Amount
Enter an amount for conversion
From Currency
Select a crypto to convert from
To Currency
Select a fiat currency to convert to
Template
#set($amount = $parameters.amount)
#set($fromCurrency = $StringUtils.lowerCase($parameters.fromCurrency))
#set($toCurrency = $StringUtils.lowerCase($parameters.toCurrency))
## API URL for conversion
#set($apiUrl = "https://api.coingecko.com/api/v3/simple/price?ids=$fromCurrency&vs_currencies=$toCurrency")
## Fetch conversion rate from the API
#set($response = $RequestManager.get($apiUrl))
## Check if response contains valid data
#if($response && $response[$fromCurrency] && $response[$fromCurrency][$toCurrency])
## Calculate the converted amount
#set($conversionRate = $response[$fromCurrency][$toCurrency])
#set($convertedAmount = $amount * $conversionRate)
## Display the conversion result
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-success">Conversion result:</span>
<p>
$amount $StringUtils.capitalize($fromCurrency) = $StringUtils.upperCase($toCurrency) $convertedAmount
</p>
#else
## Display error message if conversion fails
<p>
Unable to retrieve conversion rate
</p>
#endRecommended Macros
Get the latest cryptocurrency rates for major coins.
Retrieve and display current exchange rates for major currencies against a specified base currency.
Parses a table containing cost and currency columns, converts each row's value into a selected result currency, and appends a footer row showing the total sum. Useful for tracking multi-currency expenses and reporting totals in a unified currency.
The content of this macro will be printed and exported but not rendered on the page in view mode
Display page edit and view restrictions in Confluence to get essential permission details, including users, groups, and inherited access.
Macro for printing all the spaces
Filter Confluence groups based on a specified filter value and display the results in different formats.
Macro for generating ID in base32 format