Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building crypto price level alerts in n8n that fire once and re-arm

Description and use

The workflow produces price-level alerts that fire exactly once per crossing, remain silent while the condition is not met, and re-arm on the next crossing. The fire-once/re-arm logic is implemented in about ten lines of JavaScript within a single Code node using $getWorkflowStaticData('global') to persist state across scheduled runs.

Problem

A price-level alert fires repeatedly every minute while the condition remains true, producing the same notification every run until manually muted.

Outcome

The workflow produces price-level alerts that fire exactly once per crossing, remain silent while the condition is not met, and re-arm on the next crossing. The fire-once/re-arm logic is implemented in about ten lines of JavaScript within a single Code node using $getWorkflowStaticData('global') to persist state across scheduled runs.

Workflow

  • Schedule Trigger with cron expression * * * * * runs every minute
  • Config Set node stores telegramBotToken, telegramChatId, discordWebhookUrl, telegramApiBase, and levels (comma-separated rules like BTCUSDT>100000)
  • Check Code node fetches prices from Binance Vision API, parses levels into rules, evaluates each rule against current price, and maintains fired state via $getWorkflowStaticData('global') to implement fire-once / re-arm logic
  • Notify Code node sends each alert to Telegram and/or Discord using the configured tokens and webhooks

Evidence

If you have ever built a 'tell me when BTC is above X' alert, you have probably hit the same problem I did: the check runs every minute, the condition is true every minute, and you get the same message every minute until you mute the chat.

Source

What you actually want is an alert that fires once when the level is crossed, stays quiet while price sits on the other side, and re-arms when price crosses back, so the next crossing alerts again.

Source

This post walks through the n8n workflow I use for that. It is four working nodes, no exchange API keys, and the whole fire-once/re-arm logic is about ten lines of JavaScript.

Source

The workflow is called 'Crypto Pack 06 — Price level alerts (Binance)'. It has these nodes: Schedule (Schedule Trigger, Cron * * * * *), Run manually (Manual Trigger), Config (Set), Check (Code), Notify (Code).

Source

Keeping the settings in one Set node means the other nodes read them with $('Config').first().json, and nobody has to edit code to change a threshold.

Source

levels is a comma-separated list of rules. Each rule is a Binance symbol, > or <, and a number. You can put several rules on the same symbol, which is how you get a 'range' alert (above 100k and below 80k).

Source

Every minute is fine here: it is one HTTP request per run, to a public endpoint.

Source

state =

  • Record date: 2026-10-22T14:26:19.144Z