An unlock alert bot tells your group before supply hits the market, so nobody learns about a cliff from the price chart. This guide builds one in a single file: it posts the biggest upcoming unlocks across the market, or only the tokens you follow, to Telegram or Discord, never repeats an alert, and runs on a schedule.
It uses the Vestream API for the data. If you just want the shortest possible version, project 1 in building with token unlock data is ten lines. This is the version you'd leave running.
Call GET /unlocks/upcoming?days=1&min_usd=1000000 for the market, or GET /token/{chainId}/{address}/unlocks?days=2 for each token you follow. Post each new unlock to a Telegram chat or a Discord webhook, remember what you've posted, and run it every few hours.
What you need
- A Vestream API key. Free and instant at vestream.io/build. Put it in
VESTREAM_API_KEY. - Somewhere to post. For Telegram, create a bot with @BotFather (it gives you
TELEGRAM_TOKEN), add it to your group, and find the group'sTELEGRAM_CHAT_ID. For Discord, create a webhook in the channel's settings (Integrations → Webhooks) and copy its URL intoDISCORD_WEBHOOK_URL. - Node 18 or later. No packages needed.
The bot
// unlock-bot.mjs: post upcoming token unlocks to Telegram or Discord.
import { readFile, writeFile } from "node:fs/promises";
const API = "https://www.vestream.io/api/v1";
const MIN_USD = Number(process.env.MIN_USD ?? 1_000_000); // market mode threshold
const HOURS_AHEAD = Number(process.env.HOURS_AHEAD ?? 24);
// Watchlist mode: "chainId:address" pairs. Leave empty for the whole market.
const WATCHLIST = (process.env.WATCHLIST ?? "").split(",").map((s) => s.trim()).filter(Boolean);
const SEEN_FILE = "./seen.json";
async function vestream(path) {
const res = await fetch(API + path, { headers: { Authorization: `Bearer ${process.env.VESTREAM_API_KEY}` } });
if (!res.ok) throw new Error(`Vestream ${res.status}: ${(await res.json().catch(() => ({}))).error ?? res.statusText}`);
return res.json();
}
// Raw amounts are integers in the token's smallest unit.
const toUnits = (raw, decimals) => Number(BigInt(raw) / 10n ** BigInt(Math.max(0, decimals - 6))) / 10 ** Math.min(decimals, 6);
const fmt = (n) => n.toLocaleString("en-US", { maximumFractionDigits: 0 });
async function upcoming() {
const now = Date.now() / 1000;
const until = now + HOURS_AHEAD * 3600;
if (WATCHLIST.length === 0) {
const days = Math.max(1, Math.ceil(HOURS_AHEAD / 24));
const { unlocks } = await vestream(`/unlocks/upcoming?days=${days}&min_usd=${MIN_USD}`);
return unlocks.filter((u) => u.unlock_time <= until).map((u) => ({
key: `${u.chain_id}:${u.token_address}:${u.unlock_time}`,
symbol: u.token_symbol ?? "Unknown token",
tokens: toUnits(u.amount, u.token_decimals),
usd: u.usd_value, time: u.unlock_time, recipients: u.recipients, url: u.url,
share: u.market_cap_share,
}));
}
const out = [];
for (const item of WATCHLIST) {
const [chainId, address] = item.split(":");
const days = Math.max(1, Math.ceil(HOURS_AHEAD / 24));
const t = await vestream(`/token/${chainId}/${address}/unlocks?days=${days}`);
for (const u of t.unlocks ?? []) {
if (u.unlock_time > until) continue;
out.push({
key: `${chainId}:${address}:${u.unlock_time}`,
symbol: t.token_symbol ?? address.slice(0, 6),
tokens: toUnits(u.amount_unlocking, t.token_decimals),
// Per-token unlocks carry no dollar value; the market list does.
usd: null, time: u.unlock_time, recipients: u.recipients,
url: `https://www.vestream.io/token/${chainId}/${address}`,
});
}
}
return out;
}
function message(u) {
const when = new Date(u.time * 1000).toUTCString().replace(":00 GMT", " UTC");
const value = u.usd != null ? ` (about $${fmt(u.usd)})` : "";
const share = u.share != null ? ` · ${(u.share * 100).toFixed(2)}% of market cap` : "";
const who = u.recipients ? ` · ${u.recipients} recipient${u.recipients === 1 ? "" : "s"}` : "";
return `🔓 ${u.symbol}: ${fmt(u.tokens)} tokens${value} unlock ${when}${who}${share}\n${u.url}`;
}
async function post(text) {
if (process.env.DISCORD_WEBHOOK_URL) {
await fetch(process.env.DISCORD_WEBHOOK_URL, {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content: text }),
});
}
if (process.env.TELEGRAM_TOKEN) {
await fetch(`https://api.telegram.org/bot${process.env.TELEGRAM_TOKEN}/sendMessage`, {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ chat_id: process.env.TELEGRAM_CHAT_ID, text, disable_web_page_preview: true }),
});
}
}
const seen = new Set(JSON.parse(await readFile(SEEN_FILE, "utf8").catch(() => "[]")));
const fresh = (await upcoming()).filter((u) => !seen.has(u.key)).sort((a, b) => a.time - b.time);
for (const u of fresh) {
await post(message(u));
seen.add(u.key);
}
// Keep the file small: forget unlocks more than a week old.
const weekAgo = Date.now() / 1000 - 7 * 86400;
await writeFile(SEEN_FILE, JSON.stringify([...seen].filter((k) => Number(k.split(":").at(-1)) > weekAgo)));
console.log(`Posted ${fresh.length} new unlock(s).`);Two ways to run it
- The whole market: leave
WATCHLISTempty. The bot posts every unlock worth more thanMIN_USD(default $1M) in the nextHOURS_AHEADhours. One API call per run. - Only your tokens: set
WATCHLISTto comma-separatedchainId:addresspairs, for example42161:0x912CE59144191C1204E64559FE8253a0e49E6548,101:YourSolanaMint. One API call per token per run. Solana mints are case-sensitive: paste them exactly.
The seen.json file is what stops repeats: each unlock is posted once, however often the bot runs.
Run it on a schedule
Every four to six hours is plenty: schedules don't change by the minute. On your own machine or a small server, cron works:
# every 6 hours
0 */6 * * * cd /path/to/bot && VESTREAM_API_KEY=... DISCORD_WEBHOOK_URL=... node unlock-bot.mjs >> bot.log 2>&1Keep seen.json on disk between runs. On a host that starts from scratch each time, store it somewhere that persists, or the bot will repost.
Staying inside the free plan
| Setup | Calls a month |
|---|---|
| Market mode, every 6 hours | about 120 |
| Watchlist of 3 tokens, every 6 hours | about 360 |
| Watchlist of 3 tokens, twice a day | about 180 |
The free plan is 250 calls a month and 50 a day. A larger watchlist fits better with POST /batch/tokens (up to 25 tokens in one request, one call per token) or a paid plan from $49 a month.
Going further: webhooks instead of polling
On paid plans, Vestream can push unlocks to you instead. Subscribe once to unlock.upcoming (with a lead time from 1 to 168 hours) or unlock.large (any unlock worth $1M or more), and point the webhook at a small function that forwards to your chat. The payloads are HMAC-signed so you can check they came from us. See the developer docs.
Mistakes that catch people out
- Reading amounts as whole tokens.
amountandamount_unlockingare raw integers. Divide by10^token_decimalsfirst. - Treating a missing dollar value as zero.
usd_valueis null when the token's market is too thin to value the unlock honestly. Show the token amount instead. - Posting a link preview for every unlock. Telegram expands every link;
disable_web_page_previewkeeps a busy morning readable. - Putting the key in the bot's public repository. Keep it in an environment variable or your host's secret store.
Frequently Asked Questions
How do I get alerts for token unlocks?
Run a small bot that calls an unlock API on a schedule and posts new unlocks to your chat, like the one in this guide, or use the Vestream app, which sends push and email alerts for the wallets you track.
Can the bot post to both Telegram and Discord?
Yes. Set both TELEGRAM_TOKEN with TELEGRAM_CHAT_ID and DISCORD_WEBHOOK_URL, and it posts each unlock to both.
How do I alert only on the tokens my community holds?
Set WATCHLIST to chainId:address pairs. The bot then reads each token's own unlock schedule instead of the whole market.
Is the data free?
Yes for this kind of bot: the free plan is 250 calls a month, and market mode every six hours uses about 120.