Node.js Example launcher with 14 examples
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:
- 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.
- 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.
- 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.
- List envelopes in the user's account
Lists the envelopes created in the last 30 days.API method used: Envelopes::listStatusChanges.
- 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.
- List an envelope's recipients and their status
Lists the envelope's recipients and their current status.API method used: EnvelopeRecipients::list.
- List an envelope's documents
Lists each document contained in a specified envelope.API method used: EnvelopeDocuments::list.
- 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.
- Create a template
Programmatically creates a template with two roles, signer, and cc.API methods used: Templates::list, Templates::create.
- 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.
- 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.
- 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.
- Embedded DocuSign web tool
The example redirects the user to the DocuSign web tool.API method used: EnvelopeViews::createConsole.
- 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.
- 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.
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@example.com
We’re in the process of porting the software to our other SDKs, so stay tuned for further announcements!