Included in Plus
Webhooks
Survey webhooks, signed and retried.
UserLoop posts a signed JSON event to your URL the moment a customer answers, a submission completes or a score comes in low. Your systems hear about it without polling.
Read the docsWhat is a survey webhook?
A survey webhook is an HTTP POST that UserLoop sends to a URL of yours when something happens to a survey or a response. You add an endpoint, choose from 6 events and keep its signing secret. Each event is JSON, signed with HMAC-SHA256 in the UserLoop-Signature header, tried up to 10 times and kept in a 90 day delivery log you can resend from.
- Events
- response.new, response.completed, response.updated, response.low_score, survey.published, survey.unpublished
- Signature
- UserLoop-Signature: t=<Unix seconds>,v1=<HMAC-SHA256 hex>
- Delivery
- At least once, 10 attempts, 10 seconds to answer
- Plan
- Plus, with up to 20 endpoints
How it works
Receiving events in three steps
01
Add an endpoint
In the dashboard, open Integrations, then Webhooks, and select Add endpoint. Or call POST /webhooks. Enter an https URL and tick the events and surveys it should get.
02
Keep the secret
The signing secret starts whsec_ and is shown once. Store it where your receiver can read it. A webhook.test event is sent to the URL straight away.
03
Verify, then answer
Check the signature against the raw body, store the event and answer with a 2xx within 10 seconds. Do the slow work after you have answered.
Events
The 6 events and when each fires
Each endpoint picks its own events. An event reaches only the endpoints that chose it, and only for the surveys they chose.
- response.new
- Each answer to a question, as it arrives, before the customer has finished. data holds that one answer, with final set to true on the survey's last answer.
- response.completed
- The submission settles: 15 seconds after its final answer, 90 seconds after its latest answer, and at most 15 minutes after its first. data holds the whole submission, as GET /responses/{response_id} returns it.
- response.updated
- More answers arrive after the submission settled. data holds the whole submission so far and a generation counter: 1 for the first update, then 2.
- response.low_score
- Sent with response.completed when a number score is low: 0 to 6 on an NPS question, else the bottom quarter of the scale. data holds the whole submission and low_score, with the question_id and the score.
- survey.published
- A survey goes live, or its live version is replaced. data holds the survey and its version.
- survey.unpublished
- A live survey is unpublished, switched off, archived or deleted. data holds the survey, with deleted set to true when it was deleted.
Payload
What an event looks like on the wire
Six headers and one JSON envelope: id, type, api_version, created_at, organisation_id and data. The first tab is a complete low score event.
POST /userloop HTTP/1.1
Host: hooks.example.com
Content-Type: application/json
User-Agent: UserLoop-Webhooks/1
UserLoop-Event: response.low_score
UserLoop-Event-Id: evt_3b9e2d7f0a6c4851b2e9d4f7a0c3e6b1
UserLoop-Delivery: kx72m9c4q1w8r3t6y0n5v2b7h4j9f1d6
UserLoop-Signature: t=1794391453,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
{
"id": "evt_3b9e2d7f0a6c4851b2e9d4f7a0c3e6b1",
"type": "response.low_score",
"api_version": "v1",
"created_at": "2026-11-11T10:04:11.000Z",
"organisation_id": "org_2xK9pQ7mT3vN8bR1",
"data": {
"response_id": "3f9c1a7e5b2d48c6a0e1f7b9d3c5a8e2f4b6d8a0c2e4f6a8b0d2c4e6f8a0b2c4",
"survey": { "public_id": "Nq8XcT2w", "title": "Post-purchase survey" },
"received_at": "2026-11-11T10:04:11.000Z",
"started_at": "2026-11-11T10:03:40.000Z",
"channel": "thank_you",
"customer": { "name": "E. L.", "email": "em**@ex*****.com", "masked": true },
"order": {
"order_id": "5839201847361",
"order_number": 1042,
"total": 84.2,
"currency": "USD",
"products": ["House Blend 1 kg", "Pour-over kit"]
},
"attribution": { "source": "tiktok", "medium": "social" },
"answers": [
{
"question_id": "Tm7wL2cN",
"question": "How likely are you to recommend us to a friend?",
"type": "number_score",
"score": 3
},
{
"question_id": "Kd4vR8sJ",
"question": "What could we do better?",
"type": "open_ended",
"answer": ["The bag arrived torn and half the beans were gone."]
}
],
"low_score": { "question_id": "Tm7wL2cN", "score": 3 }
}
}{
"id": "evt_8c2f5a1d9b3e47f6a0d4c7e1b5f9a2d3",
"type": "response.new",
"api_version": "v1",
"created_at": "2026-11-11T10:03:40.000Z",
"organisation_id": "org_2xK9pQ7mT3vN8bR1",
"data": {
"response_id": "3f9c1a7e5b2d48c6a0e1f7b9d3c5a8e2f4b6d8a0c2e4f6a8b0d2c4e6f8a0b2c4",
"survey": { "public_id": "Nq8XcT2w", "title": "Post-purchase survey" },
"received_at": "2026-11-11T10:03:40.000Z",
"final": false,
"answer": {
"question_id": "Tm7wL2cN",
"question": "How likely are you to recommend us to a friend?",
"type": "number_score",
"score": 3
}
}
}# Needs reports:write, and responses:read when it gets response events
curl https://app.userloop.io/api/v1/webhooks \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://hooks.example.com/userloop",
"events": ["response.completed", "response.low_score"],
"completed_only": true,
"description": "Support desk"
}'
# 201 Created. The signing secret is in this answer and nowhere else.
# {
# "webhook": { "id": "jd7c4x9m2q8w1r5t3y6n0v4b8h2k7f1p", "status": "active", ... },
# "secret": "whsec_...",
# "existing": false
# }# Post a signed webhook.test event and see how your receiver answered
curl -X POST https://app.userloop.io/api/v1/webhooks/WEBHOOK_ID/test \
-H "Authorization: Bearer $USERLOOP_API_KEY"
# { "ok": true, "status": 200, "duration_ms": 84, "error": null,
# "event_id": "evt_6f1d0b9a3c7e45d28b4a9e0c1f7d3b52" }
# Recent real events in the exact envelope, for mapping fields
curl "https://app.userloop.io/api/v1/webhooks/samples/response.completed?limit=3" \
-H "Authorization: Bearer $USERLOOP_API_KEY"
# A new secret, returned once. Both secrets sign for the next 24 hours.
curl -X POST https://app.userloop.io/api/v1/webhooks/WEBHOOK_ID/roll-secret \
-H "Authorization: Bearer $USERLOOP_API_KEY"Receive it properly
Verify every event, and expect it twice
Delivery is at least once and in no guaranteed order. A receiver that checks the signature and deduplicates on the event ID handles every case.
Signature
Verify the signature before you trust an event
The signature proves the event came from UserLoop, that the body was not changed on the way and that it is not an old event sent again.
What is signed. The timestamp t, a full stop, then the raw body. The key is the whole secret as text, whsec_ included. v1 is the HMAC-SHA256 as 64 hex characters.
Use the raw bytes. Parsing JSON and writing it out again changes spacing and key order, and the check fails. Verify first, parse second.
Reject old timestamps. Refuse an event whose t is more than 300 seconds from your clock. Each retry is signed afresh, so a genuine retry passes.
Compare every v1. For 24 hours after a secret is rolled the header has two v1 values. The event is genuine when either matches.
import { createHmac, timingSafeEqual } from "node:crypto";
const TOLERANCE_SECONDS = 300;
/**
* Checks a UserLoop webhook's signature.
* rawBody: the request body exactly as received (a Buffer or string), before any JSON parsing.
* header: the UserLoop-Signature header.
* secrets: the endpoint's signing secret, or a list of them while you switch after a roll.
*/
export function verifyUserLoopSignature(rawBody, header, secrets, now = Math.floor(Date.now() / 1000)) {
if (typeof header !== "string") return false;
let timestamp = null;
const signatures = [];
for (const part of header.split(",")) {
const at = part.indexOf("=");
if (at <= 0) continue;
const key = part.slice(0, at).trim();
const value = part.slice(at + 1).trim();
if (key === "t" && /^\d{1,12}$/.test(value)) timestamp = Number(value);
else if (key === "v1" && /^[0-9a-f]{64}$/i.test(value)) signatures.push(Buffer.from(value, "hex"));
}
if (timestamp === null || signatures.length === 0) return false;
if (Math.abs(now - timestamp) > TOLERANCE_SECONDS) return false;
const body = Buffer.isBuffer(rawBody) ? rawBody : Buffer.from(rawBody, "utf8");
for (const secret of [secrets].flat()) {
const expected = createHmac("sha256", secret).update(`${timestamp}.`).update(body).digest();
if (signatures.some((signature) => timingSafeEqual(signature, expected))) return true;
}
return false;
}import { createServer } from "node:http";
import { verifyUserLoopSignature } from "./verify.mjs";
const SECRET = process.env.USERLOOP_WEBHOOK_SECRET; // whsec_...
const seen = new Set(); // use your database in production
createServer((req, res) => {
if (req.method !== "POST") {
res.writeHead(405).end();
return;
}
const chunks = [];
req.on("data", (chunk) => chunks.push(chunk));
req.on("end", () => {
const rawBody = Buffer.concat(chunks);
if (!verifyUserLoopSignature(rawBody, req.headers["userloop-signature"], SECRET)) {
res.writeHead(400).end("Invalid signature");
return;
}
const event = JSON.parse(rawBody.toString("utf8"));
res.writeHead(200).end(); // answer first, then do the work
if (seen.has(event.id)) return;
seen.add(event.id);
console.log(event.type, event.data);
});
}).listen(3000);// Give the webhook route the raw body, not the JSON parser
app.post("/userloop", express.raw({ type: "application/json" }), (req, res) => {
if (!verifyUserLoopSignature(req.body, req.get("UserLoop-Signature"), process.env.USERLOOP_WEBHOOK_SECRET)) {
return res.status(400).send("Invalid signature");
}
const event = JSON.parse(req.body.toString("utf8"));
res.sendStatus(200);
// handle event
});# A made-up secret, to test your own function with
Secret whsec_test_secret_for_docs_only
Body {"id":"evt_test","type":"webhook.test"}
Header t=1762178531,v1=c8fee1a46097e81266f900c90c50b043252410999447ab2f38938802b1aa3e7d
# Must return true when now is 1762178531.
# Must return false when now is more than 300 seconds away,
# or when one character of the body changes.Retries and duplicates
Store each event once, whatever arrives
An event can reach you more than once: your answer was slow or lost, an admin selected Resend, or two of your endpoints chose it. Every copy has the same event ID.
10 attempts. After a failure the wait doubles, starting at about a minute, with some randomness. First attempt to last takes roughly 4 to 9 hours.
What counts as delivered. A 2xx within 10 seconds. Any other status is a failure and is retried, including a 3xx: redirects are never followed.
Do not rely on order. A retried event arrives after later ones. Keep the copy of a submission with the highest generation, and treat response.completed as generation 0.
Three days of failure. An endpoint with no successful delivery for 3 days is turned off and admins get one email. Events are skipped while it is off, so read those days back through the API.
CREATE TABLE userloop_events (
id TEXT PRIMARY KEY, -- evt_...
type TEXT NOT NULL,
received_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- For each verified event: handle it only when this inserts a row.
INSERT INTO userloop_events (id, type) VALUES ($1, $2)
ON CONFLICT (id) DO NOTHING;# Your receiver was off from 3 to 5 November. Events from then were
# skipped, not saved, so read those days back through the API.
curl -G https://app.userloop.io/api/v1/responses \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
--data-urlencode "from=2026-11-03" \
--data-urlencode "to=2026-11-05" \
--data-urlencode "limit=50"What people build
Three things a response can set off
The event already holds the answers, the customer and the order, so most receivers need no second request.
response.low_score
Alert someone when a score is low
Subscribe one endpoint to response.low_score and every detractor reaches your on-call tool, your help desk or a channel, with the order and what they wrote.
No threshold to code. UserLoop decides what low means: 0 to 6 on NPS, the bottom quarter of any other scale. low_score names the question and the score.
Finished answers only. Tick Completed submissions only and the event waits for customers who reached the last question.
Without code. If the alert only has to reach Slack, the Slack integration posts low scores to a channel with a mention.
response.completed
Wake an agent with no chat window
A webhook is how feedback reaches an agent that runs on its own. The event arrives, the agent reads it and acts through the API or the MCP server.
An event in. A low score opens a draft reply for your support team. A completed submission updates a customer record.
An action out. The same response_id opens the submission with GET /responses/{response_id}, or get_response over MCP.
Customer text is data. Treat what a customer wrote as something to read, never as instructions for the agent to follow.
No-code tools
The trigger behind Zapier, Make and n8n
Each of these apps subscribes as a webhook endpoint of its own, so a Zap, a scenario or a workflow starts from the same events your code would get.
Listed with the rest. Endpoints added by Zapier, Make or n8n show on the Webhooks page with their source, and have the same delivery log.
They unsubscribe with 410. Answering 410 Gone removes an endpoint at once. It is how these apps unsubscribe, and the reason your own receiver should never send it by accident.
Sync to a warehouse. For a copy of every submission in your own database, response.completed alone is usually enough. Add response.updated if customers come back to a survey.
Day to day
Run an endpoint without guessing
Everything below is on the Webhooks page. Only the person who added an endpoint, or an organization admin, can change it.
Delivery log
Each delivery with its event, status, attempts, last HTTP status and error, kept for 90 days.
Resend
An admin can resend a failed delivery. It gets a fresh set of 10 attempts with the same event ID.
Send test
Posts a signed webhook.test event and shows the result, such as Delivered: HTTP 200 in 84 ms. Up to 5 a minute for each endpoint.
Roll secret
A new secret, shown once. For 24 hours every event is signed with both, so you can switch without missing one.
Sample events
GET /webhooks/samples/{event_type} returns up to 10 recent real events in the exact envelope, for mapping fields.
Pause and resume
Nothing is sent while an endpoint is paused. Events that happen meanwhile are skipped, not saved for later.
Completed only
Send completed, updated and low score events only for customers who reached the last question.
Contact details
Emails and names are masked unless the endpoint is set to include them. Through the API, the key must allow them too.
Limits
The numbers to design around
- Endpoints
- 20 for each organization, counting paused and turned-off ones. Adding one more answers 409 conflict.
- Surveys per endpoint
- Every survey, new ones included, or up to 100 named ones.
- Time to answer
- 10 seconds. Slower counts as a failure and the event is sent again.
- Attempts
- 10 for each delivery, over roughly 4 to 9 hours.
- Event body
- 256 KB at most.
- Timestamp tolerance
- 300 seconds either side of your clock.
- Secret overlap
- 24 hours after a roll, during which both secrets sign.
- Where a URL can point
- https on port 443 or 8443, a full public host name of your own. Not localhost, a private address or a UserLoop address. For local work, use a tunnel with a public https URL.
- Delivery log
- 90 days.
- API version
- v1. An endpoint keeps the version it was created with, and new fields and event types can be added within it.
Frequently asked questions
Does UserLoop have webhooks for survey responses?
Yes. UserLoop posts a signed JSON event to your URL for each new answer, each completed submission, each update and each low score, plus two events for a survey being published or unpublished. That is 6 events in all, on the Plus plan.
Is there a webhook for a low NPS score?
Yes. response.low_score is sent with response.completed when a score is 0 to 6 on an NPS question, or in the bottom quarter of another scale. It carries the whole submission and names the question and the score.
How do I verify a UserLoop webhook signature?
Read t and every v1 from the UserLoop-Signature header, reject the event if t is more than 300 seconds from your clock, then compute the HMAC-SHA256 of t, a full stop and the raw body with your endpoint's secret. Accept the event when it equals any v1, compared in constant time.
What happens if my endpoint is down?
UserLoop tries each delivery 10 times over roughly 4 to 9 hours. If all fail, the delivery shows as Failed and an admin can resend it. An endpoint with no successful delivery for 3 days is turned off until you turn it on again.
Can the same event be delivered twice?
Yes. Delivery is at least once, so a slow answer, a resend or two endpoints can each produce a second copy. Every copy has the same event ID in the body and in the UserLoop-Event-Id header, so store the IDs you have handled and skip repeats.
Do webhook events include customer email addresses?
Not unless you switch it on. Emails and names are masked by default, for example em**@ex*****.com. An endpoint can be set to include contact details, and one added through the API needs a key that allows them.
Can I test a webhook on my own machine?
The URL must be a public https address, so point it at a tunnel to your local receiver. Then select Send test for a signed webhook.test event, or fetch recent real events from GET /webhooks/samples/{event_type}.
Which plan includes webhooks?
The Plus plan, at $99 a month, with a 14-day trial. An organization can have up to 20 endpoints.
Keep reading
Point an endpoint at your server
Add a URL, tick the events and a test event arrives straight away. Plus starts with a 14-day trial.