Monitors and webhooks

A monitor watches something on a schedule and reports only what is new.

curl --request POST \
  --url https://api.weirapp.io/v1/monitors \
  --header "Authorization: Bearer $WEIR_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Checkout complaints",
    "target": {
      "kind": "search",
      "query": "checkout failing",
      "sources": ["reddit", "x"]
    },
    "schedule": "daily"
  }'

What you can watch

target.kind decides what a monitor polls.

Kind Watches Fields
search A phrase, across sources query, sources
subreddit One community's new posts subreddit, optional query, optional includeNsfw
subreddit_comments One community's new comments subreddit, optional query, optional includeNsfw
reddit_user One Reddit account's posts and comments username, optional include, optional includeNsfw
x_user One account's posts handle, optional skipReposts, optional minLikes, optional query
reddit_thread New comments on one Reddit post postId
x_thread New replies to one X post postId

Leave query off a subreddit target to be told about every new post in the community. A subreddit or subreddit_comments target takes one community or up to 10 joined with + (saas+startups).

A subreddit_comments monitor with a query filters the comment stream itself, because Reddit cannot search comments: every word must appear, "quoted phrases" match whole, -word must not appear, and OR in capitals separates alternatives. Matching ignores case and respects word boundaries, so ai does not match "said". Each run reads the newest 300 comments, so a community busier than that between runs loses the oldest of them; choose hourly for busy communities.

A search target reads one page of the newest X matches per run, about 20 posts. A query that matches more than that between runs loses the oldest, so choose hourly or narrow the query.

{ "kind": "subreddit", "subreddit": "saas" }
{ "kind": "x_user", "handle": "naval" }
{ "kind": "reddit_thread", "postId": "https://www.reddit.com/r/saas/comments/1vdo8we/slug/" }

Identifiers are normalised, so paste whatever you have. A URL, an r/ prefix, an @, and a t3_ fullname all work.

Thread, subreddit_comments and reddit_user watches return comments (a reddit_user watch returns posts too); the others return posts. Each result says which it is in itemType.

An x_user monitor resolves the handle once and follows the account by its numeric id after that, so it keeps working if the account is renamed.

Filtering an account watch

An x_user target takes three optional filters, applied to each post the account publishes:

Field Keeps
skipReposts true leaves out the account's reposts of other people's posts. Quotes are kept
minLikes Only posts with at least this many likes
query Only posts with these words, matched like a subreddit_comments query (-word, OR)
{
  "kind": "x_user",
  "handle": "nasa",
  "skipReposts": true,
  "minLikes": 500,
  "query": "launch OR Artemis"
}

A post that does not pass is not stored, so the next run looks at it again. With minLikes, that means a post is sent when it reaches the number, as long as it is still among the account's newest posts. Pair it with a 15min or hourly schedule. A repost is judged by the original's text and likes.

Schedules

Schedule Runs
manual Only when you call POST /v1/monitors/{id}/run
15min Every 15 minutes. Paid tiers: 2 monitors at once on Tier 1, 10 on Tier 2, 25 on Tier 3
hourly Every hour. Any credit purchase unlocks it
daily Every day (the default)
weekly Every week

How many monitors you can keep depends on your tier: one on the free tier, more on paid tiers. GET /v1/limits returns the numbers for your account, including fifteenMinuteMonitors. Going over returns 409 with details.resource naming the limit (monitors, schedule or fast_schedule).

A 15-minute slot is taken only while the monitor is active: pausing one frees it, and resuming it checks again. The service also has a ceiling on 15-minute monitors in total, since they share capacity with live API calls; if it is full, the 409 says so with details.reason: "capacity", and hourly still works.

On the free tier, POST /v1/monitors/{id}/run runs each monitor by hand once an hour (a 429 with Retry-After until the next hour). Scheduled runs are not affected, and any credit purchase lifts it.

Start from now

A new monitor's first run finds what is already there: an account watch finds the account's latest 20 posts. Create it with "startFrom": "now" to keep those out of your webhook. The first run stores them, so they are listed in /results and billed as usual, but sends nothing; every run after that sends only what is new.

