A study's owner and its analysts add webhooks in the study's Settings, on the Collection tab, under Send each response to another system.
Add a webhook
- Type your endpoint's address. It must start with
https://. - Choose Add the webhook.
- Copy the signing secret with the Copy button beside it.
The secret is shown once. Keep it where your endpoint can read it, such as an environment variable. If you lose it, delete the webhook and add it again.
An address on a private network, or one that points back at the platform's own network, is refused.
What arrives
Each new response in the study is sent to your address as a POST with a JSON body like this one.
{
"event": "response.created",
"deliveredAt": "2026-10-09T08:15:02+03:00",
"project": { "id": "prj_ward_services", "name": "Ward services" },
"survey": { "id": "sv_ward_services", "title": "Ward services", "version": 3 },
"response": {
"id": "sr_x81kd0qpaz",
"submittedAt": "2026-10-09T08:15:00+03:00",
"channel": "web",
"language": "sw",
"ward": "Kariobangi North",
"answers": { "q1": "yes", "q2": ["water", "roads"] }
}
}
Three headers come with it.
X-Takwimu-Eventnames the event:response.created,response.updatedfor a correction, orwebhook.testfor a test.X-Takwimu-Deliveryis the delivery's id. A retry of the same delivery carries the same id, so your system can tell a retry from a new delivery.X-Takwimu-Signatureissha256=followed by the signature.
When a response is corrected
The study owner or an analyst can correct a response after it arrives. Each correction is sent as a response.updated event. Its response holds the answers as that correction left them, whole, with the same id as before, and an edit block says which version the correction is and which answers it changed.
{
"event": "response.updated",
"response": { "id": "sr_x81kd0qpaz", "answers": { "q1": "no", "q2": ["water", "roads"] } },
"edit": { "version": 1, "editedAt": "2026-10-12T10:04:00+03:00", "changed": ["q1"] }
}
The other fields are as above, shortened here. Store responses by response.id and replace the answers when a correction arrives. A delivery that arrives late carries its own version, so keep the highest edit.version you have seen.
Answers are keyed by question id and go out as an analyst sees them, with contact details withheld. Pilot responses are not sent.
Check the signature
The signature is the hex HMAC-SHA256 of the raw body, made with your secret. Compute the same over the exact bytes you received and compare the two. Parse the JSON only once they match. Since deliveredAt is inside the signed body, you can also refuse a delivery that is too old.
In PHP:
<?php
$secret = getenv('TAKWIMU_WEBHOOK_SECRET');
$body = file_get_contents('php://input');
$expected = 'sha256=' . hash_hmac('sha256', $body, $secret);
$given = $_SERVER['HTTP_X_TAKWIMU_SIGNATURE'] ?? '';
if (! hash_equals($expected, $given)) {
http_response_code(401);
exit;
}
$event = json_decode($body, true);
// Store $event['response'] by its id, replacing it when a response.updated arrives.
http_response_code(200);
In JavaScript, with Node and Express:
import crypto from "node:crypto";
import express from "express";
const app = express();
app.post("/takwimu", express.raw({ type: "application/json" }), (req, res) => {
const expected =
"sha256=" +
crypto.createHmac("sha256", process.env.TAKWIMU_WEBHOOK_SECRET).update(req.body).digest("hex");
const given = req.get("X-Takwimu-Signature") ?? "";
const matches =
given.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
if (!matches) return res.sendStatus(401);
const event = JSON.parse(req.body.toString("utf8"));
// Store event.response by its id, replacing it when a response.updated arrives.
res.sendStatus(200);
});
Read the body raw. A framework that parses the JSON first and writes it out again changes the bytes, and the signature will not match.
Test it
Choose Send a test. A webhook.test event goes to your endpoint straight away, signed like any other, and the screen says what your endpoint answered.
When your endpoint fails
Answer with a 2xx status within ten seconds to accept a delivery. Anything else is a failure. That includes another status, no answer, a redirect and an address that no longer points at the public internet.
A failed delivery is tried again after one minute. If that fails, it is tried after five more minutes, and then after thirty more. After twenty failures in a row the webhook turns itself off and the screen says why. Turn it back on once your endpoint is fixed.
Recent deliveries, under each webhook, lists the last five attempts and what came back. Delivery records are kept for thirty days.
A response to an encrypted questionnaire is never sent. Its answers are sealed with a key only the study owner holds, so there is nothing to send. See Encrypt a questionnaire.
A respondent never waits for your endpoint. Each delivery is sent after the response is stored, and a failure at your end does not touch the response.