Skip to content

Open-source document signature platform. Not affiliated with DocuSign.

TypeScript

Merge branch 'local/pr3-webhooks' into local/pr4-embed

Claude8180a4418387
diff --cc src/lib/envelopes.ts
index a025e7a,088e978..14a68fb
--- a/src/lib/envelopes.ts
+++ b/src/lib/envelopes.ts
@@@ -124,8 -124,7 +124,8 @@@ import
import { PERMITTED_USE_VERSION } from "./permitted-uses.ts";
import { hashAccessCode } from "./signer-checks.ts";
import { escapeHtml } from "./utils/html.ts";
+import { hasEmbedOrigins, isEmbeddedEnvelope } from "./embedding.ts";
- import { requestWebhookDrain } from "./webhooks/outbox.ts";
+ import { releaseSentWebhook } from "./webhooks/outbox.ts";
type CreateDraftEnvelopeOptions = {
database?: DbPool;
@@@ -2679,20 -2627,6 +2679,26 @@@ export async function sendDraftEnvelope
throw error;
}
+ if (delivery === "embedded") {
+ // No invitation: the app asks the API for a link for each signer in
- // turn (see embedding.ts). The envelope is out for signature now.
- requestWebhookDrain();
++ // turn (see embedding.ts). The envelope is out for signature now, so
++ // its envelope.sent webhook can go.
++ await releaseSentWebhook(envelopeId, database).catch((error: unknown) => {
++ console.error(
++ `Releasing the envelope.sent webhook of ${envelopeId} failed:`,
++ error,
++ );
++ });
+
+ return sendEnvelopeResponseSchema.parse({
+ envelopeId,
+ expiresAt,
+ notifiedSignerName: firstSigner.name,
+ redirectPath: `/envelopes/${envelopeId}`,
+ sentAt,
+ });
+ }
+
let invitationMessageId: string | undefined;
try {