{
  "name": "Posts by @nasa",
  "target": { "kind": "x_user", "handle": "nasa" },
  "schedule": "15min",
  "startFrom": "now"
}

baselinePending on the monitor is true until that first run has happened. PATCH a monitor with "startFrom": "now" to do it again, for example with a new target. In the dashboard it is a checkbox, on by default for new monitors.

RSS feeds

Every monitor can publish an RSS 2.0 feed of its 50 newest results, for a feed reader, Slack's /feed subscribe, or Zapier, Make, n8n and IFTTT.

curl --request POST \
  --url "https://api.weirapp.io/v1/monitors/$MONITOR_ID/feed" \
  --header "Authorization: Bearer $WEIR_API_KEY"
# {"data":{"feedUrl":"https://weirapp.io/feeds/…"}}

The URL is the only key, because feed readers cannot send one: anyone who has it can read the feed. Calling POST again gives a new URL and stops the old one working; DELETE turns the feed off. Reading a feed is free. The monitor's feedUrl shows the current URL, or null while it is off, and the dashboard shows it on the monitor's page.

"New" means new content, not a new id

Results are deduplicated by a hash of the content, not by the platform's post id.

That is the reason to use a monitor rather than a cron job around a search. An edited post keeps its id; a re-post gets a fresh one. Deduplicating by id alerts you twice for the second and never for the first.

Reading results

curl --url "https://api.weirapp.io/v1/monitors/$MONITOR_ID/results" \
  --header "Authorization: Bearer $WEIR_API_KEY"

/runs gives the execution history, including failures and what they collected before failing.

Both are free, and so is triggering a run. Each run is billed like the same call made by hand: a 1-credit minimum plus the new results it stores, at the API's per-result rates. An account watch also pays for one profile lookup, on its first run only. A triggered run answers 202 with a job id and runs in the background, so read /runs for the outcome rather than expecting results in the response.

Webhooks

Be told instead of polling:

curl --request POST \
  --url https://api.weirapp.io/v1/webhooks \
  --header "Authorization: Bearer $WEIR_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Ops channel",
    "url": "https://hooks.example.com/weir",
    "events": ["monitor.result.created"]
  }'

The signing secret is returned once. Point a monitor at the webhook with its webhookId.

Event Sent when
monitor.result.created A run found something new. One delivery per run, up to 25 items
webhook.test You call POST /v1/webhooks/{id}/test

Subscribe to monitor.run.failed to hear when a run fails after its retries: the delivery names the monitor and the run and carries an errorSummary, and Slack, Discord and Telegram get it as one readable sentence. A monitor's /runs lists every run with its outcome.

How many webhooks you can keep depends on your tier, the same way as monitors.

Alerts in Slack, Discord or Telegram

Use the chat app's incoming-webhook URL as the webhook's url. Weir then sends each delivery there as a short message instead of the signed JSON event: the monitor's name, how many results are new, and up to five of them with their links.

App The URL to use
Slack An incoming webhook: https://hooks.slack.com/services/…
Discord A channel webhook, from the channel's Integrations settings: https://discord.com/api/webhooks/…
Telegram Your bot's sendMessage URL with the chat's id: https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat id>

For Telegram, create a bot with @BotFather, add it to the chat, and put the chat's id in the URL. POST /v1/webhooks/{id}/test, or Send test on the dashboard's Webhooks page, sends a test message, so you can check the channel before a monitor runs. Discord messages never ping anyone, whatever a post says.

Treat these URLs as secrets: anyone who has one can post to your channel. The chat apps don't check Weir's signature, so there is nothing to verify on that side.

What a delivery looks like

A POST with a JSON body and three headers:

weir-signature: 5f2b…   (hex HMAC-SHA256)
weir-timestamp: 1800000000
weir-event-id: evt_…
{
  "id": "evt_…",
  "type": "monitor.result.created",
  "createdAt": "2026-07-30T11:04:22.000Z",
  "data": {
    "monitorId": "…",
    "runId": "…",
    "kind": "search",
    "itemType": "post",
    "newResults": 3,
    "results": []
  }
}

