Get notified when a share is opened or reported: events, payloads and signature checks
PageDrop posts share events to your URL. Each delivery is signed with the webhook secret using HMAC-SHA256 so your receiver can verify authenticity.
Events
| Event | Trigger |
|---|---|
share_visited | A share is successfully rendered; fires on every visit |
share_expiring_soon | Reserved for a future scheduled job; currently inactive |
share_reported | Someone submits an abuse report for the share |
Subscribe to the events you need. Delivery is best effort with a five-second timeout; each attempt is written to the WebhookDelivery audit log.
Create a webhook
Webhook management requires session authentication. Bot tokens cannot manage tokens or webhooks.
curl -X POST $BASE/api/webhooks -b cookies.txt -H "Content-Type: application/json" -d '{"url":"https://your.app/pagedrop-hook","events":["share_visited","share_reported"]}'
The secret appears only once:
{
"webhook": { "id": "cm...", "url": "...", "events": ["share_visited","share_reported"], "active": true, "createdAt": "..." },
"secret": "whsec_AbC...DeF"
}
Store it securely. To rotate the secret, delete the webhook and create another one.
Request format
POST /your-endpoint HTTP/1.1
Content-Type: application/json
User-Agent: PageDrop-Webhook/1.0
X-PageDrop-Event: share_visited
X-PageDrop-Signature: sha256=<hex>
{
"event": "share_visited",
"timestamp": "2026-05-23T08:30:12.345Z",
"data": {
"shareId": "cm...",
"token": "abcd1234",
"fileId": "f_...",
"fileName": "report.md",
"fileKind": "MARKDOWN",
"visitCount": 42,
"uniqueVisitCount": 18,
"surface": "share",
"ipPrefix": "203.0.113.0/24",
"ipAddress": "203.0.113.42",
"ipCountry": "CN",
"ipCity": "Shanghai",
"referer": "https://twitter.com/i/web/..."
}
}
share_visited sends the visitor's full IP address along with country and city (ipAddress / ipCountry / ipCity). ipPrefix is the /24 (IPv4) or /48 (IPv6) prefix of the same address. Visitors are not notified; these fields only appear in webhook deliveries.
Example share_reported delivery (the data fields come from the abuse-report route):
POST /your-endpoint HTTP/1.1
Content-Type: application/json
User-Agent: PageDrop-Webhook/1.0
X-PageDrop-Event: share_reported
X-PageDrop-Signature: sha256=<hex>
{
"event": "share_reported",
"timestamp": "2026-05-23T08:30:12.345Z",
"data": {
"reportId": "cm...",
"shareId": "cm...",
"shareToken": "abcd1234",
"reason": "PHISHING",
"fileName": "report.md"
}
}
Verify the signature
import crypto from 'node:crypto';
function verify(req, secret) {
const sig = req.headers['x-pagedrop-signature'];
const expected = 'sha256=' + crypto.createHmac('sha256', secret)
.update(req.rawBody) // Unparsed UTF-8 request body
.digest('hex');
return typeof sig === 'string' && sig.length === expected.length
&& crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}
Reject requests with missing or invalid X-PageDrop-Signature values.
List and audit
# List your webhooks
curl -b cookies.txt $BASE/api/webhooks
# Most recent 50 deliveries for one webhook
curl -b cookies.txt $BASE/api/webhooks/{webhookId}/deliveries
Delivery fields: { event, status, responseCode, attempts, deliveredAt }.
Limits
- At most ten webhooks per user, inactive ones included.
- Five-second timeout per delivery.
- Failed deliveries are eligible for retry:
POST /api/internal/maintenancepicks up deliveries withstatus: FAILEDandattempts < 3that failed more than 60 seconds ago and re-sends them (max 25 per run). ⚠️ The current Vercel deployment has no cron wired to that endpoint, so retries only happen if you call it yourself (e.g. from a scheduler) — do not rely on them. GET /api/webhooks/{id}/deliveriesreturns the latest 50 deliveries per webhook. That 50 is a read limit, not a retention policy: nothing prunesWebhookDeliveryrows, so the table grows until you delete the webhook.