Board alerts in Slack
Announce new, renamed, trashed and shared boards in Slack with webhooks.
A marketing lead wants to know when the team starts a new campaign board, without checking MockFlow all day. This example listens for MockFlow's webhooks: each new board in the marketing space is announced in Slack and added as a row in the content tracker, and renames, trashed boards and new people are announced too.
Download the code (Node.js 18 or later, no packages)
What it does
Registers a webhook for
board.*andmember.added.Receives each event, checks its signature, and ignores an event id it has already handled.
Posts a line to Slack for each event, and adds every new board to
tracker.csv(your tracker's API in a real setup).Keeps only one space's events when
SPACE_IDis set.
How it works
Create the webhook with
POST /webhooks, your https address and the events. The answer carries the signing secret, once; the example saves it to.env.MockFlow POSTs each event to your address with a
MockFlow-Signatureheader. Check the signature against the raw body.Answer
200at once, then do the work. A failure is retried, so the same event can arrive again: itsidstays the same.Send a test with
POST /webhooks/{webhookId}/testto check the whole path.
Webhooks cover boards being created, renamed, locked, moved, trashed and restored, and people gaining or losing access. They do not fire for each edit to the items on a board.
Run the example
Create an API key in the developer console with the scopes user:read and boards:read. Set PUBLIC_URL to the https address your receiver will have, for example from ngrok http 3000, then:
cp .env.example .env # paste your key and PUBLIC_URL into .env
node setup.js # registers the webhook, saves its secret
node receiver.js # in a second terminal: node setup.js test
The key code
const raw = await readBody(req);
if (!verifySignature(raw, req.headers['mockflow-signature'], SECRET)) return res.writeHead(401).end();
res.writeHead(200).end();
const event = JSON.parse(raw);
if (seen.has(event.id)) return;
seen.add(event.id);
if (event.type === 'board.created') {
await notifySlack(`${event.actor?.email || 'Someone'} started a new board: ${event.data.title} ${event.data.url}`);
}
Adapt it
Project trackers: create a task in Asana or Monday for every new client board.
Compliance: log every share to your audit system with
member.addedandmember.removed.Automation tools: Zapier and Make can subscribe the same way; see Building a Zapier integration.
What you need
An API key with user:read and boards:read to manage webhooks. Every plan.