Webhooks
Send HMAC-signed HTTP webhook notifications from Potato for 7 annotation event types — with exponential backoff retry, admin monitoring, and Python/Node verification.
Webhooks
New in v2.4.0
Webhooks let Potato notify external systems when annotation events occur — without polling. Connect to data pipelines, trigger alerts, update dashboards, or kick off downstream processing automatically.
Overview
Potato sends an HTTP POST request to your configured endpoint whenever a supported event fires. Payloads are JSON and signed with HMAC-SHA256 so you can verify they came from your Potato instance.
Webhook delivery is fully non-blocking — annotation requests are never delayed while webhooks are in flight. Failed deliveries are retried with exponential backoff.
Configuration
Add a webhooks section to your YAML config:
webhooks:
enabled: true
endpoints:
- name: "my-pipeline"
url: "https://your-system.example.com/potato-events"
secret: "your-signing-secret" # optional but recommended
events:
- annotation.created
- item.fully_annotated
- task.completed
active: true
timeout: 10Multiple Endpoints
You can configure multiple endpoints, each with different event subscriptions:
webhooks:
enabled: true
endpoints:
- name: "data-pipeline"
url: "https://pipeline.example.com/annotations"
secret: ${WEBHOOK_SECRET_1}
events:
- annotation.created
- item.fully_annotated
- name: "slack-alerts"
url: "https://hooks.slack.com/services/..."
events:
- task.completed
- quality.attention_check_failed
- name: "catch-all"
url: "https://logging.example.com/potato"
events:
- "*" # subscribe to all eventsEvent Types
| Event | Fires When |
|---|---|
annotation.created | An annotator submits a label for an instance |
annotation.updated | An annotator modifies a previously submitted label |
item.fully_annotated | An instance reaches its required annotation overlap count |
task.completed | All instances in the task have been fully annotated |
user.phase_completed | An annotator completes a phase (Solo Mode workflow) |
quality.attention_check_failed | An annotator fails an attention check |
webhook.test | Triggered manually via the admin API for testing |
Use "*" to subscribe to all current and future event types.
Payload Format
All events share a common envelope:
{
"event_id": "evt_01HXYZ...",
"event_type": "annotation.created",
"timestamp": "2026-03-17T14:23:01Z",
"task_name": "sentiment-study",
"data": {
...
}
}annotation.created Payload
{
"event_type": "annotation.created",
"data": {
"annotator_id": "user123",
"instance_id": "doc_042",
"annotation": {
"sentiment": "positive",
"confidence": "high"
},
"submitted_at": "2026-03-17T14:23:01Z"
}
}item.fully_annotated Payload
{
"event_type": "item.fully_annotated",
"data": {
"instance_id": "doc_042",
"annotator_count": 3,
"annotations": [
{"annotator_id": "user1", "sentiment": "positive"},
{"annotator_id": "user2", "sentiment": "positive"},
{"annotator_id": "user3", "sentiment": "neutral"}
]
}
}task.completed Payload
{
"event_type": "task.completed",
"data": {
"task_name": "sentiment-study",
"total_instances": 500,
"total_annotations": 1500,
"completed_at": "2026-03-17T15:00:00Z"
}
}Verifying Signatures
When a secret is configured, Potato signs each request using Standard Webhooks (HMAC-SHA256). Three headers are included:
| Header | Value |
|---|---|
webhook-id | Unique delivery ID |
webhook-timestamp | Unix timestamp of delivery |
webhook-signature | HMAC-SHA256 signature |
Python Verification
import hmac
import hashlib
import time
def verify_webhook(payload_bytes: bytes, headers: dict, secret: str) -> bool:
webhook_id = headers.get("webhook-id", "")
timestamp = headers.get("webhook-timestamp", "")
signature = headers.get("webhook-signature", "")
# Reject stale requests (older than 5 minutes)
if abs(time.time() - int(timestamp)) > 300:
return False
signed_content = f"{webhook_id}.{timestamp}.{payload_bytes.decode()}"
expected = hmac.new(
secret.encode(),
signed_content.encode(),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(f"v1,{expected}", signature)Node.js Verification
const crypto = require('crypto');
function verifyWebhook(payload, headers, secret) {
const webhookId = headers['webhook-id'];
const timestamp = headers['webhook-timestamp'];
const signature = headers['webhook-signature'];
// Reject stale requests
if (Math.abs(Date.now() / 1000 - parseInt(timestamp)) > 300) {
return false;
}
const signedContent = `${webhookId}.${timestamp}.${payload}`;
const expected = crypto
.createHmac('sha256', secret)
.update(signedContent)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(`v1,${expected}`),
Buffer.from(signature)
);
}Retry Behavior
Failed deliveries (non-2xx response or timeout) are retried automatically:
| Attempt | Delay |
|---|---|
| 1 (initial) | Immediate |
| 2 | 5 seconds |
| 3 | 30 seconds |
| 4 | 5 minutes |
| 5 | 30 minutes |
| 6 | 1 hour |
After 6 failed attempts, the delivery is marked as permanently failed. The retry queue is persisted to SQLite at {output_dir}/.webhooks/webhook_retries.db — pending retries survive server restarts.
Monitoring and Testing
Admin API
Check webhook status and statistics:
# List all webhooks and their delivery statistics
curl -H "X-API-Key: $ADMIN_API_KEY" \
http://localhost:8000/admin/api/webhooksResponse:
{
"endpoints": [
{
"name": "my-pipeline",
"url": "https://...",
"events": ["annotation.created"],
"active": true,
"stats": {
"total_emitted": 1240,
"total_failed": 3,
"pending_retries": 0,
"last_success": "2026-03-17T14:23:01Z"
}
}
]
}Send a Test Webhook
curl -X POST -H "X-API-Key: $ADMIN_API_KEY" \
http://localhost:8000/admin/api/webhooks/test \
-H "Content-Type: application/json" \
-d '{"endpoint_name": "my-pipeline"}'This fires a webhook.test event to the named endpoint immediately.
Full Configuration Reference
webhooks:
enabled: true
endpoints:
- name: string # unique name for this endpoint
url: string # HTTPS URL to POST to
secret: string # optional HMAC secret for signature verification
events: # list of event types, or ["*"] for all
- annotation.created
active: true # set false to disable without removing
timeout: 10 # request timeout in seconds (default: 10)
max_retries: 6 # max retry attempts (default: 6)Further Reading
- Admin Dashboard — monitor annotation progress and manage users
- Quality Control — configure attention checks that trigger
quality.attention_check_failed - Solo Mode — phase-based workflow that triggers
user.phase_completed - Export Formats — alternative ways to get annotations out of Potato
For implementation details, see the source documentation.