viakite
Dashboard

API/Basics/Webhooks

Webhooks

Signed events sent to your server

A webhook is a URL on your server that Viakite calls when something happens, such as an alert firing. Each call is a signed POST of JSON, so you can check it came from Viakite before you act on it. Webhooks belong to the organization; you choose which events each one gets and, optionally, which projects.

Which events are sent today

Today three events are sent: webhook.test, when you test a webhook; alert.fired, when an alert starts alerting or you send its test message; and alert.recovered, when an alert is back to OK. The other event types can be chosen, but nothing sends them yet. Build and test your endpoint now; it starts receiving them as each one ships.

Set one up

  1. Add the webhook

    In the dashboard, open Settings → Webhooks and click New webhook. Enter your URL, pick the event types and, if you want, the projects. Or create it with the API, using a secret key with the org.settings scope:

    terminal
    1curl https://api.vk.viabio.me/v1/orgs/org_…/webhooks \
    2 -H "Authorization: Bearer sk_live_us_…" \
    3 -H "Content-Type: application/json" \
    4 -d '{
    5 "url": "https://example.com/viakite",
    6 "description": "Alerts into our on-call bot",
    7 "event_types": ["alert.fired", "alert.recovered"],
    8 "project_ids": ["prj_…"]
    9 }'
    urlstringrequired
    Where to send events. Must start with https://, up to 2,048 characters. Viakite never sends to private or local addresses.
    event_typesstring[]required
    At least one event type.
    project_idsstring[]
    Only events about these projects, up to 100. Leave it out for every project.
    descriptionstring
    A note for your team, up to 255 characters.
    is_enabledbooleandefault true
    Turn the webhook off without deleting it.
  2. Save the signing secret

    The answer holds the webhook's signing secret, whsec_…, in secret. It is shown only now and when you rotate it, so store it with your server's other secrets.

    response.json
    1{
    2 "id": "whk_…",
    3 "org_id": "org_…",
    4 "url": "https://example.com/viakite",
    5 "description": "Alerts into our on-call bot",
    6 "event_types": ["alert.fired", "alert.recovered"],
    7 "project_ids": ["prj_…"],
    8 "is_enabled": true,
    9 "secret": "whsec_…",
    10 "created_at": "2026-11-19T10:30:00Z",
    11 "updated_at": "2026-11-19T10:30:00Z"
    12}
  3. Verify and answer

    On your server, check the signature against the raw body, then answer with any 2xx status. Do slow work after you answer: each attempt waits at most 10 seconds.

  4. Send a test

    Click Send test on the webhook, or call POST/v1/orgs/{org}/webhooks/{webhook}/test. It sends a webhook.test event whatever the webhook subscribes to, and returns the delivery with your server's answer.

Event types

TypeAreaWhen
alert.firedAlertsAn alert started alerting. Also sent by an alert's test
alert.recoveredAlertsAn alert is back to OK
goal.reachedAnalyticsA goal was completed
project.createdOrganizationA project was created
member.addedOrganizationA member joined the organization
member.removedOrganizationA member was removed
invoice.paidBillingAn invoice was paid
invoice.payment_failedBillingPaying an invoice failed
issue.created, issue.resolved, issue.regressedMonitoringFor Viakite Monitoring, which isn't live yet
release.published, release.rolled_backUpdatesFor Viakite Updates, which isn't live yet

webhook.test is not in the list: every webhook gets it when tested. New types are added over time, so ignore a type you don't handle instead of failing.

Not sent yet

Only webhook.test, alert.fired and alert.recovered are sent today. goal.reached, the organization, billing, Monitoring and Updates events are listed but never sent yet.

A delivery

Each event is one POST to your URL with a JSON body:

body.json
1{
2 "id": "dlv_01JD8Q3W6ZK4M2N7P9R5T1V3X8",
3 "type": "webhook.test",
4 "org_id": "org_…",
5 "created_at": "2026-11-19T10:30:00Z",
6 "data": {
7 "message": "This is a test event from Viakite.",
8 "webhook_id": "whk_…"
9 }
10}
idstringrequired
The delivery's id, dlv_…. The same on every attempt, so use it to skip events you have already handled.
typestringrequired
The event type.
org_idstringrequired
The organization.
project_idstring
The project the event is about. Left out for organization events and tests.
created_atstringrequired
When the event happened, in UTC.
dataobjectrequired
The event's own fields, which depend on its type.

And these headers:

HeaderValue
Content-Typeapplication/json
User-AgentViakite-Webhooks/1
Viakite-EventThe event type, such as alert.fired
Viakite-DeliveryThe delivery's id, dlv_…
Viakite-Signaturet=<unix seconds>,v1=<hex>

Verify the signature

