How do I get an event when an X account follows or unfollows someone?

Get an API key See pricing

Subscribe to a follow-event stream for the accounts you care about. Xanguard's B2B API sends twitter.following.new over WebSocket the moment a tracked X account follows someone, and twitter.following.removed once an unfollow is confirmed, each with the other account's handle, bio and counts. It needs no X developer account and is on Enterprise plans from $249 a month for 50 accounts.

The event

{
  "op": 0,
  "d": {
    "event": "twitter.following.new",
    "event_id": "evt_f_trackedkol_1763640000000",
    "event_time": 1763640000000,
    "task_info": {"handle": "trackedkol", "id": "1234567890"},
    "data": {
      "id": "9876543210",
      "handle": "newproject",
      "name": "New Project",
      "bio": "Building onchain. Launching soon.",
      "followers": 4200,
      "following": 312,
      "protected": false
    }
  }
}

task_info is the account you track; data is the account it followed. twitter.following.removed has the same shape; when the unfollowed profile is no longer available, data.handle is empty and data.name is null. Field reference: B2B WebSocket docs.

Timing

Options compared (checked 20 November 2026)

X Activity APIX following-list pollingXanguard B2B stream
HowSubscribe to follow.follow / follow.unfollow by user_id; persistent HTTP stream or webhookRe-read GET /2/users/:id/following and diffAdd handles; events on one WebSocket
Price$0.010 per follow or unfollow event$0.010 per account returnedFlat: $249/mo for 50 accounts
Limits1,500 subscriptions self-serve, 75,000 Enterprise300 requests per 15 min per app50 to 1,000 accounts per plan
Account authorizationNot stated for follow events (post, delete and profile events are public)Not needed for public accountsNot needed for public accounts
Event contentPer X's event schemaWhatever you storeFollowed account's id, handle, name, bio, counts, protected flag
Also on the same connectionPosts, deletes, profile updates, Spaces (billed per event)NothingTweets, deleted tweets, profile changes, new followers
SetupDeveloper app, credits, cardDeveloper app, code, schedulerKey from a Telegram bot, paid in SOL

X sources: Activity API introduction, pricing, rate limits, read 20 November 2026. For a short list of accounts, X's Activity API is a sound choice. Xanguard fits when you want a flat price, enriched follow events and the rest of the account's activity on one socket.

Minimal client (Node.js 22+)

const ws = new WebSocket('wss://api.xanguard.tech/v1/dt/realtime/ws');
let hb;
ws.onmessage = (e) => {
  const m = JSON.parse(e.data);
  if (m.op === 10) {
    ws.send(JSON.stringify({ op: 2, d: { api_key: 'dt_YOUR_API_KEY', types: ['follow', 'unfollow'] } }));
    hb = setInterval(() => ws.send(JSON.stringify({ op: 1 })), m.d.heartbeat_interval);
  } else if (m.op === 0 && m.d.event.startsWith('twitter.following.')) {
    const verb = m.d.event.endsWith('.new') ? 'followed' : 'unfollowed';
    console.log(`@${m.d.task_info.handle} ${verb} @${m.d.data.handle}`);
  }
};
ws.onclose = () => clearInterval(hb);   // reconnect with backoff in production

The types login filter keeps only follow and unfollow events; leave it out to receive everything your plan includes. Python version and full reconnect logic: follow and unfollow detection API guide.

Prefer Telegram alerts?

The same signal is available without code in Follow Watch: instant Telegram alerts with the followed account's bio, from $15 a month for 15 accounts.

Pricing

AccountsStarter (tweets + deleted tweets)Pro (+ profile changes, new followers)Enterprise (+ follows and unfollows, image OCR)
50$49/mo$99/mo$249/mo
250$229/mo$429/mo$979/mo
500$449/mo$749/mo$1,649/mo
1,000$849/mo$1,349/mo$2,849/mo

Follow and unfollow events are on Enterprise. Keys from @B2B_Xanguard_bot, paid in SOL, activated automatically. Prices from the live plan list on 20 November 2026. Related: filtered stream alternative · WebSocket API · X API cost 2026.

Frequently Asked Questions

Is there an API that tells me when an X account follows someone?

Yes. Xanguard's B2B API sends twitter.following.new over WebSocket the moment a tracked account follows someone, and twitter.following.removed when it unfollows, on Enterprise plans from $249 a month for 50 accounts. X's own Activity API lists follow.follow and follow.unfollow events at $0.010 each, with a developer app and up to 1,500 subscriptions self-serve.

How fast are Xanguard follow events?

Follows are instant: they arrive within seconds of X showing the follow. On very large accounts X itself can take up to a minute to register a follow. Unfollows are checked against X before they are sent, so they arrive a few seconds later than follows.

Does X's Activity API work for accounts that have not authorized my app?

X's documentation (checked 20 November 2026) lists post creation, post deletion and profile updates as public events, available without the account's authorization. It documents follow events with a user_id filter but does not class them as public or private, so test on an account you do not own first.

What happens to follow events if my WebSocket disconnects?

On every successful login Xanguard replays the last 15 minutes of follow and unfollow events for your accounts, in order, right after READY. Dedupe follows on the tracked handle plus data.id within 15 minutes; replayed unfollows reuse the live event_id.

Can I get new followers of an account, not just who it follows?

Yes, as a different event: twitter.follower.new reports a new follower of a tracked account. It is included on Pro and Enterprise plans.

Do I need an X developer account?

No. Keys come from @B2B_Xanguard_bot, you add accounts by REST or in the bot, and you connect to one WebSocket. Payment is in SOL and the plan activates automatically.

Stream follow events for 50 accounts

Enterprise streams follows, unfollows, tweets, deleted tweets, profile changes and new followers for 50 accounts at $249 a month.