Building a social listening agent with a wallet
Social listening tools start around a hundred dollars a month and climb fast. What most teams actually need from them is embarrassingly small: know what the competitors' posts are doing, every morning, as numbers in a place we already look. That job does not need a platform. It needs a cron job with a wallet.
This post builds one end to end: a scheduled agent that wakes up daily, buys live stats for a watchlist of posts, computes what changed, and writes a report. Total infrastructure: one script, one wallet. Total data cost for a three post watchlist: 90 cents a month.
The budget math first, because it changes the design
Every lookup on the x402 Social Stats API costs $0.01, paid per request in USDC via the x402 protocol. So a daily monitoring habit prices like this:
- 3 posts, once a day: 3 cents a day, $0.90 a month.
- 10 posts, once a day: $3 a month.
- 25 posts, twice a day: $15 a month, and you have real intraday velocity data.
- 100 posts, daily, plus 20 profile checks weekly: about $31 a month, which is a full competitive intelligence function.
When data costs this little, the right architecture is the dumbest one that works. No database of cached stats to keep warm, no shared infrastructure: just re-ask the API and diff against yesterday's file. The numbers are always live and the code stays small enough to read in one sitting.
The agent, complete
Node, one dependency trio, no framework. The wallet key comes from the environment; funding it is covered in the agent wallet tutorial, and $5 of USDC on Base runs this watchlist for over five months.
// listen.mjs: run daily via cron
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
import { readFileSync, writeFileSync, existsSync } from "node:fs";
const WATCHLIST = [
"https://www.instagram.com/reel/DLmR4kXtQ2a/",
"https://www.tiktok.com/@nflstreetmoments/video/7401882236711",
"https://x.com/AdamSchefter/status/1812340221459871",
];
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const payFetch = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
const prev = existsSync("stats.json")
? JSON.parse(readFileSync("stats.json", "utf8"))
: {};
const today = {};
const lines = [];
for (const url of WATCHLIST) {
const res = await payFetch(
"https://x402.findclout.com/api/v1/post?url=" + encodeURIComponent(url)
);
const s = await res.json();
if (!s.success) { lines.push(`UNREADABLE ${url} (${s.error})`); continue; }
today[url] = { views: s.views, likes: s.likes, at: s.fetchedAt };
const was = prev[url];
const dv = was ? s.views - was.views : 0;
lines.push(
`${s.platform} @${s.username}: ${s.views.toLocaleString()} views` +
(was ? ` (+${dv.toLocaleString()} since yesterday)` : " (first reading)")
);
if (was && dv > was.views * 0.5) {
lines.push(` ALERT: +50% in a day, this post is moving`);
}
}
writeFileSync("stats.json", JSON.stringify(today, null, 2));
console.log(lines.join("\n"));
// pipe stdout to email, Slack, Telegram, wherever you already look
Wire it to a schedule and you are done:
# crontab -e
0 13 * * * cd /opt/listener && node listen.mjs >> report.log 2>&1
The universal /api/v1/post endpoint handles the mixed-platform watchlist by detecting Instagram, TikTok, or X from each URL, one envelope for all three, per the endpoint reference. On TikTok and X the response includes the author's follower count too, free context for judging whether a spike is big relative to the account.
Why the wallet matters more than the script
The script is replaceable; the payment model is the point. This agent has no API key to leak, no subscription that outlives its usefulness, and no signup that required a human. Its wallet is its budget, literally: fund it with $5 and the agent physically cannot spend more than $5, no matter how badly a bug loops. That is a harder spending guarantee than any usage alert, and it is why per-request pricing fits autonomous software so well; the founder-side view of that argument is in why we priced our API at one cent per call.
Billing edge cases are handled for you. A typo in the watchlist returns HTTP 400 and costs nothing. A post that gets deleted returns a paid {"success": false, "error": "not_found"}, which for a listening agent is signal, not noise: competitors deleting posts is worth knowing. Upstream failures return an unpaid 502, so a blind retry an hour later is safe and free.
Upgrades that stay under ten dollars a month
- Ratio screening. Add like-per-view and comment-per-view checks to spot when a competitor's "viral hit" is padded. Thresholds and code are in how advertisers detect inflated influencer numbers.
- Profile tracking. One
/api/v1/instagram/usercall per competitor per day adds follower growth curves for a cent each. - Campaign mode. Point the same loop at your own sponsored posts and you have automated deliverable verification, the full version of which is in how agents verify influencer campaign results.
- LLM summarization. Feed the diff lines to a model and get a two sentence morning briefing instead of a table. The stats calls stay the expensive part at three cents.
We know this pattern works because a version of it runs our business. FindClout operates the biggest independently owned American meme page network, spanning sports, finance, entrepreneurship, movies, TV, and music, and scheduled stat sweeps over our own posts are how advertisers get proof their native placements delivered; the monitoring loop you just built is a one-watchlist version of our reconciliation layer. If your agent's reports ever convince you that you need the views and not just the tracking of them, you know where the clips come from.
Ninety cents a month is a rounding error on a rounding error. The quickstart plus the script above is a working listener before lunch.