WEIR

Reddit and X Data in n8n Workflows

Use Reddit and X data in n8n workflows: HTTP Request calls to Weir's API, signed monitor webhooks verified in a Code node, and the MCP Client Tool.

By Tarun Khatri · · 7 min read

There are three ways to get Reddit and X data into n8n workflows with Weir. An HTTP Request node can call the REST API with a bearer key. A Webhook node can receive Weir's signed monitor deliveries whenever there's something new. And an MCP Client Tool node can give an n8n AI Agent the same tools Claude and ChatGPT use. This guide shows the exact request bodies, a Code node that verifies webhook signatures, and one complete workflow from new mentions to a filter to Slack.

Weir is our product. It reads public data only and isn't affiliated with Reddit or X.

Which path to use

You want Use
A scheduled report (weekly digest, a search on demand) HTTP Request node calling the REST API
Only new mentions, pushed to you A Weir monitor plus the Webhook node
An agent that decides what to look up MCP Client Tool attached to an AI Agent

Path 1: HTTP Request node with a bearer key

Create a key under API keys. Keys start with weir_live_ and are shown only once. In n8n, add an HTTP Request node:

  • Method: POST
  • URL: https://api.weirapp.io/v1/x/search or https://api.weirapp.io/v1/reddit/search
  • Authentication: Generic Credential Type, then Bearer Auth, with a credential that holds the key. n8n's credential docs describe this as a header named Authorization with the value Bearer <token>.
  • Send Body: on. Body Content Type: JSON. Specify Body: Using JSON.

Body for X search (POST /v1/x/search). Every field comes from Weir's OpenAPI schema:

{
  "query": "acme",
  "excludeWords": ["hiring"],
  "language": "en",
  "onlyOriginal": true,
  "minLikes": 2,
  "since": "2026-10-12T00:00:00Z",
  "sort": "latest",
  "limit": 25
}

Body for Reddit search (POST /v1/reddit/search). Only query is required:

{
  "query": "\"acme\" pricing",
  "subreddits": ["saas", "startups"],
  "sort": "new",
  "time": "week",
  "limit": 25
}

Both return { "data": [...], "meta": { "requestId": "...", "nextCursor": "..." } }. Add a Split Out node on data to get one item per post. The two platforms use their own field names. An X post has text, url, likeCount and an author object (author.username). A Reddit post has title, selftext, permalink, score and author as a string. Keep them in separate branches rather than sharing one expression.

To page, send meta.nextCursor back as cursor in an otherwise identical body. n8n's Pagination option can read it from $response. Each page is billed, though, so set a maximum. For X, sinceId (the newest post id you've already seen) is a cheap way to fetch only newer posts.

To see what a call cost, turn on Include Response Headers and Status and read x-credits-charged. The X body above costs at most 1 + 25 = 26 credits, and the Reddit body at most 1 + 3 x 25 = 76.

Path 2: monitor webhooks into the Webhook node

A scheduled search re-reads everything each time. A Weir monitor remembers what it has already reported, deduplicating by content rather than by post id, and sends only new items to a webhook.

1. Create the n8n endpoint

Add a Webhook node: HTTP Method POST, a path such as weir, Respond set to Immediately, and under Add Option, turn on Raw Body. You need Raw Body because the signature covers the exact bytes Weir sent, and with it on n8n puts those bytes in the binary property data. n8n registers the production URL when you publish the workflow (Webhook node docs).

Responding immediately also matters. Weir expects a 2xx within 10 seconds, retries failures over about nine hours, and disables an endpoint after 20 failures in a row.

2. Register it with Weir

In the dashboard under Webhooks, or with POST /v1/webhooks, create a webhook that points at the production URL and subscribes to monitor.result.created. The response includes a secret beginning whsec_, and it's shown once. Then create a monitor and choose that webhook:

{
  "name": "Acme mentions",
  "target": { "kind": "search", "query": "acme", "sources": ["reddit", "x"] },
  "schedule": "daily",
  "webhookId": "<webhook id>"
}

The free tier allows one monitor and one webhook, and daily or weekly schedules. hourly needs a paid tier. POST /v1/webhooks/{id}/test sends a real signed webhook.test delivery for free.

3. Verify the signature in a Code node

Weir signs HMAC-SHA256(secret, "{timestamp}.{eventId}.{rawBody}"), hex-encoded, and sends it as weir-signature together with weir-timestamp and weir-event-id. Add a Code node (JavaScript, Run Once for All Items):

const crypto = require("crypto");

// n8n 2.x blocks $env in the Code node by default, so paste the secret
// (or enable env access on a self-hosted instance and read it from there).
const SECRET = "whsec_...";

const { headers } = $input.first().json;
const signature = headers["weir-signature"] ?? "";
const timestamp = headers["weir-timestamp"] ?? "";
const eventId = headers["weir-event-id"] ?? "";
const raw = await this.helpers.getBinaryDataBuffer(0, "data");

