Overview
A webhook sends every response to a poll or form to your own server the moment it arrives, as
an HTTPS POST with a JSON body. Nothing to poll and no API key to keep: StrawPoll calls you.
- Events: a new response, a changed response and a deleted response
- Format: JSON, signed with HMAC-SHA256 and a secret only you and StrawPoll know
- Delivery: at least once, retried three times when your server doesn’t answer, logged for 30 days
Webhooks are one of the integrations in your dashboard. On the Free plan you can try three with test sends only, Basic has one
and Pro and Business have as many as you like. For a step-by-step setup without code, see Send responses to your own server with webhooks. To read responses later
instead of receiving them as they come, use GET/forms/{slug}/responses in the StrawPoll API.
Set up an endpoint
- Open Integrations, click Add an integration and choose Webhooks.
- Enter your endpoint’s URL. It must start with
https://and point to a public server. - Choose one poll, or All my polls, which includes polls you create later.
- Choose the events to send: new responses, changed responses, deleted responses or any mix.
- Optional: add Custom headers your endpoint expects, like
Authorization. - Save, copy the Signing secret and click Send test.
The test sends a ping with your poll’s real questions and made-up answers, once and without
retries, and shows your server’s answer right away.
Events
| Event | Sent when |
|---|---|
response.created | Someone submits a response. |
response.updated | A respondent edits a response they sent earlier. |
response.deleted | A respondent deletes their own response. |
ping | You click Send test. Always sent, whatever events you chose. |
Only what respondents do sends an event. Responses you delete from your results, and resetting a poll’s results, send nothing.
The request
Every delivery is one POST to your URL:
POST /strawpoll HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: StrawPoll-Webhooks/1.0
X-StrawPoll-Event: response.created
X-StrawPoll-Delivery: 0193f1c2-7b1e-7c3a-9d2e-5f4a8b6c1d0e
X-StrawPoll-Timestamp: 1794233112
X-StrawPoll-Signature: sha256=5d1e0c8f…
Authorization: Bearer your-own-token| Header | What’s in it |
|---|---|
X-StrawPoll-Event | The event, the same as event in the body |
X-StrawPoll-Delivery | The delivery’s id, the same as id in the body |
X-StrawPoll-Timestamp | When this attempt was sent, in Unix seconds |
X-StrawPoll-Signature | sha256= and the hex HMAC, see Verify the signature |
User-Agent | StrawPoll-Webhooks/1.0, unless a custom header replaces it |
Your custom headers are sent along with these. They can’t be named Host, Content-Type or
start with X-StrawPoll-.
The payload
{
"id": "0193f1c2-7b1e-7c3a-9d2e-5f4a8b6c1d0e",
"event": "response.created",
"createdAt": "2026-11-08T14:05:12.000Z",
"form": {
"id": "0193a8d0-…",
"slug": "w8Jq3KdN",
"name": "Team lunch",
"title": "Where should we eat on Friday?",
"url": "https://strawpoll.com/r/w8Jq3KdN"
},
"response": {
"id": "0193f1c2-6e44-…",
"createdAt": "2026-11-08T14:05:11.000Z",
"updatedAt": null,
"deletedAt": null,
"respondent": { "name": "Sam", "email": "sam@example.com", "phone": null },
"answers": [
{
"fieldId": "0193a8d0-91c4-7f2e-…",
"question": "Q1 · Where should we eat?",
"value": ["0193a8d0-93b2-7c88-…"],
"text": "Pizza"
},
{
"fieldId": "0193a8d0-9d07-7a51-…",
"question": "Q2 · Anything we should know?",
"value": "No onions, please",
"text": "No onions, please"
}
],
"comment": null
}
}| Field | What it is |
|---|---|
id | The delivery’s id, a UUIDv7. Unique per event and integration, kept across retries. |
event | response.created, response.updated, response.deleted or ping |
createdAt | When StrawPoll created the event |
form.id, form.slug | The poll. slug is the end of its link and what the API takes in /forms/{slug}. |
form.name | The name you gave the poll in your dashboard |
form.title | The title voters see |
form.url | The voting page |
response.id | The response. Stays the same through created, updated and deleted. |
response.updatedAt | When it was last edited, or null |
response.deletedAt | For response.deleted, when the respondent deleted it; otherwise null |
response.respondent | Name, email and phone, when the poll asked for them; null otherwise |
response.answers | One entry per question, in the poll’s order |
response.comment | The comment the respondent left, or null |
A response.deleted delivery carries the answers the respondent had sent, so you can find and
remove what you stored. A ping uses zeros for response.id and made-up answers with a value of null.
Answers
Each entry in answers has the question’s fieldId, its question as your results show it,
numbered like Q1 · …, the answer as readable text, and the raw value. Use text to show
or store answers as they are; use value and fieldId to work with them in code. The ids match
the fields and choices that GET/forms/{slug} returns in the API.
| Question | value |
|---|---|
| Choice and picture questions | A list of choice ids, plus the typed text when write-ins are allowed |
| Ranking | Every choice id, best first |
| Ranked choice | The choice id in each place, best first, null for a place left empty |
| Meeting | One entry per date, a list of choiceId and status: yes, if_need_be, no |
| Yes/no | "yes" or "no" |
| Rating and scale | The number as a string, like "4" |
| Text and contact fields | A string |
A question someone skipped has a value of null.
Secret ballots
On a poll with a secret ballot, deliveries keep the answers apart from who gave them, the way
your results do: respondent is all null and the contact questions are left out of answers.
Verify the signature
X-StrawPoll-Signature is sha256= and an HMAC-SHA256, made with your signing secret, of
three things joined by dots: the delivery id, the timestamp and the raw request body.
sha256=HEX( HMAC-SHA256( secret, id + "." + timestamp + "." + body ) )Compute it yourself and compare in constant time. Three things to get right:
- Sign the body exactly as it arrived, as bytes, before any JSON parser touches it. Parsing and serializing again changes spacing and the signature no longer matches.
- Reject old timestamps. Every attempt is signed afresh with the time it was sent, so a window of five minutes is plenty and stops a captured request from being replayed later.
- Compare in constant time, with
timingSafeEqual,hmac.compare_digestorhash_equals, not===.
Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';
/** headers: the request's headers; rawBody: the body as a Buffer or string, unparsed. */
export function isFromStrawPoll(headers, rawBody, secret) {
const id = headers['x-strawpoll-delivery'] ?? '';
const timestamp = headers['x-strawpoll-timestamp'] ?? '';
const signature = headers['x-strawpoll-signature'] ?? '';
const expected =
'sha256=' +
createHmac('sha256', secret).update(`${id}.${timestamp}.`).update(rawBody).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
return (
fresh &&
signature.length === expected.length &&
timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
);
}Python
import hashlib
import hmac
import time
def is_from_strawpoll(headers, raw_body: bytes, secret: str) -> bool:
delivery = headers.get("X-StrawPoll-Delivery", "")
timestamp = headers.get("X-StrawPoll-Timestamp", "")
signature = headers.get("X-StrawPoll-Signature", "")
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300:
return False
message = f"{delivery}.{timestamp}.".encode() + raw_body
expected = "sha256=" + hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature, expected)PHP
<?php
function is_from_strawpoll(string $secret): bool
{
$delivery = $_SERVER['HTTP_X_STRAWPOLL_DELIVERY'] ?? '';
$timestamp = $_SERVER['HTTP_X_STRAWPOLL_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_STRAWPOLL_SIGNATURE'] ?? '';
$body = file_get_contents('php://input');
if (!ctype_digit($timestamp) || abs(time() - (int) $timestamp) > 300) {
return false;
}
$expected = 'sha256=' . hash_hmac('sha256', $delivery . '.' . $timestamp . '.' . $body, $secret);
return hash_equals($expected, $signature);
}Rotate the secret
The signing secret starts with whsec_. Keep it on your server, like a password. If it might
have leaked, click Rotate on the integration’s page. The old secret stops working at once,
so deploy the new one to your endpoint right after; deliveries in between fail and show up in
the log.
Respond and retry
Answer with any 2xx status within 10 seconds. The body of your answer doesn’t matter,
but the first 4,000 characters are kept in the delivery log, which helps when you debug.
Do slow work, like sending emails or calling other services, after you’ve answered or in a
queue.
A delivery that fails is tried again, up to four attempts in all:
| Attempt | Sent |
|---|---|
| 1 | Right away |
| 2 | 1 second after attempt 1 |
| 3 | 5 seconds after attempt 2 |
| 4 | 30 seconds after attempt 3 |
A delivery counts as failed when your server doesn’t answer within 10 seconds, can’t be
reached, or answers with a status other than 2xx. It isn’t retried when:
- you answer with a
4xxother than429. A400or401won’t change on a second try, so answer5xxor429when you’d like StrawPoll to try again. - you answer with a redirect. Redirects are never followed; enter the final URL.
- the URL points to a private address, see Security.
Duplicates and order
Retries keep the same id, so a delivery your server handled but answered too slowly can
arrive twice. Store the id of each delivery you’ve handled and skip one you’ve seen.
Each event is delivered on its own, so a response.updated can overtake the response.created it follows while that one is being retried. Key what you store by response.id and keep the version with the latest updatedAt; treat response.deleted as
final.
Delivery log and alerts
The integration’s page lists Recent deliveries: the event, whether it was delivered, your server’s status code and answer, how long it took and how many attempts it needed. Deliveries are kept for 30 days.
When a delivery fails for good, the poll’s owner gets an email with the error, at most one a day for each integration. You can turn these emails off in your notification settings. Pause an integration from its page to stop deliveries without deleting it; responses that arrive while it’s paused aren’t sent later.
Security
- HTTPS only. The URL must start with
https://, and credentials go in a custom header, not in the URL. - Public servers only. StrawPoll looks up your host before every delivery and refuses
addresses on private networks, like
10.0.0.0/8,192.168.0.0/16,127.0.0.1orlocalhost. - No redirects. A redirect could lead to an address the check above never saw, so a
3xxanswer counts as a failure. - Check the signature on every request, and check the timestamp. A shared token in a custom header is a fine second layer, not a replacement.
Example receiver
A complete Express server that checks the signature, answers at once and skips deliveries it has already handled:
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
const secret = process.env.STRAWPOLL_WEBHOOK_SECRET;
const handled = new Set(); // Use your database in production.
function isFromStrawPoll(req) {
const id = req.get('x-strawpoll-delivery') ?? '';
const timestamp = req.get('x-strawpoll-timestamp') ?? '';
const signature = req.get('x-strawpoll-signature') ?? '';
const expected =
'sha256=' +
createHmac('sha256', secret).update(`${id}.${timestamp}.`).update(req.body).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
return (
fresh &&
signature.length === expected.length &&
timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
);
}
const app = express();
// express.raw keeps the body as bytes, so the signature can be checked.
app.post('/strawpoll', express.raw({ type: 'application/json' }), (req, res) => {
if (!isFromStrawPoll(req)) return res.sendStatus(401);
const delivery = JSON.parse(req.body);
res.sendStatus(204);
if (handled.has(delivery.id)) return;
handled.add(delivery.id);
switch (delivery.event) {
case 'response.created':
case 'response.updated':
for (const answer of delivery.response.answers) {
console.log(`${answer.question}: ${answer.text}`);
}
break;
case 'response.deleted':
console.log(`Remove response ${delivery.response.id}`);
break;
case 'ping':
console.log('Test delivery received');
}
});
app.listen(3000);Test it
- Send test on the integration’s page sends a
pingat once and shows your server’s status code and answer. - To reach a server on your own computer, run a tunnel such as
ngrok http 3000orcloudflared tunnel --url http://localhost:3000and use thehttps://address it prints. - Submit a response to your poll to see a real
response.created, then edit it, if the poll lets voters change their answers, for aresponse.updated.
No code needed
If you’d rather not run a server, the same responses can go straight to Zapier, Make or n8n, and from there to thousands of apps. n8n receives exactly the signed payload described here.