results holds each platform's own record, exactly as the API returns it.

Verifying a delivery

The signature is HMAC-SHA256(secret, "{timestamp}.{eventId}.{rawBody}"), hex encoded, where timestamp is the weir-timestamp header, eventId the weir-event-id header, and rawBody the body exactly as received. The key is the whole secret as text, whsec_ prefix included. This is not the Standard Webhooks scheme, which base64-decodes the secret and orders the parts differently, so a Standard Webhooks library rejects every Weir delivery: verify with the code below.

All three parts are signed on purpose: the body alone could be replayed forever, the timestamp bounds that window, and the event id stops one valid signature being lifted onto another delivery inside it. Reject a timestamp more than five minutes from now, and compare in constant time.

Use the raw body. Parsing and re-serializing JSON reorders keys, which changes the string and breaks the signature. This is the most common reason a correct secret still fails.

Node, with Express:

import { createHmac, timingSafeEqual } from "node:crypto";
import express from "express";

function verifyWeir(raw: Buffer, signature: string, timestamp: string, eventId: string): boolean {
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected = createHmac("sha256", process.env.WEIR_WEBHOOK_SECRET!)
    .update(`${timestamp}.${eventId}.`)
    .update(raw)
    .digest("hex");
  return (
    signature.length === expected.length &&
    timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
  );
}

const app = express();

app.post("/weir", express.raw({ type: "application/json" }), (request, response) => {
  const valid = verifyWeir(
    request.body,
    request.header("weir-signature") ?? "",
    request.header("weir-timestamp") ?? "",
    request.header("weir-event-id") ?? "",
  );
  if (!valid) return response.status(400).end();

  response.status(200).end();
  const event = JSON.parse(request.body.toString("utf8"));
  console.log(event.id, event.type); // process it here, deduplicating on event.id
});

express.raw, not express.json, so the body arrives as the bytes that were signed.

Python:

import hashlib
import hmac
import os
import time


def verify_weir(raw_body: bytes, signature: str, timestamp: str, event_id: str) -> bool:
    try:
        if abs(time.time() - int(timestamp)) > 300:
            return False
    except ValueError:
        return False
    message = f"{timestamp}.{event_id}.".encode() + raw_body
    secret = os.environ["WEIR_WEBHOOK_SECRET"].encode()
    expected = hmac.new(secret, message, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected.encode(), signature.encode())

Pass the raw bytes: request.get_data() in Flask, await request.body() in Starlette and FastAPI.

Go:

package webhooks

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"strconv"
	"time"
)

// VerifyWeir reports whether a delivery was signed with the webhook's secret.
func VerifyWeir(rawBody []byte, signature, timestamp, eventID, secret string) bool {
	issued, err := strconv.ParseInt(timestamp, 10, 64)
	if err != nil {
		return false
	}
	if age := time.Now().Unix() - issued; age > 300 || age < -300 {
		return false
	}
	mac := hmac.New(sha256.New, []byte(secret))
	mac.Write([]byte(timestamp + "." + eventID + "."))
	mac.Write(rawBody)
	expected := hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(signature))
}

Read the body with io.ReadAll(r.Body) before decoding it.

Delivery behaviour

  • At least once. A delivery can arrive more than once. weir-event-id stays the same when a delivery is retried, so deduplicate on it.
  • Retries back off over about nine hours: roughly 1 minute, 5 minutes, 30 minutes, 2 hours, and 6 hours after each failure. Every attempt is recorded at GET /v1/webhook-deliveries.
  • Respond within 10 seconds. Return 2xx first, then do the work.
  • A 4xx other than 429 is not retried. It says the request itself was refused, and sending it again would be refused the same way.
  • Redirects are not followed. A 302 is a failure. A public URL redirecting to an internal one is the standard way to turn a webhook into request forgery.
  • A persistently failing endpoint is disabled after 20 failures in a row. One success clears the streak.

POST /v1/webhooks/{id}/test sends a real signed delivery, free. Its data is empty, and calls within the same minute send one delivery between them.

View this page as Markdown