Plans
Webhooks are part of Darvas Pro+. A Pro+ account can have 15 webhooks on at once. A webhook that is off does not count toward the 15. Darvas Free and Darvas Pro, including Pro through an OKX account opened with Darvas, have no webhooks. When Pro+ ends, your webhooks stop receiving new events and show Paused by plan. You can still read their deliveries and delete them. When Pro+ comes back, they turn on again, oldest first, up to the plan’s limit. A webhook you turned off stays off.Add a webhook
Add a webhook in your Darvas settings:- Open Settings and choose Webhooks.
- Select Add webhook.
- Give the webhook a Name of up to 100 characters, if you like. Without one, the list shows the host of its URL.
- Enter the Endpoint URL, a public
https://address. - Under Events, tick a whole group, such as Alarms, or single event types.
- Select Add webhook, then Copy secret to copy the signing secret,
whsec_....
A test event has
livemode: false, the type of the webhook’s first event and this object:
Events
A webhook receives only the types you choose. An event of your account, such as an alarm’s fire, goes only to your own webhooks. ETF flow updates and data events go to every webhook that subscribes to them.venue.connection_ended counts only connections that end after you add your first webhook with this type, so a new webhook gets no old ends.
Alarm objects
Every alarm event has these fields indata.object:
Each alarm type adds its own fields:
In
alarm.custom_indicator.triggered, alert is the alertcondition() title that fired, alert for an alert() call, or null for a mark.
Other objects
The
reason of venue.connection_ended is expired when the access ran out, and ended when it was revoked or the venue refused the key.
The reason of alarm.paused is one of these:
Deliveries
Each delivery is a POST of this JSON envelope:created is the Unix time in seconds when Darvas stored the event. The request has these headers:
Content-Type: application/jsonUser-Agent: Darvas-Webhook/1.0Darvas-Signature: t=<unix seconds>,v1=<hex>
id to skip an event you have handled.
Verify the signature
v1 is the HMAC-SHA256 of <t>.<raw body> under your signing secret, in hex. Before you trust a delivery:
- Compute the HMAC over the raw body as you received it. A body that you parsed and serialized again does not match.
- Compare it with
v1in constant time. - Refuse a
tthat is more than five minutes away from your clock.
request.get_data() in Flask:
Retries and failures
- A delivery fails when your endpoint does not answer with a 2xx within ten seconds, or cannot be reached.
- Darvas tries a failed delivery again about a minute later, and once more about ten minutes after that. After the third failed attempt, the delivery is marked dead.
- After 50 failed attempts in a row, Darvas turns the webhook off. Fix your endpoint, then turn the webhook on again in settings. Turning it on sets the failure count to 0.
- Darvas keeps events and their deliveries for 30 days.
Endpoint rules
Darvas refuses a URL that breaks one of these rules when you add or change a webhook:- The URL uses
https. - The URL has no user name or password.
- The host is a public name with a dot, not a name that ends in
.local,.internal,.localhost,.testor.invalid. - An IP address host is public. Private, loopback, link-local, shared, documentation, multicast and reserved ranges are refused, for IPv4 and IPv6.
- The URL has at most 2,000 characters, and the name and the URL have no control characters.