Skip to content

Webhooks

A webhook endpoint is an address on your servers that PurrCRM posts to when something happens, such as a new contact or a reply.

On Settings › your app › Developers › Webhooks, in the Endpoints card, add an https address and tick the topics it should get. An app can have up to 20 endpoints. Each has its own secret (whsec_…), shown once when you add it; you can make a new one later, and the old one stops at once.

WebhooksWebhooks
Webhooks
TopicWhen
contact.created, contact.updatedIdentify made or changed a contact, or an import did.
contact.unsubscribedSomeone unsubscribed.
contact.taggedA teammate or a workflow put a tag on a contact. When more than 1,000 contacts are tagged at once, they are not posted one by one.
contact.erasedA contact was erased. The post names them by their ids only.
visitor.mergedA website visitor signed in, and was merged into the user.
conversation.started, conversation.replied, conversation.closed, conversation.ratedSomething happened in a conversation.
conversation.assignedA conversation was assigned to a teammate or a team, by a person, a rule or a workflow.
conversation.note_addedA note was added to a conversation. The post never carries the note’s text.
ticket.created, ticket.changedA ticket was opened or moved on.
ticket.state_changed, ticket.field_changedA ticket moved to another state, or one of its fields changed.
ticket.sla_breachedA ticket went past its resolve target.
ticket.resolvedA ticket was resolved.
message.sent, message.opened, message.clickedA message reached someone, was opened, or a link in it tapped.
email.bouncedAn email bounced.
survey.completedSomeone finished a survey.
goal.reachedSomeone reached a message’s goal.
link.clickedA saved link was clicked: one post per link every few seconds, with the clicks by platform. Bots are left out.
link.openedA link opened the app.
app.installed_from_linkThe app was installed from a link.
referral.joined, referral.convertedSomeone joined by a user’s referral link, or did the programme’s reward event.

Press Send test to post a ping at once. The endpoint’s log keeps its last 50 tries: status, response code and how long it took (never the body).

POST /crm-webhooks HTTP/1.1
Content-Type: application/json
X-CRM-Delivery: 3f1c9e4a-...
X-CRM-Signature: t=1760779800,v1=5d41402abc4b2a76b9719d911017c592...
{
"id": "evt_...",
"type": "conversation.replied",
"created_at": "2026-10-18T09:30:00Z",
"app_id": "...",
"data": { "conversation_id": "..." },
"contact": { "id": "...", "external_id": "user-123" }
}

data holds the event’s own details: the ids of the message, conversation or ticket, a link that was tapped, a rating. contact has the person’s ids, and for contact.* topics also display_name, email and language. Nothing else about them, and no secret.

X-CRM-Delivery is the same on every try of one post: use it to handle each once.

X-CRM-Signature is t=<unix seconds>,v1=<hex HMAC-SHA256>, the HMAC of <t>.<raw body> under the endpoint’s secret. Work it out again from the raw body, compare in constant time, and refuse a post more than five minutes old.

Each example is a small server that takes posts at /crm-webhooks on port 3000, reading the endpoint’s secret from an environment variable of your own, CRM_WEBHOOK_SECRET.

webhooks.mjs
// npm install express
import crypto from "node:crypto";
import express from "express";
export function genuine(rawBody, header, 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;
const want = crypto.createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest("hex");
const got = Buffer.from(parts.v1 ?? "", "hex");
return got.length === 32 && crypto.timingSafeEqual(got, Buffer.from(want, "hex"));
}
const app = express();
// Read the raw body: the signature is of the bytes as sent.
app.post("/crm-webhooks", express.raw({ type: "application/json" }), (req, res) => {
if (!genuine(req.body, req.get("X-CRM-Signature") ?? "", process.env.CRM_WEBHOOK_SECRET)) {
return res.sendStatus(401);
}
const event = JSON.parse(req.body);
console.log(req.get("X-CRM-Delivery"), event.type);
res.sendStatus(204);
});
app.listen(3000);

Answer with any 2xx within 10 seconds, and do slow work afterwards.

  • A post that fails is tried 10 times, with growing waits, over about twenty minutes.
  • A 4xx other than 408, 425 and 429, or a redirect, is not tried again.
  • An endpoint whose posts have all failed for 24 hours (at least 5 of them) is switched off, and the workspace’s owners are emailed. One delivered post resets the count; switching it on again starts afresh.

Posts go only to public https addresses, and never follow a redirect.

A workflow can also post to your servers, with the Send a webhook step (Workflows). Those posts are signed the same way, with the app’s own secret under Workflow steps’ signing secret on the same tab. How your server checks a post shows how.

A step posts only to your endpoints’ hosts and the hosts you list under Allowed hosts, one a line, such as hooks.example.com. *.example.com allows any name under example.com.

An API key a step sends in a header is kept under Secrets for workflow steps, so the workflow names it and never holds it.

The other way round, your mail provider posts to PurrCRM: a person’s reply to an email, and bounces and complaints. The Replies by email and bounces card on Settings › your app › Delivery › Email shows the two addresses and the app’s inbound secret. Whatever turns your provider’s post into PurrCRM‘s shape signs it the same way, in X-CRM-Signature.

A reply (POST /public/v1/apps/{key}/inbound-email):

{
"id": "<the provider's message id>",
"to": ["reply+...@replies.northwind.example"],
"from": "ada@example.com",
"subject": "Re: Your order",
"text": "Thanks, that worked!",
"received_at": "2026-10-18T09:30:00Z"
}

A bounce, complaint or delivery (POST /public/v1/apps/{key}/email-events):

{
"id": "<the provider's event id>",
"kind": "bounce",
"message_id": "<the Message-ID of the email>",
"address": "ada@example.com",
"hard": true,
"occurred_at": "2026-10-18T09:30:00Z"
}

kind is bounce, complaint or delivered. A hard bounce or a complaint puts the address on the app’s suppression list. The reference has every field.

Both answer 202 when the post is taken. Any post that isn’t signed right answers 401 with the code unauthorized: a wrong signature, an app key that isn’t one, or an app with no inbound secret yet. Check the address and the secret on the Replies by email and bounces card.

After 60 posts with a wrong signature in a minute from one address, PurrCRM answers 429 for the rest of that minute, with Retry-After (Errors and limits).