Receive webhooks

Add a webhook endpoint in Indrava, verify the signature of each delivery, and handle retries.

Embed
Preview of the card
<a href="https://indrava.forumulate.com/docs/webhooks"><img src="https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/pages/13fc9e0b-f3ff-4f72-8564-757be1638c3c/social-card.svg?v=3e7ae33eec8b" alt="Receive webhooks" width="600" height="315"></a>

Indrava can tell your server when something happens in a workspace: a post was scheduled, published or failed, a channel needs to be reconnected, an approval was requested or decided, and more. The event catalogue lists every event with an example.

Add an endpoint

A workspace admin adds endpoints in the app, on the Developers screen under Webhooks:

  1. Enter the HTTPS address of your endpoint.

  2. Choose the events it should receive.

  3. Copy the signing secret.

  4. Send a test event and check that your server answered 2xx.

The same screen shows the delivery log of each endpoint, with the answer your server gave, and lets you send a delivery again.

Endpoints belong to the workspace. An endpoint receives only events of its own workspace.

Manage endpoints by API

Everything the screen does is also in the API, the MCP server and the command line, with a key that holds webhooks:write (webhooks:read to look). A workspace has at most 50 endpoints.

Operation

Does

POST /webhooks

Adds one: name, url (https, public), events (names, or *), optional channelIds, clientIds, headers. The signing secret is in this answer only

GET /webhooks, GET /webhooks/{id}

List and read: health, filters, header names (never their values)

PATCH /webhooks/{id}

Change name, events, active, filters or headers

DELETE /webhooks/{id}

Remove it

POST /webhooks/{id}/rotate-secret

A new secret; the old one keeps signing for 24 hours

POST /webhooks/{id}/test

Send a signed test event now and see the answer

GET /webhooks/{id}/deliveries

The log: attempt number, status, HTTP status, the start of your answer

POST /webhooks/{id}/deliveries/{deliveryId}/redeliver

Send one delivery again

indrava webhooks create --name CRM --url https://example.com/hook --events '["post.published"]'
indrava webhooks deliveries <id> --status failed

Filters. channelIds and clientIds send only events about those channels or clients. Indrava tags each event that names a channel or a post with its channel and client. An event that is about neither (analytics.synced, media.job_finished, publishing.paused for the whole workspace) is not sent to an endpoint that has such a filter. Headers are sent on every delivery (HTTPS only) and are stored by Atlas, the service that signs and retries deliveries; their values are never shown again.

A key limited to some clients cannot manage webhooks: an endpoint belongs to the whole workspace.

What a delivery looks like

A delivery is an HTTP POST with a JSON body. It names the event type and carries the event's data, which is what the event catalogue shows for each event. Send a test event from the Developers screen to see a complete delivery.

Deliveries are signed in the Standard Webhooks format. Three headers come with each one:

Header

Value

webhook-id

The id of this message. The same on every retry of it

webhook-timestamp

When this attempt was sent, in seconds since 1970

webhook-signature

One or more signatures of the id, timestamp and body

Verify the signature

Verify every delivery before you trust it. Use the raw request body, exactly as received: parsing the JSON and writing it out again changes the bytes and breaks the signature.

The Standard Webhooks project publishes libraries for most languages. In Node:

import { Webhook } from "standardwebhooks";

const webhook = new Webhook(process.env.INDRAVA_WEBHOOK_SECRET);

// inside your handler; `rawBody` is the unparsed body text
const event = webhook.verify(rawBody, {
  "webhook-id": request.headers.get("webhook-id"),
  "webhook-timestamp": request.headers.get("webhook-timestamp"),
  "webhook-signature": request.headers.get("webhook-signature"),
});

verify throws when the signature does not match or the timestamp is too old. Answer 400 in that case and do nothing else.

Receive events of some channels only

An endpoint is filtered by event type, not by channel: it receives the chosen events of every channel in the workspace. Every event about one channel carries that channel's id as channelId in its data (target.published, target.failed, channel.connected, channel.needs_reauth, channel.removed, inbox.message_received, and automation.triggered when a channel is involved), so filter in your handler, after verifying:

const wanted = new Set(["channel_id_1", "channel_id_2"]); // ids from GET /channels
const { channelId } = event.data;
if (channelId && !wanted.has(channelId)) return new Response(null, { status: 204 });

Answer 2xx for the events you skip, or they are retried. Events about a whole post (post.*, approval.*) and media.uploaded have no channelId; to follow a post on chosen channels, subscribe to target.published and target.failed.

Answer quickly, work later

Answer 2xx as soon as the delivery is verified and stored, then do the work. A delivery that gets another status, or no answer in time, is sent again later.

Retries and duplicates

  • A failed delivery is retried. Every retry has the same webhook-id.

  • The same message can therefore arrive more than once. Store the webhook-id of what you have handled and skip a repeat.

  • Events can arrive out of order. target.published for one channel can arrive after post.published for the whole post.

  • An endpoint that keeps failing shows its failures in the delivery log on the Developers screen, where a delivery can be sent again by hand.

Delivery is not guaranteed

If Indrava cannot hand an event to its delivery service at the moment it happens, that event is logged and dropped, not queued. Do not use webhooks as your only record. For anything that must not be missed, also list posts with the API from time to time, for example GET /posts?status[]=failed.

Do not confuse this with the Webhook channel

Indrava also has a Webhook channel type: a channel that publishes a post by sending it to an address of yours. That is a place to post to, with its own optional x-indrava-signature header, and is described in the help centre. This page is about event notifications.

Updated