LurkAPI

Twitter monitor: an X account’s new posts in Discord or Slack

A 25-line script sends an X account’s new posts to Discord or Slack, no X developer account. Polled every 5 minutes, alerts land 2.5 minutes after the post.

5 min read

Two fishing rods on bite alarms at a still lake at dawn; one alarm glows amber as rings spread where its line meets the water.

You want one X account’s posts where your team already reads: a news wire in the trading channel, a regulator in #compliance, a competitor in #marketing. On your own phone, X does this for free: follow the account, tap the bell on its profile and choose All posts. A shared channel needs something that checks the account and forwards what’s new.

That can be 25 lines of Python. Every 5 minutes it asks LurkAPI, an API that returns public social media pages as JSON, for the account’s latest posts and sends anything new to a Discord or Slack webhook. You don’t need an X developer account, alerts land about 2.5 minutes after the post on average, and one account costs the same $5.10 to $8.02 a month whether it posts twice a day or 300 times.

The script: 25 lines and a webhook

x_monitor.py · Python 3 + requests
# x_monitor.py: post to a Discord or Slack channel when an X account posts.
# pip install requests; then LURK_KEY=... WEBHOOK_URL=... python x_monitor.py
import os, time, requests

HANDLES = ["business", "WatcherGuru"]
KEY, WEBHOOK = os.environ["LURK_KEY"], os.environ["WEBHOOK_URL"]
FIELD = "content" if "discord.com" in WEBHOOK else "text"  # Discord vs Slack
EVERY = 300  # seconds: the endpoint is fresh within 5 minutes

newest = {}  # handle -> id of the newest post seen
while True:
    for h in HANDLES:
        try:
            r = requests.get("https://api.lurkapi.com/v1/twitter/user-tweets", params={"handle": h},
                             headers={"x-api-key": KEY}, timeout=30).json()
            if not r["success"] or r["ordering"] == "ranked":  # ranked: X shows no timeline for this account
                print(h, r.get("code") or "ranked"); continue
            fresh = sorted((t for t in r["tweets"] if int(t["id"]) > newest.get(h, 1 << 63)), key=lambda t: int(t["id"]))
            for t in fresh:
                verb = "reposted" if t["retweeted_tweet"] else "posted"
                requests.post(WEBHOOK, json={FIELD: f"@{h} {verb}: {t['text'][:300]}\n{t['url']}"}, timeout=10)
            newest[h] = max([newest.get(h, 0)] + [int(t["id"]) for t in r["tweets"]])
        except Exception as e:
            print(h, e)
    time.sleep(EVERY)

Setup takes a few minutes:

  1. Make a webhook. In Discord: Server Settings, Integrations, Create Webhook, pick the channel, Copy Webhook URL (Discord’s guide). In Slack: create an app, turn on Incoming Webhooks, then Add New Webhook to Workspace (Slack’s guide).
  2. Get a LurkAPI key. New accounts start with 100 credits.
  3. Put your accounts in HANDLES, set LURK_KEY and WEBHOOK_URL, and run python x_monitor.py.

It only makes outgoing requests, so it runs on anything that stays on, a small VPS or a Raspberry Pi, with no port to open. The first poll just notes each account’s newest post, so starting it doesn’t dump 20 old posts into the channel. After that, each new post goes out oldest first with its link, and reposts say so.

User tweetsAn account's tweets and retweets, about 20 per page, with text, media and engagement counts.GET/v1/twitter/user-tweets1 credit per callRead the docs

An alert waits for your next poll

The script only sees a post when it polls. A post that goes up just after one waits almost a full interval; a post that goes up just before one is in your channel seconds later. On average you wait about half your interval.

A post just after a poll waits almost 5 minutes; one just before it waits seconds.

Don’t poll faster than every 5 minutes. The endpoint serves each account’s page for up to 5 minutes before fetching it again, so a poll every minute gets the same page four times in five.

Pick the interval by how soon you need to know

A shorter interval means faster alerts and more calls, at 1 credit a poll. Here’s the trade on Bloomberg’s @business, which posts every 5 minutes around the clock.

One hour of @business, polled three ways. Hourly costs 1 credit, but the oldest post waited an hour.
Poll everyA month
5 min8,640 credits
$5.10 to $8.02
15 min2,880 credits
$1.70 to $2.67
1 hour720 credits
$0.42 to $0.67
Per account. Dollar ranges run from the largest credit pack to the smallest.

Each poll sees the account’s latest 20 or so posts, so pick an interval in which the account posts fewer than that. Even @business, at about 12 posts an hour, fits in one poll an hour.

X’s own API bills the other way, per post. Its Activity API pushes each new post to your webhook for $0.005, replies and reposts included (X’s pricing as of October 2026). Before the first one arrives you need a developer account, an app, prepaid credits and a public HTTPS endpoint that answers X’s security check every hour. At about 290 posts a day, @business would cost about $43 a month on X; polling it every 5 minutes costs $5.10 to $8.02.

Check the account first: some big ones have no timeline

For some large accounts, X doesn’t show logged-out visitors a timeline at all. It shows about 100 popular posts from all years instead, in no particular order, so the newest post isn’t reliably on top. @elonmusk, @Reuters and @nytimes are like this, and so are headline accounts like @DeItaone and @FirstSquawk. Size doesn’t predict it: @NASA, with 92 million followers, has a normal timeline, and @FirstSquawk has under 600,000.

Three polls of each feed. @NASA’s four new posts land on top; @elonmusk’s feed shows the same popular posts from 2026, 2022 and 2024 every time.

Every response says which one you got: ordering is chronological or ranked. The script skips a ranked account and prints its name rather than send old posts to your channel. Protected accounts return 404, and the feed leaves out an account’s replies to other people, apart from its own threads.

To check an account before you add it, put its handle in the free Twitter viewer. It shows the posts your monitor would see and tells you when X sends the ranked set.

The free Twitter viewer showing 100 tweets from @elonmusk, with the note that X shows logged-out visitors about 100 popular tweets instead of the latest ones.
@elonmusk in the free Twitter viewer.

Questions

How do I get notified when someone tweets?

On your phone, follow the account in the X app, tap the bell on its profile and choose All posts; X pushes each new post to you for free. For a team channel, run a script that checks the account every few minutes and posts anything new to a Discord or Slack webhook, like the one in this post.

How do I send tweets to Discord?

Make a webhook in Discord (Server Settings, Integrations, Create Webhook, Copy Webhook URL), then run a script that checks the account every 5 minutes and posts each new tweet to that URL. The Python script in this post does it in 25 lines.

Can you monitor a Twitter account without the API?

Yes. Poll the posts X shows logged-out visitors and compare post ids; polled every 5 minutes, alerts arrive about 2.5 minutes after the post on average. Protected accounts can’t be watched this way, and a few very large accounts show logged-out visitors only a ranked set of popular posts.

How much does the X API cost?

X’s API is pay-per-use with no subscription: $0.005 per post read, and $0.005 per post its Activity API delivers to your webhook (as of October 2026). Watching Bloomberg’s @business, which posts about 290 times a day, comes to about $43 a month.

Why can’t I see Elon Musk’s latest tweets without logging in?

For some very large accounts, @elonmusk among them, X shows logged-out visitors about 100 popular posts from all years instead of the latest ones. To see his newest posts you have to log in.

Keep reading