HomeCrypto & FinanceHow to Build a Telegram Crypto…
Crypto & Finance

How to Build a Telegram Crypto Price Alert Bot with n8n

How to Build a Telegram Crypto Price Alert Bot with n8n

Missing a Bitcoin pump or getting wrecked by a sudden drop you didn’t see coming — that’s the hidden cost of watching charts manually. Most crypto traders either stare at their screen all day or miss the exact moment they needed to act. This tutorial shows you how to build an automated Telegram bot that watches your chosen coins every 15 minutes and pings you the instant prices break your personal alert thresholds — or when any coin moves more than 5% in 24 hours. No coding background required. Just n8n, a free CoinGecko API key, and a Telegram bot.

Prefer to skip the setup? Grab the ready-made template → and be up and running in under 10 minutes.

What You’ll Build

  1. A scheduled n8n workflow that fires every 15 minutes and fetches live prices for Bitcoin, Ethereum, Solana, BNB, and XRP from CoinGecko’s free API.
  2. A smart code node that checks each coin against your custom price thresholds (e.g., “alert me when BTC goes above $75,000 or below $55,000”) and flags any coin with a 24-hour move greater than 5%.
  3. A conditional gate that only fires when something actually matters — no noisy, irrelevant pings.
  4. A clean, formatted Telegram message delivered straight to your phone listing current prices plus a highlighted alert block showing exactly what triggered.

How It Works — The Big Picture

The workflow is a simple five-node pipeline. A schedule wakes it up every 15 minutes, a single HTTP call fetches all prices at once, a JavaScript code node crunches the numbers against your thresholds, and an IF gate decides whether your phone needs to know about it.

┌──────────────────────────────────────────────────────────────────────────┐
│  TELEGRAM CRYPTO PRICE ALERT BOT                                         │
│                                                                          │
│  [Schedule Trigger]  →  [Get Crypto Prices]  →  [Check Alert Thresholds] │
│     every 15 min          CoinGecko API           Code node (JS)         │
│                                                          │               │
│                                              ┌───────────┴───────────┐   │
│                                         hasAlerts?               no alert│
│                                              │                       │   │
│                                    [Send Alert to Telegram]   [Skip]     │
│                                       Telegram bot                       │
└──────────────────────────────────────────────────────────────────────────┘

What You’ll Need

  • n8n — self-hosted or n8n Cloud (free tier works fine for this workflow)
  • CoinGecko account — free plan; no API key required for the public endpoint used here (rate limit: 10–30 calls/min, well within our 15-minute schedule)
  • Telegram account — you’ll create a bot via BotFather (free, takes 2 minutes)
  • Your Telegram chat ID — we’ll show you exactly how to find it below

Estimated build time: 25–35 minutes from scratch, or under 10 minutes with the ready-made template.

Part 1 — Building the Workflow

1 Schedule Trigger (n8n-nodes-base.scheduleTrigger)

This is the heartbeat of the workflow. It wakes up n8n every 15 minutes and kicks off the entire pipeline. Add a Schedule Trigger node and configure it like this:

  • Mode: Interval
  • Every: 15 Minutes

The trigger produces a single output item with a timestamp. That’s all the next node needs — it just needs to know it’s time to fetch prices.

💡

Tip: Prefer a 1-hour interval to reduce noise? Change the minutes value to 60. If you want minute-level granularity (great for active trading sessions), drop it to 5 — CoinGecko’s free tier handles this comfortably.

2 Get Crypto Prices (n8n-nodes-base.httpRequest)

Add an HTTP Request node. This single API call fetches prices and 24-hour change data for all five coins simultaneously — no need for separate calls per coin.

  • Method: GET
  • URL: https://api.coingecko.com/api/v3/simple/price
  • Query Parameters (add each as a separate row):
Parameter Value
ids bitcoin,ethereum,solana,binancecoin,ripple
vs_currencies usd
include_24hr_change true
include_market_cap true

No authentication needed for this endpoint. The API returns a flat JSON object where each key is a coin ID:

{
  "bitcoin":     { "usd": 67543.21, "usd_24h_change": 2.45,  "usd_market_cap": 1330000000000 },
  "ethereum":    { "usd": 3421.56,  "usd_24h_change": -1.23, "usd_market_cap": 411000000000  },
  "solana":      { "usd": 178.92,   "usd_24h_change": 6.11,  "usd_market_cap": 83000000000   },
  "binancecoin": { "usd": 587.44,   "usd_24h_change": 0.87,  "usd_market_cap": 87000000000   },
  "ripple":      { "usd": 0.5821,   "usd_24h_change": -2.34, "usd_market_cap": 32000000000   }
}
💡

