Send company monitoring alerts to Slack or Microsoft Teams (webhook relay recipe)

This is a recipe, not a Slack app or a Teams app. The signed alert that POST /monitor sends has its own JSON shape, and Slack and Teams each expect another, so something of yours sits in the middle: it checks the signature, writes the message and posts it.

Why a relay is needed

A monitoring subscription posts a signed JSON body to the webhook_url you gave it (see Monitoring and webhooks and the supplier webhook recipe). A Slack incoming webhook wants text or blocks, and a Teams workflow webhook wants a card envelope. Our body has neither, and we do not post in their formats. The relay below receives our alert, verifies it, builds the Slack and Teams messages and sends them. Prometiam has no Slack or Teams app, and no listing in either store; Integrations says what exists.

The alert and its signature

The alert is a JSON body, signed with HMAC-SHA256 over the raw body using the webhook_secret that POST /monitor returned once. The signature is in the header X-Prometiam-Signature: sha256=<hex>. Verify it on the bytes you received, before parsing them, and compare in constant time. The body, as in the monitoring documentation:

{
  "event": "company_monitor.alert",
  "alert_type": "corporate_event",
  "monitor_id": 42,
  "label": "acme-vendor",
  "company": { "id": 812044, "company_number": "A28015865", "name": "TELEFONICA SA", "country": "ES" },
  "event_date": "2026-07-02",
  "detail": { "event_type": "capital_change", "previous_value": "3000000", "new_value": "5000000", "notice_url": "https://www.boe.es/borme/..." },
  "created_at": "2026-07-03T05:10:00Z"
}

This payload is the documentation's illustrative example, not a live alert. alert_type is corporate_event, status_change, dissolution or sanctions_match. The shape of detail depends on the alert, so the relay prints what it finds there and does not assume field names beyond notice_url.

What Slack takes

The Slack payload comes from Slack's own package on npm, @slack/webhook (version 8.1.0 on 26 November 2026, Node 20 or later). Its README says to create an IncomingWebhook with the URL Slack gave you and call send() with text, or with blocks. Its types, from @slack/types, define a header block (plain text, up to 150 characters), a section block (up to 3,000 characters of text) and a context block. Retries are off by default, and a 4xx, rate limits included, fails at once. The relay sends a plain-text fallback in text and Block Kit blocks for the display.

What Teams takes, as at 26 November 2026

Microsoft Learn, in "Create Incoming Webhooks" (read on 26 November 2026), says Office 365 Connectors in Teams, including connector-based Incoming Webhooks, were retired in May 2026. To receive webhook requests and post to a channel or chat, it says to use the Workflows app, with a template such as "Send webhook alerts to a channel" or a flow that starts with When a Teams webhook request is received. You copy the URL the workflow gives you, and send it a POST. Learn says:

  • Workflows webhooks accept Adaptive Card and MessageCard payloads. MessageCard payloads render content but have no interactive HTTP POST action buttons.
  • The message size limit is 28 KB, and more than four requests in a second are throttled; Learn advises retry with exponential backoff.
  • A workflow is linked to its owner, not to a team or channel, and can become an orphan flow if the owner leaves and there is no co-owner.

If you still have an old connector URL, check with Microsoft whether it works at all: Learn states the retirement as done. The relay posts the Adaptive Card envelope that Learn's JavaScript example uses (type: "message", an attachment with contentType: "application/vnd.microsoft.card.adaptive").

The relay

One file, Node 20 or later, with npm install @slack/webhook. The Slack and Teams URLs and the webhook secret come from the environment. Set only the destinations you want.

const http = require('node:http');
const crypto = require('node:crypto');
const { IncomingWebhook } = require('@slack/webhook');

const SECRET = process.env.PROMETIAM_WEBHOOK_SECRET;     // webhook_secret from POST /monitor
const SLACK_URL = process.env.SLACK_WEBHOOK_URL;         // Slack incoming webhook
const TEAMS_URL = process.env.TEAMS_WORKFLOW_URL;        // Teams "When a Teams webhook request is received" URL

const LABELS = {
  corporate_event: 'Corporate event',
  status_change: 'Status change',
  dissolution: 'Dissolution',
  sanctions_match: 'Sanctions match (beta screening)',
};

