DEV Community

Tejas Bal
Tejas Bal

Posted on

Integrating Cryptocurrency Prices in Salesforce using Lightning Web Component (LWC)

In this article I will integrate live cryptocurrency prices in Salesforce developer instance, so let’s get started !

I created a free account on CoinMarketCap to get an API key.

Image description

Complete documentation on how to use this api is provided here

I am using the latest listings api to get the prices.


  "data": [{
     "name": "Bitcoin",
     "symbol": "BTC",
     "quote": {
        "USD": { 
           "price": 9283.92,
           "percent_change_24h": 0.518894
Enter fullscreen mode Exit fullscreen mode

Create a Free Salesforce Developer account.

Create new Remote Site Settings entry for CoinMarketCap site url.

Image description

Code to create the lightning web component

  • The html is used to show the table with cryptocurrency prices.
  • The javascript file is used to call the Apex class and store the prices for the view.
  • The Apex class calls the CoinMarketCap to get the latest prices.

Deploy the code in your Salesforce Instance.

Please refer Create a Hello World Lightning Web Component trailhead for more details on how to write code and deploy it to Salesforce instance.

Let’s add our LWC component to the Contact Page.

Go to an existing contact record and Click Edit Page on the top right.

Image description

Drag the custom component to the layout above Activity section.

Image description

Save and Activate.

And all set, we have the Crypto Currency Live Prices in Salesforce !

Refresh the contact record page to get updated prices.

Image description

The code can be optimized for better performance. Github link to the repository in case you would like to reuse or contribute.

Thanks for reading !

Blog -
Medium -

Top comments (0)