Tip: To add more coins, find their CoinGecko ID on the coin’s page (e.g., cardano, polkadot, avalanche-2) and append them comma-separated to the ids parameter. Also add matching entries to the thresholds and coinLabels objects in Step 3.

3 Check Alert Thresholds (n8n-nodes-base.code)

This is where the logic lives. Add a Code node (JavaScript mode) and paste the script below. It loops through every coin, checks prices against your thresholds, flags large 24-hour moves, and assembles a formatted Telegram message ready to send.

Here’s the config block at the top of the script — the only section you need to customize:

// ─── USER CONFIG ─────────────────────────────────────────────
const thresholds = {
  bitcoin:     { low: 55000,  high: 75000 },
  ethereum:    { low: 2800,   high: 4000  },
  solana:      { low: 120,    high: 220   },
  binancecoin: { low: 400,    high: 700   },
  ripple:      { low: 0.40,   high: 0.80  },
};

// Alert if any coin moves more than this % in 24 hours
const CHANGE_ALERT_PCT = 5;
// ─────────────────────────────────────────────────────────────

After running, the node outputs a single item with this shape:

{
  "hasAlerts":   true,
  "alertCount":  1,
  "message":     "📊 *Crypto Price Update — Apr 7, 02:30 PM ET*\n\n🟢 *BTC*: $67,543.21 (+2.45%)\n🔴 *ETH*: $3,421.56 (-1.23%)\n🟢 *SOL*: $178.92 (+6.11%)\n...\n\n🔔 *ALERTS*\n⚡ *Solana (SOL)* surged +6.11% in 24h — now $178.92",
  "timestamp":   "2026-04-07T18:30:00.000Z"
}
📌

Note: The full JavaScript code is included in the downloadable template JSON. When you import the workflow, the code node is pre-filled — you only need to update the threshold values in the USER CONFIG block at the top.

4 Has Alerts? (n8n-nodes-base.if)

Add an IF node to act as the gate. Configure one condition:

  • Value 1: {{ $json.hasAlerts }}
  • Operator: is true

The true branch connects to the Telegram node. The false branch connects to a No-Op (do nothing) node — this prevents n8n from throwing an “unconnected branch” warning while keeping the workflow clean.

💡

Tip: Want a periodic price summary even when no alerts fire? Connect the false branch to a second Telegram node that sends just the priceReport field instead of the full message. Great for a morning digest.

5 Send Alert to Telegram (n8n-nodes-base.telegram)

Add a Telegram node and connect it to the true output of the IF node. Before configuring it, you need a bot token and your chat ID.

Creating your Telegram bot:

  1. Open Telegram and search for @BotFather
  2. Send /newbot, give it a name (e.g., “My Crypto Alerts”) and a username ending in bot
  3. BotFather sends you a token like 7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx — save it
  4. Start a conversation with your new bot (click “Start” or send any message)
  5. Visit https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates in your browser — find your chat.id in the response (it’s a number like 123456789)

Configuring the Telegram node:

  • Credential: Create a new Telegram API credential → paste your bot token
  • Chat ID: YOUR_TELEGRAM_CHAT_ID (the number you found above)
  • Text: ={{ $json.message }}
  • Additional Fields → Parse Mode: Markdown

When an alert fires, the message delivered to your phone looks like this:

📊 Crypto Price Update — Apr 7, 02:30 PM ET

🟢 BTC: $67,543.21 (+2.45%)
🔴 ETH: $3,421.56 (-1.23%)
🟢 SOL: $178.92 (+6.11%)
🟢 BNB: $587.44 (+0.87%)
🔴 XRP: $0.58 (-2.34%)

🔔 ALERTS
⚡ Solana (SOL) surged +6.11% in 24h — now $178.92
💡

Tip: To send alerts to a Telegram group or channel instead of just yourself, add the bot as an admin to your group, then use the group’s chat ID (starts with a minus sign, e.g., -1001234567890) as the Chat ID value.

Full System Flow

Every 15 minutes
      │
      ▼
[Schedule Trigger]
      │
      ▼
[HTTP Request → CoinGecko API]
  GET /simple/price
  ids=bitcoin,ethereum,solana,bnb,xrp
  include_24hr_change=true
      │
      ▼ (raw price JSON)
[Check Alert Thresholds — Code Node]
  ├── Loop each coin
  ├── Compare price vs. low/high thresholds
  ├── Flag if |24h change| ≥ 5%
  ├── Build formatted Telegram message
  └── Output: { hasAlerts, message, ... }
      │
      ▼
