Things I have tried so far -
- Define the connect configuration at the Docusign Admin to list all the events to trigger the webhook. - This approach works but it expects the callback url to be static. But I would require the callback url to be generated specific for the server environment.(dev.test.com/callback-url, stage.test.com/callback-url etc. ) Hence this is not an option for me.
- Tried to set the envelopeEvents and RecipientEvents in the envelope definition. like below but its not triggering the events on complete/decline of signing.
const envelopeDefinition = new docusign.EnvelopeDefinition(); envelopeDefinition.emailSubject = this.template.emailSubject; envelopeDefinition.documents = this.template.documents; envelopeDefinition.recipients = new docusign.Recipients(); envelopeDefinition.recipients.signers = [signer]; envelopeDefinition.status = 'sent'; let eventNotification = new docusign.EventNotification(); eventNotification.url = "https://webhook.site/acff9663-1b89-4b3b-9fa7-57dbc433e196"; eventNotification.loggingEnabled = "true"; eventNotification.requireAcknowledgment = "true"; eventNotification.useSoapInterface = false; eventNotification.eventData = { format: "application/json" } eventNotification.envelopeEvents = [ new docusign.EnvelopeEvent({ envelopeEventStatusCode: "sent" }), new docusign.EnvelopeEvent({ envelopeEventStatusCode: "completed" }), new docusign.EnvelopeEvent({ envelopeEventStatusCode: "declined" }), new docusign.EnvelopeEvent({ envelopeEventStatusCode: "voided" }) ]; eventNotification.recipientEvents = [ new docusign.RecipientEvent({ recipientEventStatusCode: "completed" }), new docusign.RecipientEvent({ recipientEventStatusCode: "declined" }) ]; envelopeDefinition.eventNotification = eventNotification;
Please help.
Thanks,
Shashank