Skip to main content
5-step tutorial

How to Build a Brand Monitoring Tool

A practical 5-step guide to shipping a working brand monitoring tool across Twitter/X, Instagram, TikTok, and Reddit — using the XPOZ SDK or MCP server.

What you'll build

By the end of this guide you'll have a script that sweeps mentions of your brand across four platforms, dedupes them, scores basic sentiment, and prints a daily summary. You can wrap it in a cron job, an n8n workflow, or a Claude Code slash command.

Prerequisites

  • A free XPOZ account and API token — grab one at /get-token.
  • Node.js 18+ OR Python 3.9+.
  • Optional: a Slack or email webhook for alerts.

5 steps to a working tool

Copy each block, wire them together, and you have a minimum viable brand monitor.

1

Step 1: Install the SDK

Install the XPOZ SDK for your language of choice. The TypeScript SDK ships on npm; the Python SDK ships on PyPI. Both expose the same typed interface over Twitter/X, Instagram, TikTok, and Reddit.

npm install @xpoz/xpoz
# or
pip install xpoz
2

Step 2: Sweep mentions across platforms

Run parallel searches against every platform you care about. The SDK returns typed, paginated results so the same query shape works across Twitter/X, Reddit, Instagram, and TikTok. Export your XPOZ_API_KEY before running.

import { XpozClient } from "@xpoz/xpoz";

const client = new XpozClient({ apiKey: process.env.XPOZ_API_KEY });
await client.connect();

const brand = "YourBrand";
const [twitter, reddit, instagram] = await Promise.all([
  client.twitter.searchPosts(brand, { limit: 100 }),
  client.reddit.searchPosts(brand, { limit: 100 }),
  client.instagram.searchPosts(brand, { limit: 100 }),
]);

const all = [...twitter.data, ...reddit.data, ...instagram.data];
console.log(`Found ${all.length} mentions across platforms`);
3

Step 3: Dedupe and normalize

The same mention can surface more than once — reposts, quote tweets, crossposts. Keying by post id collapses duplicates before you score or alert on them.

const byId = new Map();
for (const mention of all) {
  if (!byId.has(mention.id)) byId.set(mention.id, mention);
}
const unique = Array.from(byId.values());
4

Step 4: Score basic sentiment

Start simple. A keyword heuristic is enough to triage the first batch; swap it for a proper sentiment library or an LLM call when you need nuance. The shape of the output stays the same.

const scored = unique.map((m) => ({
  ...m,
  sentiment: quickSentiment(m.text),
}));

function quickSentiment(text) {
  const negatives = ["bad", "broken", "terrible", "hate", "worst", "broken"];
  const lower = text.toLowerCase();
  return negatives.some((w) => lower.includes(w)) ? "negative" : "neutral-or-positive";
}
5

Step 5: Alert on what matters

Pipe the scored mentions into whatever notification channel your team already uses — Slack, email, PagerDuty, or a daily digest cron. Keep alert volume sane by filtering to the sentiment class you care about.

const alerts = scored.filter((m) => m.sentiment === "negative");
if (alerts.length > 0) {
  await sendSlackAlert(`${alerts.length} negative mentions today`, alerts);
}

async function sendSlackAlert(message, items) {
  await fetch(process.env.SLACK_WEBHOOK_URL, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ text: `${message}\n${items.slice(0, 5).map((i) => `- ${i.text}`).join("\n")}` }),
  });
}

Frequently asked questions

100,000 results/month is enough to monitor a few brands with daily sweeps. Scale up with Pro or Max at /pricing.

Ship your brand monitoring tool today.

Free tier includes 100,000 results per month. Scale to Pro at $20/month or Max at $200/month when you are ready.