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
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.settingsscope:terminal1curl 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}'urlrequiredWhere to send events. Must start withhttps://, up to 2,048 characters. Viakite never sends to private or local addresses.event_typesrequiredAt least one event type.project_idsOnly events about these projects, up to 100. Leave it out for every project.descriptionA note for your team, up to 255 characters.is_enabledTurn the webhook off without deleting it.Save the signing secret
The answer holds the webhook's signing secret,
whsec_…, insecret. It is shown only now and when you rotate it, so store it with your server's other secrets.response.json1{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}Verify and answer
On your server, check the signature against the raw body, then answer with any
2xxstatus. Do slow work after you answer: each attempt waits at most 10 seconds.Send a test
Click Send test on the webhook, or call POST/v1/orgs/{org}/webhooks/{webhook}/test. It sends a
webhook.testevent whatever the webhook subscribes to, and returns the delivery with your server's answer.
Event types
| Type | Area | When |
|---|---|---|
alert.fired | Alerts | An alert started alerting. Also sent by an alert's test |
alert.recovered | Alerts | An alert is back to OK |
goal.reached | Analytics | A goal was completed |
project.created | Organization | A project was created |
member.added | Organization | A member joined the organization |
member.removed | Organization | A member was removed |
invoice.paid | Billing | An invoice was paid |
invoice.payment_failed | Billing | Paying an invoice failed |
issue.created, issue.resolved, issue.regressed | Monitoring | For Viakite Monitoring, which isn't live yet |
release.published, release.rolled_back | Updates | For 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:
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}
dlv_…. The same on every attempt, so use it to skip events you have already handled.And these headers:
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | Viakite-Webhooks/1 |
Viakite-Event | The event type, such as alert.fired |
Viakite-Delivery | The delivery's id, dlv_… |
Viakite-Signature | t=<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:
- Read the raw body as bytes, before any JSON parsing.
- Split the header on
,and=to gettandv1. - Compute HMAC-SHA256 of
t, a., and the raw body, with thewhsec_…secret as the key. - Compare your hex digest with
v1in constant time. - Refuse the request if
tis more than 5 minutes from your clock, so an old request can't be replayed.
1import { createHmac, timingSafeEqual } from "node:crypto";23const TOLERANCE_SECONDS = 5 * 60;45export function verify(rawBody: string, header: string, secret: string): boolean {6const parts = Object.fromEntries(header.split(",").map((p) => p.split("=") as [string, string]));7const t = Number(parts.t);8if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;910const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest();11const given = Buffer.from(parts.v1 ?? "", "hex");12return given.length === expected.length && timingSafeEqual(given, expected);13}1415// 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// });
1import hashlib2import hmac3import time45TOLERANCE_SECONDS = 5 * 6067def verify(raw_body: bytes, header: str, secret: str) -> bool:8try:9parts = dict(p.split("=", 1) for p in header.split(","))10t = int(parts["t"])11except (KeyError, ValueError):12return False13if abs(time.time() - t) > TOLERANCE_SECONDS:14return False15signed = parts["t"].encode() + b"." + raw_body16expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()17return hmac.compare_digest(expected, parts.get("v1", ""))1819# 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
1package webhook23import (4"crypto/hmac"5"crypto/sha256"6"encoding/hex"7"io"8"net/http"9"os"10"strconv"11"strings"12"time"13)1415const tolerance = 5 * time.Minute1617// Verify checks a Viakite-Signature header against the raw body.18func Verify(rawBody []byte, header, secret string) bool {19var ts, sig string20for _, part := range strings.Split(header, ",") {21k, v, _ := strings.Cut(part, "=")22switch k {23case "t":24ts = v25case "v1":26sig = v27}28}29sec, err := strconv.ParseInt(ts, 10, 64)30if err != nil || time.Since(time.Unix(sec, 0)).Abs() > tolerance {31return false32}33mac := hmac.New(sha256.New, []byte(secret))34mac.Write([]byte(ts + "."))35mac.Write(rawBody)36given, err := hex.DecodeString(sig)37return err == nil && hmac.Equal(given, mac.Sum(nil))38}3940// Handler receives Viakite webhooks.41func Handler(w http.ResponseWriter, r *http.Request) {42body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))43if err != nil || !Verify(body, r.Header.Get("Viakite-Signature"), os.Getenv("VIAKITE_WEBHOOK_SECRET")) {44http.Error(w, "bad signature", http.StatusBadRequest)45return46}47// Parse body and handle the event, then:48w.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/orgs/{org}/webhooks lists the organization's webhooks, oldest first. Secrets are never included.
- POST/v1/orgs/{org}/webhooks creates one and returns its secret.
- PATCH/v1/orgs/{org}/webhooks/{webhook} changes its URL, events or projects, or turns it on or off with
is_enabled. Fields you leave out stay as they are. - DELETE/v1/orgs/{org}/webhooks/{webhook} deletes it and its deliveries.
- POST/v1/orgs/{org}/webhooks/{webhook}/rotate-secret makes a new signing secret. The old one stops at once, so update your server right after.
- POST/v1/orgs/{org}/webhooks/{webhook}/test sends a
webhook.testevent now. - GET/v1/orgs/{org}/webhooks/{webhook}/deliveries lists deliveries, newest first, each with its
attempt_log. - POST/v1/orgs/{org}/webhooks/{webhook}/deliveries/{delivery}/retry sends a failed delivery again.
GET/v1/webhook-event-types lists every event type with its area and description. It answers only a signed-in session, not a key.