Webhooks
Webhooks
Sublaunch sends an HTTPS request to your server the moment a member joins, cancels or leaves, a payment goes through, a lead leaves an email, a post or a comment goes up, or an affiliate joins, signed so you know it comes from us.
Set up an endpoint
Add an endpoint on the Sublaunch's API page in the app, or with Create a webhook endpoint. Give it a public HTTPS URL and the event types you want, and keep the secret it returns to verify signatures.
- HTTPS only, on port 443 or 8443, no credentials in the URL, and no private, loopback or link local address.
- Up to 10 endpoints per Sublaunch.
filters.tier_idslimits the member and payment events an endpoint gets to the members of some tiers. An event with no tier, like a lead or a post, always goes through.- Send a test event to check your server before real events arrive.
Webhooks come with the Business and Premium plans. If the Sublaunch's owner moves to a lower plan, its endpoints are kept but send nothing until the owner is back on Business or Premium.
curl -X POST https://api.sublaunch.com/v1/webhook_endpoints \
-H "Authorization: Bearer $SUBLAUNCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/sublaunch",
"events": ["member.joined", "payment.succeeded"],
"description": "CRM sync",
"filters": {
"tier_ids": ["tier1"]
}
}'Event types
Every event has the same envelope. Its data depends on its type.
| Type | Sent when |
|---|---|
member.joined | A membership becomes active, a new member paid or free. Each membership sends it once. |
member.left | An active membership ends, its status now canceled. Each membership sends it once. |
subscription.canceled | A member asks to cancel. Their membership still runs until cancel_at. |
payment.succeeded | A member's payment goes through. Each payment sends it once. |
lead.created | A free lead magnet or a form of the Sublaunch collects a new email. |
post.published | A post goes up in the Sublaunch's Community, by its creator or a member. |
comment.created | Someone comments a post of the Community, or replies to a comment. |
affiliate.joined | Someone joins the Sublaunch's affiliate program. |
The event object
- idstringUnique identifier for the event,
evt_and 24 characters. Also in theSublaunch-Event-Idheader. - objectstringAlways
event. - typestringThe event type.
member.joinedmember.leftsubscription.canceledpayment.succeededlead.createdpost.publishedcomment.createdaffiliate.joined - created_atstringWhen the event happened, ISO 8601.
- sublaunch_idstringThe Sublaunch it happened on.
- dataobjectThe event's content, its
objectfirst. A test event hastestset totruein it.
member.joined
A membership becomes active, a new member paid or free. Each membership sends it once.
Data
- objectobjectThe member, as Retrieve a member returns it.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "member.joined",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Ms8kL2QpXz",
"object": "member",
"email": "sam@example.com",
"name": "Sam Carter",
"first_name": "Sam",
"last_name": "Carter",
"user_id": "Us4kP9xQ2M",
"status": "active",
"type": "recurring",
"tier": {
"id": "tier1",
"name": "Inner Circle"
},
"price": {
"id": "pR8sK2xLmQ",
"amount": 29,
"currency": "usd",
"interval": "month"
},
"payments_count": 3,
"joined_at": "2026-09-02T18:41:07.000Z",
"cancel_at": null,
"canceled_at": null,
"affiliate_id": null
}
}
}member.left
An active membership ends, its status now canceled. Each membership sends it once.
Data
- objectobjectThe member, with
canceled_at.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "member.left",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Ms8kL2QpXz",
"object": "member",
"email": "sam@example.com",
"name": "Sam Carter",
"first_name": "Sam",
"last_name": "Carter",
"user_id": "Us4kP9xQ2M",
"status": "canceled",
"type": "recurring",
"tier": {
"id": "tier1",
"name": "Inner Circle"
},
"price": {
"id": "pR8sK2xLmQ",
"amount": 29,
"currency": "usd",
"interval": "month"
},
"payments_count": 3,
"joined_at": "2026-09-02T18:41:07.000Z",
"cancel_at": null,
"canceled_at": "2026-11-17T09:30:00.000Z",
"affiliate_id": null
}
}
}subscription.canceled
A member asks to cancel. Their membership still runs until cancel_at.
Data
- objectobjectThe member, with
cancel_at. - reasonstring or nullWhy they canceled, when they said it.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "subscription.canceled",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Ms8kL2QpXz",
"object": "member",
"email": "sam@example.com",
"name": "Sam Carter",
"first_name": "Sam",
"last_name": "Carter",
"user_id": "Us4kP9xQ2M",
"status": "active",
"type": "recurring",
"tier": {
"id": "tier1",
"name": "Inner Circle"
},
"price": {
"id": "pR8sK2xLmQ",
"amount": 29,
"currency": "usd",
"interval": "month"
},
"payments_count": 3,
"joined_at": "2026-09-02T18:41:07.000Z",
"cancel_at": "2026-12-02T18:41:07.000Z",
"canceled_at": null,
"affiliate_id": null
},
"reason": "Too expensive"
}
}payment.succeeded
A member's payment goes through. Each payment sends it once.
Data
- objectobjectThe payment, with your share in
amount_creator.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "payment.succeeded",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "In7pQ2xKLm",
"object": "payment",
"amount": 29,
"currency": "usd",
"amount_creator": 26.1,
"status": "paid",
"type": "subscription",
"member_id": "Ms8kL2QpXz",
"email": "sam@example.com",
"tier_id": "tier1",
"affiliate_id": null,
"paid_at": "2026-11-02T18:41:09.000Z"
}
}
}lead.created
A free lead magnet or a form of the Sublaunch collects a new email.
Data
- objectobjectThe lead.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "lead.created",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Ld3xQ8mKpR",
"object": "lead",
"email": "alex@example.com",
"first_name": "Alex",
"last_name": null,
"phone": null,
"source": "lead_magnet",
"lead_magnet_id": "lm2K9x",
"fields": [
{
"name": "Experience",
"value": "Two years"
}
],
"created_at": "2026-11-16T08:11:05.000Z"
}
}
}post.published
A post goes up in the Sublaunch's Community, by its creator or a member.
Data
- objectobjectThe post, as Retrieve a post returns it.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "post.published",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Pt9xK3mQ2L",
"object": "post",
"title": "Weekly outlook",
"text": "Three levels I watch this week on the S&P.\n\nCharts below, questions welcome.",
"category_id": "x7Lp2QaZ",
"access": "members",
"price": null,
"pinned": true,
"comments_off": false,
"author_id": null,
"by_creator": true,
"media": [
{
"kind": "image",
"url": "https://example.com/weekly-chart.png"
}
],
"attachments": [],
"poll": null,
"likes": 48,
"comments_count": 12,
"status": "published",
"url": "https://sublaunch.com/alphadesk/community/weekly-outlook",
"published_at": "2026-11-15T17:02:40.000Z",
"updated_at": "2026-11-16T08:11:05.000Z"
}
}
}comment.created
Someone comments a post of the Community, or replies to a comment.
Data
- objectobjectThe comment.
{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "comment.created",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Cm2kX8pQ7R",
"object": "comment",
"post_id": "Pt9xK3mQ2L",
"parent_id": null,
"text": "Thanks, the 4 hour chart helps a lot.",
"author_id": "Us4kP9xQ2M",
"likes": 3,
"status": "published",
"created_at": "2026-11-15T18:20:13.000Z"
}
}
}{
"id": "evt_8kQ2vXr4LmT9wPz1Hc6YbN3d",
"object": "event",
"type": "affiliate.joined",
"created_at": "2026-11-17T09:30:00.000Z",
"sublaunch_id": "q7RkX2LmPv",
"data": {
"object": {
"id": "Af6tR2kQxM",
"object": "affiliate",
"user_id": "Us7mQ2kX9P",
"code": "482913",
"commission_rate": 30,
"status": "active",
"members_active": 0,
"members_total": 0,
"joined_at": "2026-11-17T09:30:00.000Z"
}
}
}Delivery
Sublaunch sends each event as a JSON POST and waits 10 seconds for your answer. Any 2xx counts as delivered. A redirect, any other status, a timeout or a connection error counts as a failure, and the event is retried.
| Header | Value |
|---|---|
Sublaunch-Signature | The timestamp and the signature, t=1763371800,v1=5f2b... |
Sublaunch-Event-Id | The event's id, to skip events you already handled. |
Sublaunch-Event-Type | The event's type. |
User-Agent | Sublaunch-Webhooks/1.0 |
POST /webhooks/sublaunch HTTP/1.1
Content-Type: application/json; charset=utf-8
User-Agent: Sublaunch-Webhooks/1.0
Sublaunch-Event-Id: evt_8kQ2vXr4LmT9wPz1Hc6YbN3d
Sublaunch-Event-Type: member.joined
Sublaunch-Signature: t=1763371800,v1=58ca5e964b92d617c979d3f067cdc2035a1a1a9d3f848d7d927c2db09b8e9baaVerify signatures
Anyone can send a request to your URL. Check that each one comes from Sublaunch before you trust it.
- Read the raw body as bytes, before any JSON parsing. Parsing and writing it again changes the bytes.
- Split the
Sublaunch-Signatureheader on commas.tis a Unix time in seconds,v1the signature. - Compute the HMAC SHA256 of
t, a dot and the raw body, keyed with the endpoint's whole secret,whsec_included, and write it in hex. - Compare it to each
v1in constant time. - Refuse a
tmore than 5 minutes away from your clock, so an old request cannot be replayed. Each retry is signed with a fresht.
Answer 400 when the check fails. Keep the secret in an environment variable like SUBLAUNCH_WEBHOOK_SECRET.
const crypto = require("crypto");
const express = require("express");
// rawBody: the request body exactly as received, before any JSON parsing.
function verifySublaunchSignature(rawBody, header, secret, toleranceSeconds = 300) {
if (typeof header !== "string") return false;
let timestamp = null;
const signatures = [];
for (const part of header.split(",")) {
const [key, value] = part.split("=", 2).map((s) => (s || "").trim());
if (key === "t") timestamp = value;
if (key === "v1" && value) signatures.push(value);
}
if (!/^\d+$/.test(timestamp || "") || signatures.length === 0) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;
const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest();
return signatures.some((signature) => {
const given = Buffer.from(signature, "hex");
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
});
}
const app = express();
// The body must stay raw on this route.
app.post("/webhooks/sublaunch", express.raw({ type: "application/json" }), (req, res) => {
const ok = verifySublaunchSignature(
req.body,
req.get("Sublaunch-Signature"),
process.env.SUBLAUNCH_WEBHOOK_SECRET,
);
if (!ok) return res.status(400).send("Invalid signature");
const event = JSON.parse(req.body.toString("utf8"));
// Already handled? Skip it, retries send the same event.id again.
if (event.type === "member.joined") {
// event.data.object is the new member
} else if (event.type === "payment.succeeded") {
// event.data.object is the payment
} else if (event.type === "subscription.canceled") {
// event.data.object is the member, event.data.reason why they canceled
}
res.sendStatus(200);
});
app.listen(3000);Retries
When a delivery fails, Sublaunch tries again 7 times, each time after a longer wait. After the 8th attempt, about 45 hours after the first, the delivery is marked failed.
| Attempt | Sent |
|---|---|
| 1 | Right away |
| 2 | 1 minute after the previous failure |
| 3 | 5 minutes after the previous failure |
| 4 | 30 minutes after the previous failure |
| 5 | 2 hours after the previous failure |
| 6 | 6 hours after the previous failure |
| 7 | 12 hours after the previous failure |
| 8 | 24 hours after the previous failure |
An endpoint that fails for 3 days in a row, with at least 8 failed attempts, is disabled. Its status turns to disabled, its disabled_reason to failing, and the deliveries still waiting end as failed. Fix your server, then turn it back on in the app or with Update a webhook endpoint. The count starts again at the first delivery your server accepts. Test events are sent once and never count toward it.
List deliveries shows each attempt's status code and error, to see what your server answered.
Best practices
- Answer 2xx within 10 seconds, then do the work in a queue.
- Delivery is at least once. Use the event
id, also inSublaunch-Event-Id, to skip an event you already handled. - Events can arrive out of order. Compare
created_at, or fetch the member again for their latest state. - Verify every signature and refuse old timestamps.
- Rolling the secret replaces it at once. Deploy the new one right after, deliveries that fail meanwhile are retried and signed with it.
- Events and deliveries are kept 30 days.