Viakite-Signature holds t, the time the attempt was sent in Unix seconds, and v1, the hex HMAC-SHA256 of <t>.<raw body> keyed with your signing secret. To verify:

  1. Read the raw body as bytes, before any JSON parsing.
  2. Split the header on , and = to get t and v1.
  3. Compute HMAC-SHA256 of t, a ., and the raw body, with the whsec_… secret as the key.
  4. Compare your hex digest with v1 in constant time.
  5. Refuse the request if t is more than 5 minutes from your clock, so an old request can't be replayed.
verify.ts
1import { createHmac, timingSafeEqual } from "node:crypto";
2
3const TOLERANCE_SECONDS = 5 * 60;
4
5export function verify(rawBody: string, header: string, secret: string): boolean {
6 const parts = Object.fromEntries(header.split(",").map((p) => p.split("=") as [string, string]));
7 const t = Number(parts.t);
8 if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;
9
10 const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest();
11 const given = Buffer.from(parts.v1 ?? "", "hex");
12 return given.length === expected.length && timingSafeEqual(given, expected);
13}
14
15// Express: read the raw body for this route only.
16// app.post("/viakite", express.raw({ type: "application/json" }), (req, res) => {
17// if (!verify(req.body.toString("utf8"), req.get("Viakite-Signature") ?? "", process.env.VIAKITE_WEBHOOK_SECRET!)) {
18// return res.sendStatus(400);
19// }
20// const event = JSON.parse(req.body.toString("utf8"));
21// res.sendStatus(204);
22// });
verify.py
1import hashlib
2import hmac
3import time
4
5TOLERANCE_SECONDS = 5 * 60
6
7def verify(raw_body: bytes, header: str, secret: str) -> bool:
8 try:
9 parts = dict(p.split("=", 1) for p in header.split(","))
10 t = int(parts["t"])
11 except (KeyError, ValueError):
12 return False
13 if abs(time.time() - t) > TOLERANCE_SECONDS:
14 return False
15 signed = parts["t"].encode() + b"." + raw_body
16 expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
17 return hmac.compare_digest(expected, parts.get("v1", ""))
18
19# Flask:
20# @app.post("/viakite")
21# def viakite():
22# if not verify(request.get_data(), request.headers.get("Viakite-Signature", ""), os.environ["VIAKITE_WEBHOOK_SECRET"]):
23# abort(400)
24# event = request.get_json()
25# return "", 204
verify.go
1package webhook
2
3import (
4 "crypto/hmac"
5 "crypto/sha256"
6 "encoding/hex"
7 "io"
8 "net/http"
9 "os"
10 "strconv"
11 "strings"
12 "time"
13)
14
15const tolerance = 5 * time.Minute
16
17// Verify checks a Viakite-Signature header against the raw body.
18func Verify(rawBody []byte, header, secret string) bool {
19 var ts, sig string
20 for _, part := range strings.Split(header, ",") {
21 k, v, _ := strings.Cut(part, "=")
22 switch k {
23 case "t":
24 ts = v
25 case "v1":
26 sig = v
27 }
28 }
29 sec, err := strconv.ParseInt(ts, 10, 64)
30 if err != nil || time.Since(time.Unix(sec, 0)).Abs() > tolerance {
31 return false
32 }
33 mac := hmac.New(sha256.New, []byte(secret))
34 mac.Write([]byte(ts + "."))
35 mac.Write(rawBody)
36 given, err := hex.DecodeString(sig)
37 return err == nil && hmac.Equal(given, mac.Sum(nil))
38}
39
40// Handler receives Viakite webhooks.
41func Handler(w http.ResponseWriter, r *http.Request) {
42 body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
43 if err != nil || !Verify(body, r.Header.Get("Viakite-Signature"), os.Getenv("VIAKITE_WEBHOOK_SECRET")) {
44 http.Error(w, "bad signature", http.StatusBadRequest)
45 return
46 }
47 // Parse body and handle the event, then:
48 w.WriteHeader(http.StatusNoContent)
49}

Frameworks that parse JSON for you change the bytes, and the signature no longer matches. Read the raw body for your webhook route.

Retries

Viakite marks a delivery succeeded when your server answers with a 2xx status. Anything else counts as a failure: another status, a timeout after 10 seconds, a connection error, or a redirect, which is not followed.

One send makes up to 3 attempts, half a second apart. If all 3 fail, the delivery is failed. Every attempt is recorded with its status, time taken and error, and the delivery keeps the first 1 KB of your server's last answer.

To send a failed delivery again, open it in the webhook's delivery log and click Send again, or call POST/v1/orgs/{org}/webhooks/{webhook}/deliveries/{delivery}/retry. It sends the same body with the same id, and a new signature with a new t. Only a failed delivery can be retried (409 delivery_not_failed otherwise), and only while the webhook is on (409 webhook_disabled).

Not built yet

There is no retry later. After 3 quick attempts, a failed delivery stays failed until you retry it by hand. A queue that retries with growing waits over hours is planned.

Manage webhooks

All on https://api.vk.viabio.me, with a key that has org.settings:

GET/v1/webhook-event-types lists every event type with its area and description. It answers only a signed-in session, not a key.

Next steps