I wanted a simple thing: a message in Discord (or Telegram) when bitcoin drops below a line I care about, without signing up for an exchange, without an API key, and without an alert app pinging me every five minutes while the price sits there.
n8n can do this with about a dozen core nodes. Below is how it works step by step, and the finished workflow is free on GitHub if you'd rather import it than build it.
Free workflow (JSON + README): https://github.com/Relaybrook/n8n-free-workflows/tree/main/workflows/crypto-price-alert-lite
What you need
- n8n (self-hosted via Docker or
npx n8n, or n8n Cloud). I tested on self-hosted n8n 2.47.7. - Somewhere to receive alerts: a Discord or Slack incoming-webhook URL, any URL that accepts a JSON POST, or a Telegram bot.
- No CoinGecko key. The public API works without one.
1. Get prices from CoinGecko in one request
CoinGecko's /simple/price endpoint returns the price of several coins in one call:
GET https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd
{"bitcoin":{"usd":64305},"ethereum":{"usd":1808.75},"solana":{"usd":72.31}}
The ids are CoinGecko coin ids, not tickers. You'll find the id in the coin's URL on coingecko.com (TON is the-open-network, for example).
One request per run for all coins matters, because keyless access is rate-limited per IP. Every 15 minutes is comfortable from your own server.
2. Keep the rules in plain text
Instead of one IF node per coin, put the rules in a Set node (I call it Config) as one text field:
bitcoin: above 70000, below 60000
ethereum: below 2000
solana: above 200
A Code node (I named it Parse Watchlist) turns that into rules and builds the URL:
const cfg = $('Config').first().json;
const rules = [];
for (const raw of cfg.watchlist.split(/\r?\n/)) {
const m = raw.trim().match(/^([a-z0-9-]+)\s*:\s*(.+)$/i);
if (!m) continue;
for (const part of m[2].split(',')) {
const r = part.trim().match(/^(above|below)\s+([0-9.,]+)$/i);
if (r) rules.push({ coin: m[1].toLowerCase(), dir: r[1].toLowerCase(), level: Number(r[2].replace(/,/g, '')) });
}
}
const coins = [...new Set(rules.map(r => r.coin))];
return [{ json: { rules, url: 'https://api.coingecko.com/api/v3/simple/price?ids=' + coins.join(',') + '&vs_currencies=usd' } }];
(The free workflow also reports lines it can't read instead of silently skipping them.)
3. Call the API without crashing on rate limits
Add an HTTP Request node with URL {{ $json.url }}. Under Options → Response, turn on Include Response Headers and Status and Never Error, and set the format to Text. Now a 429 Too Many Requests comes through as data (statusCode: 429) that you can handle, instead of a failed execution at 3 a.m.
4. Alert once, then re-arm
This is the part most quick tutorials skip. If bitcoin is above 70,000 and your workflow runs every 15 minutes, a naive check sends the same alert 96 times a day.
n8n's workflow static data fixes that. It's a small object n8n saves between production runs of an active workflow:
const state = $getWorkflowStaticData('global');
state.fired = state.fired || {};
const prices = JSON.parse($input.first().json.data);
const alerts = [];
for (const r of $('Parse Watchlist').first().json.rules) {
const price = prices[r.coin]?.usd;
if (price === undefined) continue;
const key = `${r.coin}|${r.dir}|${r.level}`;
const hit = r.dir === 'above' ? price > r.level : price < r.level;
if (hit && !state.fired[key]) alerts.push(`${r.coin} is ${r.dir} ${r.level} (now ${price})`);
if (hit) state.fired[key] = true; else delete state.fired[key];
}
return [{ json: { alert_count: alerts.length, message: alerts.join('\n') } }];
A rule fires when the price crosses the line, stays quiet while it remains there, and re-arms once the price goes back. One caveat: static data is only saved for active (scheduled) runs, not for manual test runs in the editor.
5. Send one message
An IF node checks alert_count > 0. Then:
-
Discord: HTTP Request, POST to your webhook URL with body
{ "content": "<message>" }. -
Slack: same, with
{ "text": "<message>" }. - Telegram: the Telegram node, with a bot from @botfather and your chat id.
All alerts from one run go out as one message, never one per coin.
6. Test without touching the network
I like workflows that show you the result before you configure anything. The free version has a test_mode switch that is on by default: an IF node routes to a Code node returning a sample price response (made-up prices), and the message only appears in a Preview node. Import it, click Execute workflow, and you'll see two sample alerts in a few seconds. Set test_mode = false when you're ready.
What I tested
On self-hosted n8n 2.47.7: the shipped file in test mode, the live path against a local server returning CoinGecko's response shape (Discord and Slack bodies posted to a local webhook), an unknown coin id, an unreadable line, and an HTTP 429. Telegram sending and the re-arm memory across real scheduled runs weren't tested. From my test machine, the real CoinGecko API answered 429 (busy shared IP), which the workflow reported instead of crashing. That's the most likely problem you'll hit too if you run n8n on a crowded cloud IP.
This is information tooling, not financial advice. It reads public prices and can't trade.
Disclosure: the paid version
I'm the maker behind Relaybrook, and I also sell a bigger version. The Crypto Watch Pack for n8n ($19) adds % move alerts and cooldowns, a daily portfolio report from Google Sheets or CSV, and a watcher that tells you when a public TRON, Ethereum or Bitcoin address receives a transfer (USDT TRC-20 included), all read-only on free public APIs. Code CRYPTO10 takes 10% off until Nov 30, 2026 (crypto checkout). The free workflow above works on its own; you don't need to buy anything.
Top comments (0)