Skip to content
English

Webhooks

With a webhook you don’t need to keep asking whether a search has finished: Sentir sends a POST to your server when it happens.

Under AI & MCP, go down to API and webhooks, type your server’s address and press Save. Sentir shows you the webhook’s secret (whsec_…) once only: keep it where you keep your secrets. With it you check that an event comes from Sentir.

  • An account has one webhook. Saving another address replaces it and makes a new secret.
  • The address must be https and public. Sentir does not send events to private or local addresses, and does not follow redirects.
  • The account’s owner or an admin registers it.
Type When
search.finished A search finished and its report is ready. Also each day of a daily tracking.
search.failed A search failed. Its tokens came back.
series.paused A daily tracking paused, for example because no tokens are left.
alert.fired A crisis alert fired on a topic with alerts on: mentions or negative sentiment jumped.
report.sent A scheduled report went out to its recipients.

The account’s webhook receives all five types.

The body is JSON:

{
"id": "5d1c0a8e-7c0f-4a59-9d0b-3a8f6f1f2b10",
"type": "search.finished",
"createdAt": "2026-11-18T16:04:11.000Z",
"data": { "search": { "id": "0b6f3b1e-4c1d-4b7a-9a43-1d2f3a4b5c6d", "keyword": "Telcel", "status": "done", "errorCode": null, "items": 4820, "seriesId": null, "url": "https://sentirsocial.com/search/0b6f3b1e-…" } }
}

In series.paused, data is { "series": { "id", "keyword", "reason", "url" } }. In alert.fired, { "alert": { "id", "seriesId", "keyword", "kind", "changePct", "windowHours", "posts", "numbers", "url" } }: kind is negative, volume or emotion, and numbers holds the figures of what rose. In report.sent, { "report": { "scheduleId", "sendId", "target", "periodFrom", "periodTo", "recipients", "url" } }: recipients is how many addresses received it, never which. The event does not carry the report: read it with GET /searches/{id}/report.

Besides the account’s webhook, an access key with write access can subscribe addresses to one event type each. It is what Zapier and Make do when you turn a flow on, and you can use it from your own system.

Call What it does
POST /hooks with { "url", "event" } Subscribes the address to that type. Answers { id, event, url, createdAt, secret }: the secret is shown once only.
GET /hooks Lists the account’s subscriptions, without their secrets.
DELETE /hooks/{id} Removes a subscription.
  • Each subscription has its own secret and signs its events with it, as the account’s webhook does.
  • The same address rules hold: https, public, no redirects.
  • Up to 100 subscriptions per account. They spend no tokens.
  • If you revoke the access key that made a subscription, the subscription goes with it.
  • The account’s webhook is not in this list and is not removed through the API.

Every event carries the Sentir-Signature header:

Sentir-Signature: t=1795017851,v1=5f2b…c9

t is when it was sent, in seconds. v1 is the HMAC-SHA256, in hex, of the text t, a dot and the body exactly as it arrived, keyed with your secret. To verify:

  1. Compute the HMAC-SHA256 of "<t>.<body>" with your secret and compare it with v1, using a constant-time comparison.
  2. Refuse the event when t is more than 5 minutes old: nobody can then replay an old one to you.

Use the raw body, before parsing it as JSON.

import crypto from "node:crypto";
// body: the raw body (text); header: the value of Sentir-Signature
export function isFromSentir(body, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(",").map((part) => part.split("=")));
const expected = crypto.createHmac("sha256", secret).update(`${t}.${body}`).digest();
const given = Buffer.from(v1 ?? "", "hex");
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && given.length === expected.length && crypto.timingSafeEqual(given, expected);
}
  • Answer with a 2xx status within 10 seconds. Do the heavy work after you answer.
  • When your server does not answer, or answers anything else, Sentir tries again: after 1, 5 and 30 minutes, and after 2, 6 and 12 hours. Past 24 hours it stops.
  • One event can arrive more than once. Its id (also in the Sentir-Delivery header) is the same on every retry: if you already handled it, ignore it.

Under AI & MCP, in API and webhooks, are the latest 20 events with their status: delivered, pending (with the time of the next try) or failed, and what your server answered. They are kept 30 days.

Accessibility