// 1. Verify: HMAC-SHA256 of the raw body, hex, header "sha256=<hex>".
function verify(rawBody, header) {
  if (!SECRET || !header) return false;
  const expected = 'sha256=' + crypto.createHmac('sha256', SECRET).update(rawBody).digest('hex');
  const a = Buffer.from(expected), b = Buffer.from(header);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

// 2. Map one alert to a short text and a list of facts.
function describe(alert) {
  const c = alert.company || {};
  const title = `${LABELS[alert.alert_type] || alert.alert_type}: ${c.name || c.company_number} (${c.country})`;
  const facts = [['Company number', c.company_number], ['Event date', alert.event_date], ['Label', alert.label]];
  for (const [k, v] of Object.entries(alert.detail || {})) {
    if (k !== 'notice_url' && v !== null && typeof v !== 'object') facts.push([k, String(v)]);
  }
  return { title, facts: facts.filter(([, v]) => v), url: alert.detail && alert.detail.notice_url };
}

// 3a. Slack: the package's IncomingWebhook, with Block Kit blocks and a plain-text fallback.
const esc = (t) => String(t).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); // Slack mrkdwn
function slackMessage(m) {
  const lines = m.facts.map(([k, v]) => `*${k}:* ${esc(v)}`).join('\n');
  return {
    text: m.title,
    blocks: [
      { type: 'header', text: { type: 'plain_text', text: m.title.slice(0, 150) } },
      { type: 'section', text: { type: 'mrkdwn', text: lines + (m.url ? `\n<${m.url}|Open the notice>` : '') } },
      { type: 'context', elements: [{ type: 'mrkdwn', text: 'Prometiam monitoring alert. A lead to review, not a finding.' }] },
    ],
  };
}

// 3b. Teams: the Adaptive Card envelope Microsoft Learn shows for a workflow webhook.
function teamsMessage(m) {
  return {
    type: 'message',
    attachments: [{
      contentType: 'application/vnd.microsoft.card.adaptive',
      contentUrl: null,
      content: {
        $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
        type: 'AdaptiveCard',
        version: '1.2',
        body: [
          { type: 'TextBlock', text: m.title, weight: 'Bolder', size: 'Medium', wrap: true },
          { type: 'FactSet', facts: m.facts.map(([title, value]) => ({ title, value })) },
          ...(m.url ? [{ type: 'TextBlock', text: `[Open the notice](${m.url})`, wrap: true }] : []),
        ],
      },
    }],
  };
}

async function relay(alert) {
  const m = describe(alert);
  if (SLACK_URL) await new IncomingWebhook(SLACK_URL).send(slackMessage(m));
  if (TEAMS_URL) {
    const r = await fetch(TEAMS_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(teamsMessage(m)) });
    if (!r.ok) throw new Error(`Teams answered ${r.status}`);
  }
}

http.createServer((req, res) => {
  const chunks = [];
  req.on('data', (c) => chunks.push(c));
  req.on('end', async () => {
    const raw = Buffer.concat(chunks);                    // the exact bytes, before any JSON parsing
    if (!verify(raw, req.headers['x-prometiam-signature'])) { res.writeHead(401).end(); return; }
    try {
      const alert = JSON.parse(raw.toString('utf8'));
      if (alert.event !== 'company_monitor.alert') { res.writeHead(200).end(); return; }
      await relay(alert);
      res.writeHead(200).end('ok');
    } catch (e) {
      console.error(e.message);
      res.writeHead(500).end();                           // a non-2xx tells the sender it did not land
    }
  });
}).listen(process.env.PORT || 8080);

Run on 26 November 2026

The relay ran locally. A test script played Slack and Teams with a stub server on 127.0.0.1, signed the example alert with a made-up secret, and posted it to the relay. No real Slack workspace and no real Teams channel was used, so the messages below show what would be posted, not how they render. Four posts: the signed alert, the same signature on an altered body, an alert signed with another secret, and an alert with no signature.

// Local test: a stub plays Slack and Teams; no real channel is used.
const http = require('node:http');
const crypto = require('node:crypto');
const { spawn } = require('node:child_process');

