Configuration
Webhooks are configured per project in the dashboard. You need to set:- Webhook URL — the endpoint on your server that Sublay will call
- Webhook secret — a shared secret used to sign outgoing requests and verify incoming responses
- Subscribed events — the specific event types you want to receive (you only get called for events you opt into)
Event Types
Broadcast Events (Non-blocking)
These fire after an operation completes. Your server is notified but the original operation is not affected by your response.
The
notification.created event is the primary mechanism for bridging Sublay’s in-app notification system to push notifications, email, or any other delivery channel your app uses.
The message.created.complete event’s data carries the message, its sender, the conversationType, and who it’s for: recipientIds lists the conversation’s active members who can see the conversation, other than the sender and anyone who had it open over a real-time connection when the message was sent. In a space chat, recipientIds lists only active members of the space who can see it (visibility), even if someone else still holds an active conversation membership. Muted members are included. recipientIds holds at most 500 ids; totalRecipientCount is the full count.
The entity events’ data (entity.created.complete, entity.updated.complete) carries the entity, with its files (signed links, in order, images with their variants) whenever the files-images bundle is installed, whatever the request asked for.
Every file link in a payload (a File’s originalPath and variant publicPath, a notification’s spaceAvatar) is signed and stops working 24 to 48 hours after the event was sent (File links). Store file ids, and get fresh links from Refresh File Links when you need them.
The space events’ data carries the space’s fields, postingPermission among them: "anyone", "members", or "team" (only the space’s admins and moderators may post).
The comment events’ data — here and in the comment.created / comment.updated validation events below — carries the comment’s fields. A reply names its parent comment in parentCommentId. For a top-level comment it is null, except in the comment.created validation event, which leaves it out unless the request sent null.
Validation Events (Blocking)
These fire before an operation is committed. Sublay waits for your response. If you respond with{ "valid": true }, the operation proceeds. Any other response (or no response) causes the operation to be rejected.
When the project requires email verification before sign-in, the
user.created validation webhook runs on every email/password sign-up, including one for an email that already has an account, where nothing is then created. user.created.complete fires when the account is created at sign-up, before the user has confirmed their email.
If no webhook is configured for your project, or if an event type is not in your subscribed list, all validation webhooks pass automatically — your server does not need to be present for your project to function.
Payload Format
All webhook deliveries use the same envelope:Signature Verification
Every webhook request includes two headers that allow you to verify the request came from Sublay and has not been tampered with.
To verify on your server:
1
Read the headers
Extract
X-Signature and X-Timestamp from the incoming request.2
Recompute the expected signature
Compute:
HMAC-SHA256(webhookSecret, "{timestamp}.{JSON.stringify(body)}") as a hex string, where timestamp is the value from X-Timestamp and body is the raw JSON body.3
Compare using a constant-time comparison
Compare the expected signature to the received
X-Signature. Use a constant-time comparison function to prevent timing attacks.4
Reject if the signatures do not match
Return a non-2xx response. Do not process the request.
Responding to Validation Events
For validation webhooks, your server must respond with a signed JSON body indicating whether the operation should proceed. To allow the operation:400, and its error field carries your message.
Your response must include an X-Response-Signature header:
Common Use Cases
Push Notification Bridge
Subscribe tonotification.created. When your webhook receives it, forward the notification to your push provider (FCM, APNs, Expo, OneSignal, etc.) for the target user.
The data field contains the notification parameters including the recipient user ID, notification type, and any associated entity or comment.
Content Moderation Gate
Subscribe tocomment.created or entity.created (validation events). In your handler, check the content against a blocklist or moderation API. Return { "valid": false } to reject content that fails your rules before it is ever stored.
Audit Logging
Subscribe to broadcast complete events (user.created.complete, entity.created.complete, etc.) to maintain an external audit log or pipe activity into an analytics system or data warehouse.
