Home / Blog / Guides

Guides

Build a FOMO Whale-Alert Bot

Build a whale-alert bot on FOMO by connecting to the realtime alert stream at wss://api.fomoapi.io/ws/alerts, filtering for large buys and sells, and reacting live. A short code walkthrough.

A whale-alert bot does one thing well: it tells you the moment a notable trade happens, so you are not refreshing an app to catch it. On FOMO, you can build one against the realtime alert stream in a few lines.

Connect to the stream

The stream lives at wss://api.fomoapi.io/ws/alerts. Open it, and you receive a welcome message followed by alert messages as trades happen.

const ws = new WebSocket("wss://api.fomoapi.io/ws/alerts");

ws.onmessage = (e) => {
  const msg = JSON.parse(e.data);
  if (msg.type !== "alert") return;
  if (msg.type_ === "buy" || msg.type_ === "sell") {
    console.log(msg.text, msg.token, msg.tokenAddress);
    // send to Telegram, Discord, wherever you want the ping
  }
};

Each alert carries the trader, the token symbol, the token contract address, and the chain, so you have everything you need to act or to look the token up.

Scope it down

You rarely want the whole firehose. The stream lets you filter at the connection:

  • One trader, for a copy-trading bot: wss://api.fomoapi.io/ws/alerts?trader=frankdegods
  • One chain: add ?chain=solana (or base, eth, bsc)
  • By type: whale, thesis, price, trade

Or poll instead

If you do not want a socket, the same events are on REST at GET /v2/alerts, with ?type=, ?since=, and ?limit=. Poll it on an interval and dedupe on the alert id.

That is the whole bot: connect, filter, react. The data layer does the hard part of watching FOMO for you.

FOMO API is an independent, unofficial data layer for fomo.family. It is not affiliated with FOMO.

Ship on verified trader data

Both-chain wallets, real PnL, and a realtime feed. One API.

Get an API key

FAQ

How do I get realtime FOMO trades?
Connect to wss://api.fomoapi.io/ws/alerts. You receive a welcome message, then alert messages as trades happen, each with trader, token, contract address, and chain.
Can I watch only one trader?
Yes. Connect with ?trader=<handle> to receive only that trader’s activity, which is how you build a copy-trading bot.
Is there a REST option instead of a socket?
Yes. GET /v2/alerts serves the same events with ?type=, ?since=, and ?limit=. Poll it and dedupe on the alert id.
Is this affiliated with FOMO?
No. It is an independent, unofficial data layer for fomo.family and is not affiliated with FOMO.