Node.js Example launcher

The DocuSign DevCenter team has now published a new set of code examples for Node.js that demonstrate how to implement several common workflows in a web application using the Express web framework and the Passport authentication middleware.

You can view the examples in the eg-03-node-auth-code-grant Github repository. The Readme file for the repository provides step-by-step instructions for installing and running the software on your development machine.

The example software implementation demonstrates the following workflows:

  1. Authentication Example
    The software demonstrates how to use OAuth Authorization Code Grant to authenticate with DocuSign. The software uses the popular Passport middleware and the DocuSign-Passport strategy library to smoothly handle the details of the OAuth authentication.
  2. Embedded Signing Ceremony
    Sends an envelope and uses an embedded signing ceremony for the first signer. With embedded signing, the DocuSign signing ceremony is initiated from your website.
    API methods used: Envelopes::create and EnvelopeViews::createRecipient.
  3. Send an envelope with a remote (email) signer and cc recipient
    The envelope sent in this example includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents.
    API method used: Envelopes::create.
  4. List envelopes in the user’s account
    Lists the envelopes created in the last 30 days.
    API method used: Envelopes::listStatusChanges.
  5. Get an envelope’s basic information and status
    Lists the basic information about a specific envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the envelope, its documents, recipients, or other properties.
    API method used: Envelopes::get.
  6. List an envelope’s recipients and their status
    Lists the envelope’s recipients and their current status.
    API method used: EnvelopeRecipients::list.
  7. List an envelope’s documents
    Lists each document contained in a specified envelope.
    API method used: EnvelopeDocuments::list.
  8. Download a document from an envelope
    Downloads a document or a set of documents from an envelope. An envelope’s documents can be downloaded one by one or as a complete set.
    API method used: EnvelopeDocuments::get.
  9. Create a template
    Programmatically creates a template with two roles, signer, and cc.
    API methods used: Templates::list, Templates::create.
  10. Send an envelope using a template
    Sends an envelope that is defined by a specified template. The signer name, cc recipient name, and email are used to fill in the template’s roles.
    API method used: Envelopes::create.
  11. Send an envelope using binary document transfer
    Sends an envelope containing a pdf document, a Word document, and an HTML document.
    The example uses multipart data transfer to send the documents in binary format to DocuSign. Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. Note that since Binary transfer is not yet supported by the SDK, the example calls the API directly.
    API method used: Envelopes::create.
  12. Embedded sending
    Creates an envelope in draft mode. The DocuSign web tool (NDSE) is then shown, enabling further updates to the envelope before it is sent.
    API methods used: Envelopes::create, EnvelopeViews::createSender.
  13. Embedded DocuSign web tool
    The example redirects the user to the DocuSign web tool.
    API method used: EnvelopeViews::createConsole.
  14. Embedded Signing Ceremony from a template with an added document
    Sends an envelope that is created from a specified template. In addition to the template’s documents, the example adds an additional document to the envelope by using the Composite Templates feature.
    API methods used: Envelopes::create and EnvelopeViews::createRecipient.
  15. Send an envelope with an order form, including a payment field.
    Sends an envelope that includes an order form and a DocuSign payment field that requests credit card payment from the signer.
    API method used: Envelopes::create.

Node.js Promises

The examples also demonstrate how the Node.js util.promisify method may be used with the Node.js SDK and modern promise software patterns.

Try it out

If you’re a Node.js developer, try out the software and let us know your comments via [email protected]

We’re in the process of porting the software to our other SDKs, so stay tuned for further announcements!