Webhooks · Zapier · Make · n8n
Connect Brainy Social to your automations
Brainy Social sends a signed JSON POST to your URL when something happens in a workspace. Use it to add leads to a sheet or CRM, alert a team chat about new WhatsApp messages, or log every published post.
November 19, 2026
Events
Pick the events each webhook receives. Every event has the same envelope: id, type, created_at, workspace_id and data.
- post.published
- A scheduled or instant post went out on a platform (platform, account, caption, permalink, times).
- message.received
- A new chat message reached the inbox: Instagram / Facebook DMs, X DMs, WhatsApp and Telegram chats (sender name and handle, text, time).
- comment.received
- A new comment, mention or Google review reached the inbox (same fields, plus the post link).
- lead.created
- Someone sent the contact form on a link-in-bio page (name, email or phone, message, UTM source).
Add a webhook in Brainy
- Open your workspace → gear menu → Integrations & webhooks (owners and admins).
- Paste the URL your tool gives you (https only, on a public address, port 443).
- Tick the events to send and save. Copy the signing secret — it is shown once.
- Press “Send test” to send a sample event and map its fields in your tool.
Zapier
- Create a Zap with the trigger “Webhooks by Zapier” → “Catch Hook”.
- Copy the custom webhook URL and add it in Brainy with the events you want.
- In Brainy press “Send test”, then “Test trigger” in Zapier: the sample fields appear under data.
- Add your actions (Google Sheets, HubSpot, Slack…) and turn the Zap on.
Make
- Add the module “Webhooks” → “Custom webhook” and create a new webhook.
- Copy its address into Brainy, then press “Send test” so Make learns the data structure.
- Connect the next modules and switch the scenario on (scheduling: immediately).
n8n
- Add a “Webhook” node with HTTP method POST and respond “Immediately”.
- Activate the workflow and copy the Production URL (the test URL only works while the editor listens).
- Add it in Brainy and press “Send test”. To check signatures, add a Code node with the snippet below and the raw body.
Delivery and retries
- Brainy waits up to 10 seconds for an answer. Any 2xx counts as delivered; redirects are not followed.
- Otherwise it retries after 1 min, 5 min, 30 min, 2 h, 6 h and 12 h (7 attempts in total), then gives up. You can send a delivery again from the Integrations page.
- Answer 410 Gone to unsubscribe: the webhook is turned off at once. After 20 failures in a row it is turned off too.
- Deliveries can arrive more than once or out of order: use the event id (also in X-Brainy-Event-Id) to skip duplicates.
Headers
X-Brainy-Event
X-Brainy-Event-Id
X-Brainy-Delivery
X-Brainy-Timestamp
X-Brainy-SignatureExample body
{
"id": "1c7e5b8a-0000-4000-8000-00000000e001",
"type": "comment.received",
"created_at": "2026-12-20T11:15:03Z",
"workspace_id": "6f1c2a9e-0000-4000-8000-000000000000",
"data": {
"thread_id": "6f1c2a9e-0000-4000-8000-0000000000c1",
"message_id": "6f1c2a9e-0000-4000-8000-0000000000c2",
"platform_message_id": "18000000000000000",
"platform": "facebook",
"kind": "comment",
"account_id": "6f1c2a9e-0000-4000-8000-0000000000a3",
"account_name": "Brainy Demo Store",
"from_name": "Hany Mostafa",
"from_handle": null,
"text": "عندكم فرع في المعادي؟",
"sent_at": "2026-12-20T11:15:00Z",
"post_permalink": "https://www.facebook.com/EXAMPLE"
}
}Check the signature
X-Brainy-Signature is t=<unix seconds>,v1=<hex>, where v1 = HMAC-SHA256 of <t>.<raw body> with your signing secret. Compute it over the exact bytes you received and reject timestamps older than five minutes.
Node.js
import { createHmac, timingSafeEqual } from "node:crypto";
// rawBody = the exact bytes you received (before JSON.parse)
export function verifyBrainy(rawBody, header, secret = process.env.BRAINY_WEBHOOK_SECRET) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const t = Number(parts.t);
if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false; // replay window
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
const given = Buffer.from(parts.v1 ?? "", "hex");
return given.length === expected.length && timingSafeEqual(given, expected);
}Python
import hmac, hashlib, time
def verify_brainy(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
t = int(parts.get("t", "0"))
if abs(time.time() - t) > 300:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))REST endpoints for tools
Apps can manage their own subscriptions (REST hooks) and poll events with a publish-scope API key from AI & MCP → API keys, as an owner or admin. Same base URL, auth and limits as the publishing API.
POST /api/v1/webhooks{url, events, description?} — subscribe; the answer holds the secret once.GET /api/v1/webhooks— list;DELETE /api/v1/webhooks/{id}— unsubscribe.GET /api/v1/events?type=&since=&limit=— recent events, newest first (kept 30 days), for polling triggers.- Everything else — accounts, posts, media, metrics — is in the developer docs.
TOKEN=bsk_EXAMPLE_not_a_real_token
API=https://brainy-social.com/api/v1
# Subscribe (REST hooks). The secret is in the answer, once.
curl -s -X POST "$API/webhooks" -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"url": "https://hooks.example.com/brainy", "events": ["lead.created"]}'
# Unsubscribe
curl -s -X DELETE "$API/webhooks/<id>" -H "Authorization: Bearer $TOKEN"
# Polling trigger: newest events first, only newer than the last one you saw
curl -s "$API/events?type=message.received&since=2026-12-20T00:00:00Z" -H "Authorization: Bearer $TOKEN"Limits
- Up to 10 webhooks per workspace. Webhooks are part of the Growth plan and up.
- Events are kept 30 days. Text in events is clipped (4,000 characters for messages, 2,000 for captions).
- Webhooks only send what the workspace already has; nothing about other workspaces.