Webhooks
Crea uno con POST /webhooks (alcance webhooks:manage). El secret de firma se devuelve una sola vez.
Eventos: note.created, note.updated, note.deleted, folder.created, folder.updated, folder.deleted.
json
{ "id": "…", "event": "note.updated", "created_at": "2026-12-06T18:00:00.000Z",
"data": { "id": "note-id", "type": "note", "seq": 1234 } }Los payloads llevan solo ids. Consulta la nota con la API si necesitas su contenido.
Verificar la firma
Cabecera: X-PalmNotes-Signature: t=<unix>,v1=<hex>, donde v1 = HMAC_SHA256(secret, "<t>.<cuerpo crudo>").
ts
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(secret: string, header: string, rawBody: string, toleranceSec = 300) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > toleranceSec) return false;
const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex');
return timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ''));
}python
import hmac, hashlib, time
def verify(secret: str, header: str, raw_body: bytes, tolerance_sec: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > tolerance_sec:
return False
signed = parts["t"].encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))Entrega
- Solo HTTPS; se rechazan las direcciones privadas e internas.
- Responde rápido con cualquier
2xx. - Los fallos se reintentan 5 veces (30 s, 2 min, 10 min, 1 h, 6 h). Tras 10 entregas fallidas consecutivas el webhook se desactiva; reactívalo con
PATCH {"active": true}.