Webhooks

A webhook sends each matching article to your server as an HTTP POST, the moment finlight has it. You do not poll. You set the filter once, and finlight pushes new articles and, if you want, their updates.


How webhooks work

  1. You create a webhook in the finlight dashboard. It has a filter (the criteria) and a destination URL.
  2. finlight checks every new article against your criteria.
  3. For each match, finlight sends one signed POST request with a JSON body to your URL.
  4. Your server checks the signature and answers with a 2xx status within 5 seconds.

Every v3 delivery has the same shape: a small envelope with an eventId, the event name and the article in data. The article is the same object you get from the REST API and the WebSocket. See Payload.

There are two webhook types:

  • Enriched delivers the article after finlight has analysed it. You can add companies with roles, and events. You can filter by tickers, countries and categories.
  • Raw delivers the article basics as soon as finlight first sees it, before any analysis. It is faster, but it has fewer fields and fewer filters. See Raw webhooks.

Before you start

You need:

  • A finlight plan with webhook access. Webhooks start with the Pro Light plan. See pricing.
  • A public HTTPS endpoint that accepts POST requests with a JSON body.
  • A login for the finlight dashboard. Webhooks are managed only in the dashboard. There is no API-key route to create or change a v3 webhook.

Some blocks in the payload depend on your plan. For example, events need event access, which comes with Pro Standard and every higher plan. See Plans & entitlements.


Create a webhook

Open app.finlight.me/news-webhooks and click New Webhook. The wizard has three steps.

Step 1: Basics

  • Name: a name you will recognise, such as "NVIDIA earnings".
  • Description: optional.
  • Delivery Type: Enriched or Raw. You cannot change the type later. To change it, create a new webhook.

Step 2: Criteria

  • Filters: the query and the other filters. See Criteria.
  • Payload format: choose v3 (marked "Recommended"). v2 is still offered for old receivers, but it is marked "Deprecated" and gets no new features. This page and the rest of this section describe v3.
  • Included blocks (enriched v3 only): choose Companies and Events. Sentiment is always included when your plan has it, so it has no checkbox. A block your plan does not include is shown as locked with "Not in your plan." Raw webhooks cannot add blocks.
  • Include Updates: turn this on to also receive article.updated deliveries when a source changes an article.

Step 3: Destination and authentication

  • Destination URL: your public HTTPS endpoint.
  • Authentication Type: None, Basic Authentication or Custom Header (X-Finlight-Key). This adds an extra header to every delivery. Every delivery is also signed, whatever you choose here. See Signature verification.
  • Activate immediately: off by default. A new webhook then starts disabled, so nothing is delivered until you press Enable on its detail page. Turn it on if your endpoint is ready.

After you create the webhook, its detail page shows the Secret. You need it to check signatures. The detail page also has the Test button and the Call History. See Testing.


Switch a webhook from v2 to v3

An existing webhook keeps the v2 format until you switch it. The switch is per webhook, and it takes effect at once.

  1. Update your receiver first. Deploy a receiver that understands v3, for example with a v3 client library. It must also accept a v2 body during the switch and answer it with 2xx. The client libraries return such a body as WrongPayloadVersion (see Payload).
  2. Switch the format. Open the webhook in the dashboard and press Switch to v3, then confirm.
  3. Choose the blocks. Companies carry over from your v2 settings. Events start off. To get events, press Edit and turn on Events.
  4. Wait about 2 hours. Retries that were queued before the switch still arrive in the old v2 format. After that, you can remove your v2 code path.

You can switch back with Switch back to v2. It is marked deprecated, and your receiver must then understand v2 again.

Make.com and Zapier integrations create v2 webhooks. They do not offer v3.


A minimal receiver

A receiver does four things:

  1. It reads the raw body, before any JSON parser runs.
  2. It checks the signature with your webhook secret.
  3. It drops deliveries it has already seen, using eventId.
  4. It answers 2xx within 5 seconds and does slow work afterwards.

Minimal receiver

import express from 'express'
import { Webhooks, WrongPayloadVersion, WebhookVerificationError } from 'finlight-client'

const app = express()

// Keep the body raw: never verify re-serialized JSON.
app.post('/finlight', express.raw({ type: 'application/json' }), (req, res) => {
  let result
  try {
    result = Webhooks.constructEvent(req.body, req.headers, process.env.FINLIGHT_WEBHOOK_SECRET!)
  } catch (err) {
    return res.sendStatus(err instanceof WebhookVerificationError ? 400 : 500)
  }
  if (result instanceof WrongPayloadVersion) return res.sendStatus(204) // old format during the switch
  res.sendStatus(204) // answer within 5 s, work afterwards
  queue.push(result) // dedupe on result.eventId
})

already_seen, queue_for_processing and queue stand for your own code. Receivers for all client libraries, and a version without a library, are on Signature verification.


Next steps