简体   繁体   中英

How to get the response on webhook URL after user sign the doc in docusign

I am redirecting user to a page where they can sign the doc and after sign I have set the return URL where it redirects the user.
Now how can I get the response sent from docusign.
I have tried $_REQUEST and $data = file_get_contents('php://input'); but didn't get the response. Is there any other way to get the response.

Once the user signs the embedded URL. The status of the envelop is changed. In your webApp you have to hook an eventNotification Object to the EnvelopDefinition Object which is used while envelope creation. In that particular eventNotification object you can specify the various statuses of the envelope on which you want a notification, you have to specify a call back endpoint. The call back end point can be configured on the url parameter present on the eventNotification Object. Following is a java example of that eventConfiguration Object

EventNotification eventNotification = new EventNotification();
    eventNotification.setUrl("https://exampleapp.com/api/envelope/status");
    eventNotification.setIncludeCertificateOfCompletion(FALSE);
    eventNotification.setIncludeDocuments(FALSE);
    eventNotification.setRequireAcknowledgment(TRUE);
    eventNotification.setUseSoapInterface(FALSE);
    eventNotification.setLoggingEnabled(TRUE);
    eventNotification.setEnvelopeEvents(getEnvelopeEvents());
    return eventNotification;

Following is the configuration where you can specify to which state of envelope you want notification for. You can configure multiple states of the envelope.

private List<EnvelopeEvent> getEnvelopeEvents() {
    List<EnvelopeEvent> envelopeEvents = new ArrayList<>();
    EnvelopeEvent sentEnvelopeEvent = new EnvelopeEvent();
    sentEnvelopeEvent.setEnvelopeEventStatusCode("sent");
    sentEnvelopeEvent.setIncludeDocuments(FALSE);
    envelopeEvents.add(sentEnvelopeEvent);

    EnvelopeEvent completedEnvelopeEvent = new EnvelopeEvent();
    completedEnvelopeEvent.setEnvelopeEventStatusCode("completed");
    completedEnvelopeEvent.setIncludeDocuments(FALSE);
    envelopeEvents.add(completedEnvelopeEvent);
    return envelopeEvents;
}

And while creating envelope, just hook this object to the eventDefiniton Object which in turn will be passed to the createEnvelope method of EnvelopesApi Object.

EnvelopeDefinition envelopeDef = new EnvelopeDefinition();
envelopeDef.setEventNotification(eventNotification);
envelopesApi.createEnvelope(accountId, envelopeDef);

Once you get notification from docusign, you can update your contract status on database, or you can notify your ui about the envelope state change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM