Skip to main content
Solved

Need help with capturing E-sign completion event using webhooks


Forum|alt.badge.img+2

Things I have tried so far -

  1. 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.
  2. 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

 

 

Best answer by mrave

@shashank 

This is the related create envelope API call. You need to look at the “eventNotification” payload. In the past I have implemented this for various customers and successfully tested in myself in Postman.

I also found an old Blog Article that also has the Node.js code example:

let envelopeDefinition = new docusign.EnvelopeDefinition();
let eventNotification = new docusign.EventNotification();
// Set up the endpoint URL to call (it must be using HTTPS and at least TLS1.1 or higher)
eventNotification.url = 'https:\\myapp.somedomain.com';
// Docusign will retry on failure if this is set
eventNotification.requireAcknowledgment = 'true';
// This would send the documents together with the event to the endpoint
eventNotification.includeDocuments = 'true';
// Allow you to see this in the Docusign Admin Connect logs section
eventNotification.loggingEnabled = 'true';
let envelopeEvents = [];
// In this case we only add a single envelope event, when the envelope is completed. You can also add events for recipients
let envelopeEvent = new docusign.EnvelopeEvent();
envelopeEvent.envelopeEventStatusCode = 'completed'; 
envelopeEvent.includeDocuments = 'true';
envelopeEvents.push(envelopeEvent);   
eventNotification.envelopeEvents = envelopeEvents;
envelopeDefinition.eventNotification = eventNotification;

 

View Original
Is this content helpful?

4 replies

Michael.Rave
Docusign Employee
Forum|alt.badge.img+14
  • Docusign Employee
  • 925 replies
  • March 6, 2025

@shashank 

You are correct the  Docusign Connect endpoint URL is static, but you could set up multiple Docusign Connect configurations for different environments and activate/deactivate them as you progress.

The other option, as you mentioned correctly, is not to set up a Docusign Connect configuration but provide the desired callback information directly into the envelope definition as eventNotification on creation. Maybe there is an issue on how you tried to set this up. Unfortunately, I am not a Node.js expert to help you with this.


Forum|alt.badge.img+2
  • Author
  • Newcomer
  • 3 replies
  • March 6, 2025

@Michael.Rave Thanks for replying. I would still prefer to use the approach where callback url is specified in the envelope due to some constraints. 
Can you please provide a reference to the documentation or an example where this approach is used, regardless of the programming language?

Thanks,

Shashank


Michael.Rave
Docusign Employee
Forum|alt.badge.img+14
  • Docusign Employee
  • 925 replies
  • Answer
  • March 6, 2025

@shashank 

This is the related create envelope API call. You need to look at the “eventNotification” payload. In the past I have implemented this for various customers and successfully tested in myself in Postman.

I also found an old Blog Article that also has the Node.js code example:

let envelopeDefinition = new docusign.EnvelopeDefinition();
let eventNotification = new docusign.EventNotification();
// Set up the endpoint URL to call (it must be using HTTPS and at least TLS1.1 or higher)
eventNotification.url = 'https:\\myapp.somedomain.com';
// Docusign will retry on failure if this is set
eventNotification.requireAcknowledgment = 'true';
// This would send the documents together with the event to the endpoint
eventNotification.includeDocuments = 'true';
// Allow you to see this in the Docusign Admin Connect logs section
eventNotification.loggingEnabled = 'true';
let envelopeEvents = [];
// In this case we only add a single envelope event, when the envelope is completed. You can also add events for recipients
let envelopeEvent = new docusign.EnvelopeEvent();
envelopeEvent.envelopeEventStatusCode = 'completed'; 
envelopeEvent.includeDocuments = 'true';
envelopeEvents.push(envelopeEvent);   
eventNotification.envelopeEvents = envelopeEvents;
envelopeDefinition.eventNotification = eventNotification;

 


Forum|alt.badge.img+2
  • Author
  • Newcomer
  • 3 replies
  • March 7, 2025

Awesome, will try it out. Thanks a lot.

Regards,
Shashank