const SECRET = 'whsec_local_test_only';
const got = [];
const stub = http.createServer((req, res) => {
  let b = ''; req.on('data', (c) => (b += c));
  req.on('end', () => { got.push({ path: req.url, body: JSON.parse(b) }); res.writeHead(200).end('ok'); });
}).listen(9101, async () => {
  const relay = spawn('node', ['relay.js'], { env: { ...process.env, PORT: '9102', PROMETIAM_WEBHOOK_SECRET: SECRET,
    SLACK_WEBHOOK_URL: 'http://127.0.0.1:9101/slack', TEAMS_WORKFLOW_URL: 'http://127.0.0.1:9101/teams' }, stdio: 'inherit' });
  await new Promise((r) => setTimeout(r, 600));
  const alert = {
    event: 'company_monitor.alert', alert_type: 'corporate_event', monitor_id: 42, label: 'acme-vendor',
    company: { id: 812044, company_number: 'A28015865', name: 'TELEFONICA SA', country: 'ES' },
    event_date: '2026-07-02',
    detail: { event_type: 'capital_change', previous_value: '3000000', new_value: '5000000', notice_url: 'https://www.boe.es/borme/...' },
    created_at: '2026-07-03T05:10:00Z',
  };
  const body = JSON.stringify(alert);
  const sig = 'sha256=' + crypto.createHmac('sha256', SECRET).update(body).digest('hex');
  const post = (b, s) => fetch('http://127.0.0.1:9102/', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Prometiam-Signature': s }, body: b }).then((r) => r.status);
  console.log('signed alert ->', await post(body, sig));
  console.log('tampered body ->', await post(body.replace('5000000', '9000000'), sig));
  console.log('wrong secret  ->', await post(body, 'sha256=' + crypto.createHmac('sha256', 'other').update(body).digest('hex')));
  console.log('no signature  ->', await post(body, ''));
  console.log('stub received', got.length, 'messages');
  for (const g of got) console.log(g.path, JSON.stringify(g.body, null, 1));
  relay.kill(); stub.close();
});
signed alert -> 200
tampered body -> 401
wrong secret  -> 401
no signature  -> 401
stub received 2 messages

The stub received the Slack body, whose section block read: *Company number:* A28015865, *Event date:* 2026-07-02, *Label:* acme-vendor, *event_type:* capital_change, *previous_value:* 3000000, *new_value:* 5000000 and a link to the notice. It received the Teams body as an Adaptive Card with a bold title ("Corporate event: TELEFONICA SA (ES)") and a FactSet of the same facts. What was not run: a real Slack or Teams post, so the card rendering, the Workflows trigger and any tenant policy are untested here.

The same relay as an n8n workflow

The n8n node covers our API calls, not receiving our webhook, so the relay is built from n8n's core nodes. I read the n8n-nodes-base package (version 2.49.7 on 26 November 2026) for the nodes below; the outline was not imported into n8n and not run.

  • Webhook node, POST, with the Raw Body option on (described in the package as "Raw body (binary)"), so the signature can be checked on the bytes sent. Respond with a 2xx after the checks.
  • Crypto node, action Hmac, type SHA256, encoding hex, over the raw body text with your secret, then an If node comparing sha256= plus that value with the X-Prometiam-Signature header. A non-matching request ends here. Confirm in your n8n that the value you hash is the raw text, since a re-serialised body fails.
  • Switch node on alert_type, if you want a different message for sanctions_match.
  • Set node to build text for Slack and the card for Teams.
  • HTTP Request node, POST, to the Slack incoming webhook URL, and another to the Teams workflow URL. The package's Slack node takes an access token or OAuth2 credential rather than an incoming webhook URL, and its Microsoft Teams node works on channel and chat messages, so HTTP Request is the node for a webhook URL.

What it costs

Managing monitored companies (POST, GET and DELETE /monitor) costs 0 credits, and so does the relay. What each plan can watch: free trial 3 companies, Starter EUR 9.99 25, Professional EUR 29.99 250, Scale EUR 99.99 2,500, Enterprise on request. The trial lasts 14 days with 500 credits, a card is required and nothing is charged during it.

Limits

  • Monitoring needs a key of your own; the public demo key answers 403 for it. The relay was tested with an example payload for that reason.
  • Every live country is monitorable except Chile, South Korea, New Caledonia, Peru, Honduras, Guatemala, Uruguay, the Dominican Republic, New Zealand, Bulgaria, Georgia, Tanzania, Zambia and Paraguay. The country list, with each start date, is in the monitoring documentation.
  • Alert types: status change, dissolution, sanctions match (screening is beta) and corporate events. Corporate events are gazette events for Spain, France (BODACC) and the United Kingdom (Companies House filings and Gazette notices), the SHAB gazette as well as register-change events for Switzerland, and register-change events for the others (Ireland, Poland and Norway none before 14 October 2026), dated when the change first appears in the register data. Argentina is read monthly, and its dissolution alert fires only for companies whose status the IGJ gives.
  • An alert arrives after the register has published the change, never before it. The documentation says the day after publication, so this is a daily signal, not a live feed.
  • An alert is a lead to review, not a finding about the company. The relay does not enrich the alert or decide anything.
  • The relay keeps no state. If your endpoint is down, the alert stays in GET /monitor and you can read it there. Answer with a 2xx quickly and do slow work afterwards.
  • Not a legal or compliance product: whether to act on an alert is your decision.

Related pages

Sign up · API documentation

The free trial lasts 14 days and includes 500 credits. A card is required and nothing is charged during the trial; it then continues as Starter (EUR 9.99/month) unless you cancel.

Frequently asked questions

Can the monitoring webhook post straight into Slack?
No. Slack's incoming webhook expects text or blocks, and our alert is a different JSON body that is also signed. A relay such as the one on this page, or a workflow tool, reshapes it.
Do the old Teams incoming webhook connectors still work?
Microsoft Learn says Office 365 Connectors in Teams, including connector-based Incoming Webhooks, were retired in May 2026, and points to the Workflows app. Read the current Learn page and check with Microsoft before relying on an old URL.
Why verify the signature at all?
Anyone who finds the relay URL can post to it. The HMAC proves the body came from a subscription holding your secret and was not changed on the way. Check it on the raw bytes, before parsing.
How quickly does an alert reach Slack?
After the register publishes the change, and then within the monitoring check. The documentation describes alerts as arriving the day after publication, so do not use this for real-time response.
Does it work for an insolvency alert?
Monitoring sends a status_change or dissolution alert when the company's register status changes. Insolvency notices are a separate dataset, corporate only and in sixteen markets, and no notice is not proof of solvency. Contains CVR data (Erhvervsstyrelsen), CC BY 4.0.