-->

DocuSign API to obtain the response (signed) docum

2019-06-13 18:08发布

问题:

We are using Power Form to create a signing document in an envelop for our clients to sign our contract.

After our client completed signing (response to) the document, can we get any call back event and get the client signed(completed) document (either Stream or URL) from docSign?

I was trying to use the sample code below to download the document, but it only gets the template PDF (no data) from the envelop not the client completed document.

EnvelopesApi envelopesApi = new EnvelopesApi(apiClient.Configuration);

var docStream = envelopesApi.GetDocument(accountId, envelopeId, "combined");

using (var stream = File.Create(@"c:\temp\docu38.pdf"))
      {
           docStream.CopyTo(stream);
      }

Any help would be appreciated. Thank you :-)

回答1:

Above call will work fine to retrieve signed document if you have the envelopeId available with you for each envelope created using Powerform.

There are different ways to get EnvelopeIds back from DocuSign for Powerform scenario:

  • If you are using Direct Powerform (no Email validation) and one
    signer scenario, then you need to Create In-Session landing page in
    DS Account as explained in Configure In-Session landing
    pages, configure return/callback URL like https://www.google.com?, where www.google.com is your callback App URL and when callback will happen you will see some query parameters like below:

    https://www.google.com/?env=b807a0fc-fc80-445f-9740-38e0e5f0200c&pf=c4b09cfb-8264-4fe7-a35d-554294f99445&r=50dd1f38-4242-4d47-8ddb-f73c03db929e

    where env is the envelopeId and now you can use this envelopeId to get the signed document

  • If you are using Direct PowerForm with multiple Signers or if you are using Email Powerform (Selected Require Email Validation checkbox in Powerform Configuration) then you need configure Destination URLs in Branding as explained here with the return/callback URL like https://www.google.com, where www.google.com is your callback App URL and in response DocuSign will also send envelopeId in the query parameter and now you can use this envelopeId to get the signed document

  • Last way and the most recommended is to use DocuSign Connect, its like a Pub-Sub Architecture where you will develop and host a WebService which can accept a POST call and an XML input. And you will configure the same WebService in DocuSign and also you will configure Trigger Events in DocuSign, informing DocuSign whats your interested events when you want DocuSign to push an XML notification to your WebService. Once that trigger events happen on your envelope then DocuSign will push an XML message with envelopeId and status of the envelope, upon receiving the XML message you can call /documents API with envelopeId to download the Signed document. Also if your documents are not huge then you can DocuSign to send you signed Document in the XML as Base64 format as well, this is one of the configuration in DocuSign Connect settings while configuring your Webservice.



标签: docusignapi