What are webhooks?
Webhooks are a way for Yorlet to send real-time notifications to your server about events that happen in your Yorlet account. When an event occurs, Yorlet sends an HTTP POST request to the webhook’s configured URL with a payload of the event data.Use cases
Webhooks are useful for a variety of use cases, such as:- Sending notifications to your server when events are created in your account.
- Updating your database when events occur in your account.
- Triggering actions in thrid party services like Zapier, when events occur in your account.
Events overview
Yorlet generates events for various actions that occur in your account. You can subscribe to specific events to receive notifications about them. For example, you can subscribe to thecustomer.created event to receive a notification when a new customer is created in your account.
See the full list of event types for everything you can subscribe to.
Webhook payloads
Each delivery is an HTTPPOST request with a JSON body describing the event:
| Field | Description |
|---|---|
id | Unique identifier for the event. |
object | Always event. |
created | Time the event was created, as a Unix timestamp (seconds). |
type | The event type, e.g. customer.created. See the full list. |
data.object | The API resource the event relates to, at the time the event occurred. |
data.previous_attributes | For *.updated events, the keys that changed and their previous values. null otherwise. |
request | Details of the API request that triggered the event, including the idempotency_key if one was provided. |
account | Only present on endpoints configured for connected accounts; the ID of the account the event belongs to. |
2xx status code as quickly as possible to acknowledge receipt. Any other status code (or a network error) is treated as a failed delivery and is retried — see Retries.
Securing your webhooks
Because your webhook URL is publicly reachable, you should verify that each request genuinely came from Yorlet before acting on it. Every endpoint has a signing secret that Yorlet uses to sign deliveries, letting you confirm both the authenticity and the freshness of each request.The signing secret
The signing secret is generated automatically when you create an endpoint and begins withwhsec_. It is sensitive and is only returned when you create, retrieve, or roll an endpoint — it is never included in list responses, so store it securely when you first receive it.
The Yorlet-Signature header
When an endpoint has a signing secret, Yorlet includes a Yorlet-Signature header with each delivery:
| Value | Description |
|---|---|
t | The timestamp the signature was generated, in seconds since the Unix epoch. |
v1 | The signature, an HMAC-SHA256 (hex encoded) of the signed payload. |
.:
Verifying signatures
Extract the timestamp and signature
Parse the
Yorlet-Signature header to read the t (timestamp) and v1 (signature) values.Recompute the signature
Concatenate the timestamp, a
., and the raw request body (the exact bytes received — do not parse and re-serialize the JSON first, as that can change the payload). Compute an HMAC-SHA256 of this string using your endpoint’s signing secret as the key, and hex encode it.Compare the signatures
Compare your computed signature with the
v1 value using a constant-time comparison. If they match, the request is authentic.Rolling your signing secret
If a signing secret is ever exposed, roll it to generate a new one. Rolling immediately invalidates the previous secret, so update your endpoint with the new value as soon as you roll it.signing_secret.
Retries
If your endpoint does not return a2xx status code, Yorlet retries the delivery with an exponential backoff over several attempts. Make sure your handler is idempotent: a single event may be delivered more than once, so use the event id to detect and ignore duplicates you have already processed.