feat(documenso): v2 coverage on getDocument/health + reminder webhook + admin UI benefits panel
- documenso-client.ts: getDocument now routes to /api/v2/envelope/{id} when port apiVersion=v2; checkDocumensoHealth surfaces resolved apiVersion for the admin Test button
- webhook route: handle DOCUMENT_REMINDER_SENT (structured log only, no audit-table noise) + DOCUMENT_CREATED / DOCUMENT_SENT (informational log)
- Admin Documenso page: prominent v1-vs-v2 explainer card listing v2-only capabilities the CRM already exploits (bulk fields, percent coords, richer fieldMeta, v2 webhook aliases, envelope endpoints) + amber roadmap callout for sequential signing / redirectUrl / template/use / envelope/update / non-SIGNER roles
- CLAUDE.md: idempotency + v2 webhook event list, berth-rules engine section, DOCUMENSO_API_URL gotcha, storage backend listByPrefix + timeout
Still v1-only (call out in admin UI roadmap): createDocument, generateDocumentFromTemplate, sendDocument, sendReminder, downloadSignedPdf. Migrating template/use to v2 requires per-template field-ID mapping in template config; deferred to a follow-up plan.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -235,6 +235,29 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
await handleDocumentExpired({ documentId: documensoId, ...portScope });
|
||||
break;
|
||||
|
||||
case 'DOCUMENT_REMINDER_SENT':
|
||||
// Documenso auto-reminded a recipient. We don't mutate state — the
|
||||
// reminder is informational. Structured log line is enough for
|
||||
// telemetry without polluting the audit_logs table on every
|
||||
// auto-reminder Documenso sends across all ports.
|
||||
logger.info(
|
||||
{
|
||||
documensoId,
|
||||
recipients: recipients.map((r) => r.email),
|
||||
...portScope,
|
||||
},
|
||||
'Documenso auto-reminder sent',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'DOCUMENT_CREATED':
|
||||
case 'DOCUMENT_SENT':
|
||||
// Created + sent are informational — we initiated these from our
|
||||
// side so the state is already authoritative in our DB. Log for
|
||||
// forward-compat / out-of-band-creation telemetry.
|
||||
logger.info({ event, documensoId, ...portScope }, 'Documenso lifecycle event');
|
||||
break;
|
||||
|
||||
default:
|
||||
logger.info({ event }, 'Unhandled Documenso webhook event type');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user