const ws = new WebSocket("wss://leviathan.whale-alert.io/ws?api_key=YOUR_API_KEY");
ws.onopen = () => ws.send(JSON.stringify({
type: "subscribe_alerts",
blockchains: ["ethereum"],
symbols: ["link"],
min_value_usd: 100000,
}));
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "alert") console.log(msg.amounts, msg.from, "→", msg.to);
};
import asyncio, json
from websockets.asyncio.client import connect
async def main():
url = "wss://leviathan.whale-alert.io/ws?api_key=YOUR_API_KEY"
async with connect(url) as ws:
await ws.send(json.dumps({
"type": "subscribe_alerts",
"blockchains": ["ethereum"],
"symbols": ["link"],
"min_value_usd": 100000,
}))
async for raw in ws:
msg = json.loads(raw)
if msg.get("type") == "alert":
print(msg["amounts"], msg.get("from"), "->", msg.get("to"))
asyncio.run(main())
package main
import (
"fmt"
"log"
"github.com/gorilla/websocket"
)
func main() {
conn, _, err := websocket.DefaultDialer.Dial("wss://leviathan.whale-alert.io/ws?api_key=YOUR_API_KEY", nil)
if err != nil {
log.Fatal(err)
}
defer conn.Close()
err = conn.WriteJSON(map[string]any{
"type": "subscribe_alerts",
"blockchains": []string{"ethereum"},
"symbols": []string{"link"},
"min_value_usd": 100000,
})
if err != nil {
log.Fatal(err)
}
for {
var msg struct {
Type string `json:"type"`
From string `json:"from"`
To string `json:"to"`
Amounts []struct {
Symbol string `json:"symbol"`
Amount float64 `json:"amount"`
} `json:"amounts"`
}
if err := conn.ReadJSON(&msg); err != nil {
log.Fatal(err)
}
if msg.Type == "alert" {
fmt.Println(msg.Amounts, msg.From, "->", msg.To)
}
}
}
Example alert you receive
{
"type": "alert",
"blockchain": "bitcoin",
"transaction_type": "transfer",
"to": "Coinbase",
"amounts": [{ "symbol": "btc", "amount": 1500, "value_usd": 98512350 }],
"transaction": { "hash": "7c3f9a1e…6be91a", "height": 970412 },
"timestamp": 1791900127
}