Get a mail for free when Bitcoin or any other crypto is below or above a certain price (or growth) with a Pipedream flow

Elvis Ciotti
4 min readApr 28, 2024

This guide will show you how to build a Pipedream flow that sends you free email notifications whenever the price of Bitcoin or any other cryptocurrency crosses a specific threshold you set.

Get the crypto data from Coinmarketcap for free via their RESTful API

Coinmarketcap lets you query their REST API for free to get 10k values a month for personal use (See pricing page).

Check the updated docs here.

This is how I get prices of 3 currencies.

data.BTC.quote.USD.price is the current price ($63,752).
data.BTC.quote.USD.percent_change_7d is the price change in the last 7 days (1.7%).

Here is an example of querying the API using curl and jq. Tags and repeating data are removed.

$ curl -s -H "X-CMC_PRO_API_KEY: <your key>" https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=BTC,ETH,XLM | jq '.data'
{
"BTC": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"slug": "bitcoin",
"num_market_pairs": 11018,
"date_added": "2010-07-13T00:00:00.000Z",
"tags": [

],
"max_supply": 21000000,
"circulating_supply": 19691290,
"total_supply": 19691290,
"is_active": 1,
"infinite_supply": false,
"platform": null,
"cmc_rank": 1,
"is_fiat": 0,
"self_reported_circulating_supply": null,
"self_reported_market_cap": null,
"tvl_ratio": null,
"last_updated": "2024-04-28T09:21:00.000Z",
"quote": {
"USD": {
"price": 63762.49309563547,
"volume_24h": 17604896741.46508,
"volume_change_24h": -25.7413,
"percent_change_1h": -0.20258744,
"percent_change_24h": 1.35486681,
"percent_change_7d": -1.72464286,
"percent_change_30d": -8.818529,
"percent_change_60d": 8.28253504,
"percent_change_90d": 51.39597754,
"market_cap": 1255565742669.1558,
"market_cap_dominance": 52.7827,
"fully_diluted_market_cap": 1339012355008.34,
"tvl": null,
"last_updated": "2024-04-28T09:21:00.000Z"
}
}
},
"ETH": {

},
"XLM": {
}
}

Free pipedream flow to email you based on price or growth

I’ll now explain how to use pipedream (with a generous free tier) that every day pull the prices with the API above, and if some conditions are met (e.g. bitcoin over 100k or grew more than 15% in last 24 hours).

If things are not clear, you can refer to another article of mine where I explain in more details how to create steps for a similar workflow using google sheet and email).

Create a new flow. Add a daily trigger first, and next a custom HTTP request, using the URL above and the header with your key. See the screenshot below

Daily schedule piped to a custom node request querying coinmarketcap

Now, you can add a custom filter based on a value (no coding), or (recommended) a node filter that lets you do more advanced things.

In the code editor, paste this to debug what’s coming from the API

console.log(steps.custom_request['$return_value'].data); // <-- add this

And click “Test” button to debug the object.

default code for the step

This is the code I’m using, to alert me if BTC or XLM goes above or below certain thresholds in terms of price or growth. Note that I’m logging the data (useful to see in the “Logs” tab and I’m exporting parsed data to be easily used by the next step as a string

export default defineComponent({
async run({steps, $}) {
const apiData = steps.custom_request['$return_value'].data; // <-- add this
const BTCdata = apiData.BTC.quote.USD;
const XLMdata = apiData.XLM.quote.USD;
let alarms = [];

// BTC
{
const {price, percent_change_24h, percent_change_7d, percent_change_30d} = BTCdata;
if (price > 99000 || price < 30000) {
alarms.push(`bitcoin at $${Math.round(price, 2)}`);
}
if (percent_change_24h > 10) {
alarms.push(`bitcoin 24h change ${percent_change_24h}%`);
}
if (percent_change_7d > 25) {
alarms.push(`bitcoin 7d change $percent_change_7d}%`);
}
if (percent_change_30d > 30) {
alarms.push(`bitcoin 30d change ${percent_change_30d}%`);
}
}


// XLM
{
const {price, percent_change_24h, percent_change_7d, percent_change_30d} = XLMdata;
if (price > 0.4 || price < 0.05) {
alarms.push(`XLM at $${Math.round(price, 2)}`);
}
if (percent_change_24h > 10) {
alarms.push(`XLM 24h change ${percent_change_24h}%`);
}
if (percent_change_7d > 25) {
alarms.push(`XLM 7d change $percent_change_7d}%`);
}
if (percent_change_30d > 30) {
alarms.push(`XLM 30d change ${percent_change_30d}%`);
}
}

console.log("alarms", alarms);
console.log("condition", alarms.length > 1);

if (alarms.length > 0) {
$.export("$summary", "at least one alarm. Continuing workflow")
$.export("alarms", alarms.join("<br/>\n"));
} else {
$.flow.exit("Ending workflow early because no alarms triggered")
}

},
})
Click on “Test” to see the results. Change temporarily the limits to see some outputs

You can now add a “send email” step where in the body you can choose the output from the step before (steps.filter1.alarm)

Email settings. Use HTML as type

Click “Test to send the email”

You’ll receive one the day your alarms get triggered.

Click here to register to pipedream

Clap if useful and feel free to ask any question in the comments

--

--

Elvis Ciotti

Software Contractor — Java, Spring, k8s, AWS, Javascript @ London - hire me at https://www.linkedin.com/in/elvisciotti