For the complete documentation index, see llms.txt. This page is also available as Markdown.

Outbound Webhooks

Have Violet call your HTTPS endpoint when the entities you care about change.

With outbound webhooks, your systems learn about changes as they happen instead of polling the Violet API.

Each request is a signed, batched JSON POST request that carries ids only: which entity changed, how, and in which integration. Your receiver then reads the details it needs through the API with an API key.

There are two ways to choose what a webhook watches:

  • Linked to an exploration (recommended). A saved exploration from the Data Explorer decides which entities count, live: its saved filters and search pick the entities, and its columns are the watched properties unless you customize them.

  • Manual. Pick the entity types to watch in each integration, and optionally the properties to watch per type.

Who can use it. Webhooks are tenant-wide and managed by tenant admins, in the app or through the API with an admin user's API key.

Quick start

You can go from nothing to a verified test delivery in five steps. You need admin access in Violet and somewhere to run an HTTPS endpoint.

  1. Run a receiver. It accepts POST requests, checks the signature against the raw body, and answers with a 2xx within 10 seconds. Here is a minimal Node.js version. It uses the verify function from Verify signatures:

    import express from 'express';
    import { verify } from './verify.js'; // the function under "Verify signatures"
    
    const app = express();
    const secret = process.env.VIOLET_WEBHOOK_SECRET;
    
    app.post('/hooks/violet', express.raw({ type: 'application/json' }), (req, res) => {
      const rawBody = req.body.toString('utf8');
      if (!verify(rawBody, req.get('Violet-Signature') ?? '', secret)) {
        return res.sendStatus(401);
      }
      res.sendStatus(204); // acknowledge within 10 seconds, then do the work
      const { events } = JSON.parse(rawBody);
      for (const event of events) {
        console.log(event.type, event.entityId ?? ''); // dedupe by eventId, then read the entity
      }
    });
    
    app.listen(3000);
  2. Create the webhook. In Violet, open Webhooks › Outbound from the menu under your name and click Create outbound webhook. Enter a name and your endpoint's HTTPS URL, choose Link an exploration and pick a saved exploration, keep the default events, and click Create webhook. Details are in Set up a webhook.

  3. Save the signing secret. Copy the secret Violet shows into your receiver's configuration, here VIOLET_WEBHOOK_SECRET. It is shown only once.

  4. Send a test. In the webhook's kebab menu (â‹®), click Send test. Your receiver logs a ping event (subscription.ping), and View deliveries shows the request as Delivered.

  5. Load your starting set. Linking sends no events for entities that already match. Page through them once with POST /api/explore/{explorationId}/results, as in Resync a linked webhook. From then on, each event names an entity to read with the Entities endpoint.

In this section

Was this helpful?