const ts = Number(timestamp);
if (!Number.isFinite(ts) || Math.abs(Date.now() / 1000 - ts) > 300) {
  throw new Error("Missing or stale weir-timestamp");
}

const expected = crypto
  .createHmac("sha256", SECRET)
  .update(`${timestamp}.${eventId}.`)
  .update(raw)
  .digest("hex");
const a = Buffer.from(signature);
const b = Buffer.from(expected);
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
  throw new Error("Invalid Weir signature");
}

const event = JSON.parse(raw.toString("utf8"));
if (event.type !== "monitor.result.created") return [];

return event.data.results.map((r) => {
  const isX = r.author !== null && typeof r.author === "object";
  return {
    json: {
      eventId: event.id,
      platform: isX ? "x" : "reddit",
      author: isX ? r.author.username : r.author,
      text: isX ? r.text : (r.title ?? r.body ?? ""),
      url: isX ? r.url : `https://www.reddit.com${r.permalink}`,
      engagement: isX ? (r.likeCount ?? 0) : (r.score ?? 0),
    },
  };
});

Since n8n 2.0, $env is blocked in the Code node by default, which is why the secret is pasted in. require('crypto') works on n8n Cloud. On self-hosted n8n you have to allow it with NODE_FUNCTION_ALLOW_BUILTIN=crypto (Code node docs). getBinaryDataBuffer is n8n's documented way to read binary data. Hash the raw bytes, never JSON.stringify of the parsed body: re-serializing changes the string and breaks the signature.

A delivery can arrive more than once, and weir-event-id stays the same on retries. If duplicates matter, check eventId against a store you already run (Redis, Postgres) before posting.

A complete workflow: new mentions, filter, Slack

  1. Webhook (POST, Raw Body, Respond Immediately) receives the monitor delivery.
  2. Code (the code above) rejects anything unsigned and turns each result into a normalized item: platform, author, text, url, engagement.
  3. Filter keeps the items worth a ping, for example engagement >= 3. Other rules that work: drop your own accounts by author, or match competitor names in text.
  4. Slack sends one message per item to #mentions, with text like {{ $json.platform }} / {{ $json.author }}: {{ $json.text.slice(0, 280) }} {{ $json.url }}.

A delivery carries up to 25 items. If data.newResults is larger, an HTTP Request to GET /v1/monitors/{monitorId}/results (free) returns the full list.

Cost: a run costs 1 credit plus the per-result rate for each new item: 3 credits per Reddit post and 1 per X post. A daily run that finds 4 new Reddit posts and 10 new X posts costs 1 + 12 + 10 = 23 credits. A run that finds nothing new costs 1. Reading results and webhook deliveries are free.

Path 3: MCP Client Tool for AI Agent workflows

To let an AI Agent node decide what to search, attach an MCP Client Tool. The node's source shows that version 1.2 and later have an Endpoint field, a Server Transport that defaults to HTTP Streamable, and authentication options that include Bearer Auth and MCP OAuth2 (n8n source):

Setting Value
Endpoint https://api.weirapp.io/mcp
Server Transport HTTP Streamable
Authentication Bearer Auth (your Weir key), or MCP OAuth2
Tools to Include Selected: e.g. search_reddit, search_x, get_reddit_comments

With MCP OAuth2, n8n uses dynamic client registration by default (MCP credential docs), which Weir supports. Pick only the tools the agent needs. A smaller tool list keeps prompts shorter and spending easier to predict.

Troubleshooting

  • Signature never matches. Raw Body is off, or the code hashes parsed JSON. Turn Raw Body on and hash getBinaryDataBuffer(0, 'data').
  • Cannot find module 'crypto'. On self-hosted n8n, set NODE_FUNCTION_ALLOW_BUILTIN=crypto and restart.
  • Deliveries fail while you're building. The test URL only listens after Listen for test event. Register the production URL with Weir, and publish the workflow.
  • MCP Client Tool shows only "SSE Endpoint" or returns 405. That's node version 1 or 1.1, which uses SSE. Weir serves Streamable HTTP. Add a fresh node, which uses the current version, or set Server Transport to HTTP Streamable. A GitHub issue reports some n8n Cloud instances showing only the SSE form.
  • 402 from Weir. Out of credits. It isn't retryable, so don't let n8n's retry setting loop on it.

FAQ

Is there an official Weir node? No. Use HTTP Request, Webhook and MCP Client Tool as shown.

Do I need a Reddit or X developer account? No. A Weir key covers both platforms.

How much is free? 5,000 credits a month. After that, packs start at $5 for 25,000 credits, as of October 2026 (pricing).

Next steps

Create a free account, make a key and a webhook, and send a test delivery. The brand mention monitor guide covers choosing queries. Reference docs: monitors and webhooks, APIs and frameworks.

Sources