[Has Alerts? — IF Node]
  hasAlerts === true?
      │                     │
     YES                   NO
      │                     │
      ▼                     ▼
[Send Alert to Telegram]  [No-Op — Skip]
  Parse Mode: Markdown
  Delivered to your phone

Testing Your Workflow

Before enabling the schedule, run the workflow manually once to confirm everything is wired up correctly:

  1. Open the workflow in the n8n editor and click Test Workflow (the play button).
  2. Click on the Get Crypto Prices node — you should see live price data in the output panel on the right.
  3. Click on Check Alert Thresholds — verify the message field contains a formatted price string and that hasAlerts shows the expected value.
  4. To force an alert for testing, temporarily set a threshold your current price has already crossed — e.g., set BTC high to 1000 so it always triggers. Run again, and your Telegram should receive a message within seconds. Reset the threshold afterward.
  5. Once confirmed, toggle the workflow Active switch. It will now run automatically every 15 minutes.
Problem Likely Cause Fix
HTTP Request returns 429 CoinGecko rate limit hit Increase the schedule interval to 30 min, or sign up for a CoinGecko Demo API key and add it as a header
Telegram node says “Forbidden” Bot hasn’t been started Open Telegram, find your bot, and send it any message first — bots can’t initiate conversations
Message sends but formatting is broken Parse Mode not set to Markdown In the Telegram node → Additional Fields → set Parse Mode to Markdown
No alerts ever fire Thresholds set outside realistic price ranges Check the thresholds object — make sure low/high values bracket actual current prices
Workflow runs but nothing happens IF node false branch reached (no alerts) Expected behavior — set a temporary low threshold to trigger a test alert as described above

Frequently Asked Questions

Does this cost anything to run?

No — CoinGecko’s public API used in this workflow is completely free with no API key required. The only costs are your n8n hosting (free on self-hosted, or the n8n Cloud free tier covers this comfortably) and your Telegram bot (always free). Total running cost: $0.

Can I track more than 5 coins?

Yes. Add more coin IDs to the ids query parameter in the HTTP Request node (comma-separated, using CoinGecko’s lowercase coin IDs like cardano, chainlink, or avalanche-2). Then add matching entries to the thresholds and coinLabels objects in the Code node. CoinGecko’s free tier supports up to ~250 coin IDs per request.

Can I send alerts to multiple Telegram chats or a group?

Absolutely. Duplicate the Telegram node and set a different Chat ID for each recipient — or add your bot to a Telegram group and use the group’s chat ID (a negative number like -1001234567890). You can find a group’s chat ID the same way as your personal one: visit the getUpdates URL after the bot receives a message in the group.

What happens if CoinGecko is down when the workflow runs?

The HTTP Request node will throw an error, which n8n logs in the execution history. The workflow won’t crash permanently — it simply skips that execution and runs again 15 minutes later. For higher reliability, enable the Retry on Fail option on the HTTP Request node (set to 2 retries, 5 second delay).

Can I get alerts for percentage-based price changes rather than fixed thresholds?

Yes — the Code node already handles this. The CHANGE_ALERT_PCT constant (default: 5) fires an alert whenever any coin moves more than 5% in 24 hours, in either direction. Adjust that number to any value you prefer.

Can I use this with a CoinGecko Pro API key for more features?

Yes. If you upgrade to CoinGecko’s Demo or Pro plan, you get a personal API key that unlocks lower rate limits and additional endpoints (like real-time prices). Add it as an HTTP header named x-cg-demo-api-key in the HTTP Request node’s Headers section. The rest of the workflow stays identical.


🚀 Get the Telegram Crypto Price Alert Bot Template

Skip the build and get the pre-configured n8n workflow JSON, a step-by-step Setup Guide PDF, and a Credentials Guide PDF — everything you need to be live in under 10 minutes.

Get the Template →

Instant download · Works on n8n Cloud and self-hosted

What’s Next?

  • Add a daily digest: Connect the false branch of the IF node to a second Telegram send that fires a clean price summary every morning at 9 AM — regardless of alerts — using a separate Schedule Trigger.
  • Log alerts to Google Sheets: Add a Google Sheets node after the Telegram send to log every triggered alert with a timestamp. Track your alert history over time.
  • Add portfolio tracking: Extend the Code node to calculate the current USD value of your holdings (e.g., “1.5 BTC × $67,543 = $101,315”) and include it in the Telegram message.
  • Connect to a trading signal: Feed alert data into a webhook that triggers a paper trade or signals a human review — building toward a semi-automated trading assistant.
n8n
Telegram
CoinGecko
crypto
price alerts
automation
no-code
trading bots