Social Listening via X (Twitter) API — Build vs Buy
- SaaS social listening: Brand24 / Mention / Awario / Sprinklr = $200-500/mo per brand
- Build on twitterapi.io: ~$1-40/mo of X data for 1-5 brands at typical volumes (5 brands × 50K mentions/mo ≈ $37.50)
- 3 API endpoints cover 90% of social listening loop (search + user info + followers)
- Cost ratio: 33× cheaper per tweet than X official pay-per-use ($0.005 per post read)
Social listening SaaS platforms — Brand24, Mention, Awario, Sprinklr, Meltwater — solve a real problem: continuously monitor brand + competitor + keyword mentions across social channels, alert on anomalies, aggregate sentiment. Their price ($200-500 per brand per month, or $2K+ for enterprise) reflects the operational overhead of running that monitoring stack. The cheaper path priced in this guide is building on TwitterAPI.io, a pay-per-use X (Twitter) API.
For teams with in-house dev capacity and monitoring focused on X (Twitter) specifically, building the same core loop directly against the X API costs roughly 7× to over 250× less in data spend, depending on volume (see the cost table). Not because the SaaS platforms overcharge — they don't, given what they provide — but because you're skipping the multi-platform coverage, the pre-built dashboards, and the sentiment classifier they bundle in. If your workflow only needs X monitoring + custom alerts + integration into your existing stack, the build path is dramatically cheaper.
This page covers the build-vs-buy decision honestly: when SaaS wins, when API-build wins, and the exact API pattern + cost math if you go the build route.
5-brand mid-volume monitoring (5 brands × 50K mentions/mo = 250K tweets): ~$37.50/mo API-build data cost vs $500-1,000/mo SaaS = 13-27× delta per twitterapi.io/pricing + published Brand24/Mention/Awario tiers
Build vs buy — the honest tradeoff table
SaaS social listening bundles four things: (1) multi-platform monitoring, (2) pre-built dashboards + alerts, (3) sentiment / topic classification, (4) team collaboration features. If your workflow needs all four, buy is right — you're not saving money by rebuilding what a $500/mo tool ships out-of-box.
But if you need X-only + custom alert logic + integration into your existing analytics stack (Metabase / Grafana / Notion / Airtable / whatever), building on the X API skips 3 of the 4 SaaS layers and cuts data cost by roughly 7× to over 250×, depending on volume.
The 3-endpoint build pattern
The core social listening loop is: detect a mention → identify the author → measure reach → alert if criteria met. Three API calls cover it:
1. Detect — /twitter/tweet/advanced_search with query <brand> lang:en -filter:retweets min_faves:5 since_time:<unix seconds of last poll>. Runs every 5-15 min (poll cadence); one request returns up to 20 tweets, so follow next_cursor when a page comes back full. Returns matching tweets with tweet ID, text, timestamp, engagement counts.
2. Enrich — /twitter/user/info?userName=<author> for each unique author in the batch. Returns followers, isBlueVerified, description. Enables filtering by author quality (e.g. skip low-follower spam).
3. Reach — sum of followers across all matching authors = brand reach for that poll cycle. Or use engagement (likeCount + retweetCount) as engagement proxy.
Alert — if any (a) volume-per-hour spikes 3× baseline, (b) any single tweet accumulates >100 engagement in first 15min (viral signal), (c) any tweet from a specific author (competitor CEO, journalist watchlist) — fire your alert (Slack / email / PagerDuty).
Runnable — brand monitoring loop
One end-to-end script implementing the 3-endpoint pattern:
import os, requests, time, json
from pathlib import Path
from collections import defaultdict
from datetime import datetime, timezone, timedelta
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
BASE = "https://api.twitterapi.io"
BRAND = "stripe"
COMPETITORS = ["paypal", "square", "adyen"]
EXCLUDES = " ".join(f"-{c}" for c in COMPETITORS)
STATE_FILE = Path(f".state/{BRAND}_seen.json")
STATE_FILE.parent.mkdir(exist_ok=True)
def load_seen() -> set:
return set(json.loads(STATE_FILE.read_text())) if STATE_FILE.exists() else set()
def save_seen(s: set):
STATE_FILE.write_text(json.dumps(sorted(s)[-500:]))
def poll_once():
# since_time takes Unix seconds; a date-only since: would re-bill the same first page every poll
since_ts = int((datetime.now(timezone.utc) - timedelta(minutes=10)).timestamp())
query = f"{BRAND} {EXCLUDES} lang:en -filter:retweets min_faves:5 since_time:{since_ts}"
r = requests.get(f"{BASE}/twitter/tweet/advanced_search", headers=HEADERS, params={"query": query}, timeout=15)
r.raise_for_status()
tweets = r.json().get("tweets", [])
seen = load_seen()
new_tweets = [t for t in tweets if t["id"] not in seen]
if new_tweets:
# Reach proxy: sum followers of all new-mention authors
reach = sum((t.get("author", {}).get("followers") or 0) for t in new_tweets)
engagement = sum(t.get("likeCount", 0) + t.get("retweetCount", 0) for t in new_tweets)
print(f" {len(new_tweets)} new · reach {reach:,} · engagement {engagement:,}")
# Alert criteria: high-reach single mention OR volume spike
for t in new_tweets:
author = t.get("author", {})
if (author.get("followers") or 0) > 50_000:
print(f" \U0001F6A8 HIGH-REACH MENTION: @{author.get('userName')} ({author.get('followers'):,} followers): {t.get('text', '')[:120]}")
if t.get("likeCount", 0) + t.get("retweetCount", 0) > 100:
print(f" \U0001F525 VIRAL: {t.get('likeCount')}\u2764 + {t.get('retweetCount')}\U0001F501: {t.get('text', '')[:120]}")
seen.update(t["id"] for t in new_tweets)
save_seen(seen)
while True:
try:
poll_once()
except Exception as e:
print(f" ERROR: {e}")
time.sleep(600) # 10-min poll · adjust per your alert latency needs
# Cost per twitterapi.io/pricing ($0.00015 per tweet, $0.00015 minimum per request):
# 1 unpaginated request per poll returns at most 20 tweets; 144 polls/day = 4,320 requests/month
# floor (no new tweets): 4,320 x $0.00015 = ~$0.65/month per brand
# ceiling (every page full): 4,320 x 20 x $0.00015 = ~$12.96/month per brand
# If pages come back full, paginate with next_cursor (more tweets, billed the same per tweet)Cost math at 4 monitoring volumes
Two observations: (a) at any volume the API-build wins on data cost; (b) SaaS pricing doesn't scale linearly with volume — they charge per-brand seat, so your delta stays large even at small volumes.
But: the SaaS bundles the dashboard + sentiment + alerts. Build-cost analysis must include eng time to build those layers. Rough parity: build wins if you already have 1 engineer + BI stack + volume >30K mentions/mo.
When to buy the SaaS (honest)
Multi-platform mandatory: You need LinkedIn + Instagram + Reddit + TikTok + X in one dashboard. Building all of that yourself against 5 different APIs is 5-10× the engineering time — the SaaS pricing looks cheap in comparison.
No engineering capacity: 5-person marketing team, no dev support, need it working today. Signup + import brand list in 1 hour vs 1 week to build MVP.
Regulated / compliance-sensitive: Some SaaS have SOC2 / GDPR / retention guarantees you'd otherwise implement in-house.
Turnkey sentiment / topic classification: The SaaS has trained sentiment classifiers per language + industry. Building your own is a project — either use an LLM such as gpt-4o-mini (a fraction of a cent per classified tweet) or accept lower quality VADER-style rule-based. If that suite is Brandwatch, note that its Consumer Research API strips the text of X mentions; our Brandwatch API explainer shows what each Brandwatch API returns and how to rebuild X posts from their IDs.
Cross-team collaboration UI: Marketers assigning mentions to different responders, tracking response SLA, generating shareable reports for exec review. SaaS ships this; you'd rebuild in Notion or similar.
If the suite you are weighing is Brandwatch specifically, Brandwatch alternative for X-only listening measures what five brand terms actually return on X and prices a day and a month of it.
When to build on twitterapi.io (honest)
X-only workflow: You only care about X (Twitter). Skip the multi-platform tax you'd pay to SaaS.
Existing analytics stack: Data goes into your Metabase / Grafana / Looker / Notion / Airtable already. Adding X mentions as another data source in the same stack is 1 dev-day.
Custom alert logic: 'Alert only if a @<competitor_ceo> mentions our brand negatively' — that's your rule, not a rule any SaaS ships. Building on the API lets you write arbitrary alert logic.
Cost sensitivity at scale: SaaS pricing tends to hard-cap at their enterprise tier and forces per-brand-seat expansion. Direct-API cost scales cleanly with actual tweet volume.
Data ownership: Every tweet lives in your database from the moment it's polled. No 'export CSV' friction, no SaaS-vendor-lock-in.
Sibling tools + comparison
Brand24 — mid-market SaaS, $99-499/mo, decent X coverage + sentiment. Best for teams that want an easy start.
Mention — similar to Brand24, slightly stronger on real-time alerting.
Awario — cheaper alternative, $29-249/mo, thinner on features but usable.
Sprinklr — enterprise-only since its self-serve plans were discontinued, sold by custom quote for large teams with formal social-response workflows; see Sprinklr pricing and the end of self-serve.
Meltwater — enterprise media monitoring including press/news alongside social. $5K+/mo.
twitterapi.io + your build — under $1 to ~$750/mo of X data depending on volume (see the cost table). No SaaS bundling; pure data + code you own. See /pricing for per-result rates.
None of these are strictly better — they solve different points on the price/capability curve. Choose based on team + workflow + budget, not vendor prestige.
If you are weighing a credit-quota subscription such as Data365 against pay-per-data, see our Data365 alternative with a measured month of monitoring.
# Full workflow: 5-brand watchlist + Slack alerts + Notion database sink.
import os, requests, time, json
from datetime import datetime, timezone, timedelta
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
BASE = "https://api.twitterapi.io"
SLACK_WEBHOOK = os.environ["SLACK_WEBHOOK_URL"]
WATCHLIST = ["stripe", "paypal", "square", "adyen", "checkout"]
STATE_DIR = Path(".state"); STATE_DIR.mkdir(exist_ok=True)
def seen_file(brand): return STATE_DIR / f"{brand}_seen.json"
def load_seen(brand):
f = seen_file(brand)
return set(json.loads(f.read_text())) if f.exists() else set()
def save_seen(brand, s):
seen_file(brand).write_text(json.dumps(sorted(s)[-500:]))
def slack_alert(brand: str, tweet: dict, kind: str):
a = tweet.get("author", {})
txt = (tweet.get("text") or "").replace("\n", " ")[:200]
url = f"https://twitter.com/{a.get('userName')}/status/{tweet.get('id')}"
requests.post(SLACK_WEBHOOK, json={
"text": f"{kind} on **{brand}**: @{a.get('userName')} ({a.get('followers'):,} followers)\n{txt}\n{url}"
})
def poll_brand(brand: str) -> int:
# since_time takes Unix seconds, so each poll only bills tweets from the last cycle
since_ts = int((datetime.now(timezone.utc) - timedelta(minutes=15)).timestamp())
query = f"{brand} lang:en -filter:retweets min_faves:5 since_time:{since_ts}"
r = requests.get(f"{BASE}/twitter/tweet/advanced_search", headers=HEADERS, params={"query": query}, timeout=15)
r.raise_for_status()
tweets = r.json().get("tweets", [])
seen = load_seen(brand)
new_tweets = [t for t in tweets if t["id"] not in seen]
for t in new_tweets:
a = t.get("author", {})
if (a.get("followers") or 0) > 50_000:
slack_alert(brand, t, "\U0001F6A8 HIGH-REACH MENTION")
if t.get("likeCount", 0) + t.get("retweetCount", 0) > 100:
slack_alert(brand, t, "\U0001F525 VIRAL MENTION")
seen.update(t["id"] for t in new_tweets)
save_seen(brand, seen)
return len(new_tweets)
while True:
# 5 parallel requests needs a paid account (20 requests/s); before the first payment the limit is 1 request every 5 s
with ThreadPoolExecutor(max_workers=5) as ex:
counts = list(ex.map(poll_brand, WATCHLIST))
print(f" {sum(counts)} new mentions across {len(WATCHLIST)} brands")
time.sleep(900) # 15-min poll cycle
# Cost estimate per twitterapi.io/pricing ($0.00015 per tweet, $0.00015 minimum per request):
# 5 brands x 96 polls/day = 480 requests/day = 14,400 requests/month, at most 20 tweets each
# floor: 14,400 x $0.00015 = $2.16/month; ceiling: 14,400 x 20 x $0.00015 = $43.20/month
# cost-table scenario: 5 brands x 50K mentions/month = 250K tweets (~17 per poll) = ~$37.50/month
# vs Brand24 / Mention for 5 brands = $500-1,000/month (roughly 13-27x more)Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.
Questions readers ask
Which SaaS should I compare against as baseline?
For SMB: Brand24 ($99-499/mo) or Mention ($41-499/mo). For enterprise: Sprinklr ($1K+/mo) or Meltwater ($5K+/mo). All have decent X coverage; differences are in cross-platform depth + sentiment classifier + dashboard UX.
Can I build sentiment analysis on top of the API?
Yes — pipe the returned tweet text through your sentiment classifier of choice. Options: OpenAI (text-embedding-3-small for topic + gpt-4o-mini for sentiment, a fraction of a cent per classified tweet), VADER (free but rule-based, English only), or Hugging Face open-source models (self-host).
How do I avoid missing tweets between polls?
Use the since_time: operator (Unix seconds of your last poll) or since_id: (the newest tweet ID you've stored), and track already-seen tweet IDs (as the script does). If a poll returns a full page of 20, follow next_cursor until you reach tweets you've seen. Poll cadence of 10-15 minutes is standard for brand monitoring — tighter poll for crisis-response workflows. For sub-minute latency, use streaming API instead of polling.
Do I need an X Enterprise contract for historical data?
No — twitterapi.io exposes historical archive via /twitter/tweet/advanced_search with since:YYYY-MM-DD until:YYYY-MM-DD operators (or any window). Retroactive brand-mention research is 1 API call, no Enterprise contract needed. (X's own full-archive search is also open to pay-per-use at $0.005 per post read, up to 3 million Post reads per monthly billing cycle.)
What about GDPR / data-retention for stored mentions?
You control storage. Public tweet data is generally cleared for aggregation + research per X's Terms. For EU-user compliance, add a per-tweet TTL in your DB (typical: 90 days) or hash tweet IDs after aggregate metrics computed. If your workflow includes DM contents, that's a different compliance layer — public-tweet monitoring doesn't hit that.
How does this compare to X's official /2/tweets/search/all?
Same underlying data. X official /2/tweets/search/all (Full-Archive) is billed per post read under pay-per-use ($0.005 per post per docs.x.com/x-api/getting-started/pricing), and pay-per-use is capped at 3 million Post reads per monthly billing cycle; above that you need Enterprise, which has no public price. twitterapi.io's advanced_search covers the same historical archive at $0.00015/tweet with no tier gating.
Which is best for 'crisis response' (sub-5min alert latency)?
For sub-5min crisis alerting, use twitterapi.io streaming API (real-time push) instead of polling. See /blog/twitter-streaming-api-real-time-guide. SaaS platforms typically batch every 15-30 min, so build wins on latency for the crisis-response use case specifically.
Continue
- twitterapi.io — pricing
- X API — pricing (docs.x.com, 2026 verified)
- X — Search Posts introduction (full-archive access levels)
- Brand24 pricing (competitor benchmark) (brand24.com/pricing)
- Mention pricing (competitor benchmark) (mention.com/en/pricing)
- Twitter (X) API — cluster hub
- Twitter (X) API cost breakdown
- Twitter (X) advanced search API guide
- Twitter (X) monitoring — broader architecture patterns
- Twitter (X) keyword alerts — developer guide
- twitterapi.io pricing
- Data365 alternative: measured month of X monitoring
- Brandwatch alternative for X-only listening
- Brandwatch API explainer
- Sprinklr pricing and the end of self-serve
- 01How to Clear Bookmarks on X (Twitter): One Post, All of Them, or a Folder
- 02Twitter (X) Video Length Limit in 2026: How Long a Video Can Be, by Account
- 03Twitter (X) API on AWS Lambda: an EventBridge poller with SQS fan-out
- 04Twitter (X) API Examples: 11 Requests With Real Responses, Sizes and Latency
- 05How to Clear Twitter (X) Cache on iPhone, Android and Desktop
- 06Sprout Social Alternatives: What to Use Instead, by Job, With a Twitter (X) Data Study
- 07IFTTT Alternatives in 2026: Which Can Still Trigger on a New Twitter (X) Post
- 08Social Media API Explained: Four Kinds, and What the Twitter (X) Data Costs
Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.
Stop reading. Start building.
Starter credits cover real testing on real data. Google sign-in, no card, no application queue.
Get an API keyAlready building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.