Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docusign-esign

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docusign-esign

DocuSign Node.js API client.

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
71K
decreased by-9.49%
Maintainers
1
Weekly downloads
 
Created
Source

DocuSign Node Client

NPM version NPM downloads

NPM module that wraps the DocuSign API

Documentation about the DocuSign API

Documentation about this package

You can sign up for a free developer sandbox.

============ Requirements

Node 4.2 or later.

Installation

NPM Package Manager

Install the client locally: npm install docusign-esign --save --save-exact (note you may have to use sudo based on your permissions)

Alternatively you can just copy the source code directly into your project.

Dependencies

This client has the following external dependencies:

  • superagent 1.7.1

Usage

To initialize the client, make the Login API Call and send a template for signature:

var docusign = require('docusign-esign');
var async = require('async');

var integratorKey  = '***',                   // Integrator Key associated with your DocuSign Integration
  email            = 'YOUR_EMAIL',            // Email for your DocuSign Account
  password         = 'YOUR_PASSWORD',         // Password for your DocuSign Account
  docusignEnv      = 'demo',                  // DocuSign Environment generally demo for testing purposes
  fullName         = 'Joan Jett',             // Recipient's Full Name
  recipientEmail   = 'joan.jett@example.com', // Recipient's Email
  templateId       = '***',                   // ID of the Template you want to create the Envelope with
  templateRoleName = '***',                   // Role Name of the Template
  debug            = false;                   // Enable debug logging and debug responses from API

var templateRoles = [{
  email: email,
  name: fullName,
  roleName: templateRoleName
}];
var additionalParams = {};

var baseUrl = "https://demo.docusign.net/restapi";

// initialize the api client
var apiClient = new docusign.ApiClient();
apiClient.setBasePath(baseUrl);

// create JSON formatted auth header
const creds = "{\"Username\":\"" + email + "\",\"Password\":\"" + password + "\",\"IntegratorKey\":\"" + integratorKey + "\"}";
apiClient.addDefaultHeader("X-DocuSign-Authentication", creds);

// assign api client to the Configuration object
docusign.Configuration.default.setDefaultApiClient(apiClient);

async.waterfall([
  function login (next) {
    // login call available off the AuthenticationApi
    var authApi = new docusign.AuthenticationApi();
    
    // login has some optional parameters we can set
    var loginOps = new authApi.LoginOptions();
    loginOps.setApiPassword("true");
    loginOps.setIncludeAccountIdGuid("true");
    authApi.login(loginOps, function (error, loginInfo, response) {
      if (err) {
        return next(err);
      }
      if (loginInfo) {
        // list of user account(s)
        // note that a given user may be a member of multiple accounts
        var loginAccounts = loginInfo.getLoginAccounts();
        console.log("LoginInformation: " + JSON.stringify(loginAccounts));
        next(null, loginAccounts);
      }
    });
  },

  function sendTemplate (loginAccounts, next) {
    // create a new envelope object that we will manage the signature request through
    var envDef = new docusign.EnvelopeDefinition();
    envDef.setEmailSubject("Please sign this document sent from Node SDK)");
    envDef.setTemplateId(templateId);
    
    // create a template role with a valid templateId and roleName and assign signer info
    var tRole = new docusign.TemplateRole();
    tRole.setRoleName(templateRoleName);
    tRole.setName(signerName);
    tRole.setEmail(signerEmail);
    
    // create a list of template roles and add our newly created role
    var templateRolesList = [];
    templateRolesList.push(tRole);
    
    // assign template role(s) to the envelope 
    envDef.setTemplateRoles(templateRolesList);
    
    // send the envelope by setting |status| to "sent". To save as a draft set to "created"
    envDef.setStatus("sent");
    
    // use the |accountId| we retrieved through the Login API to create the Envelope
    var loginAccount = new docusign.LoginAccount();
   jloginAccount = loginAccounts[0];
    var accountId = loginAccount.accountId;
    
    // instantiate a new EnvelopesApi object
    var envelopesApi = new docusign.EnvelopesApi();
    
    // call the createEnvelope() API
    envelopesApi.createEnvelope(accountId, envDef, null, function (error, envelopeSummary, response) {
      if (err) {
        return next(err);
      }
      console.log("EnvelopeSummary: " + JSON.stringify(envelopeSummary));
      next(null);
    });
  }

], function end (error) {
  if (error) {
    console.log('Error: ', error);
    process.exit(1)
  }
  process.exit()
});

See CoreRecipes.js for more examples.

Testing

Unit tests are available in the Test folder.

Support

Feel free to log issues against this client through GitHub. We also have an active developer community on Stack Overflow, search the DocuSignAPI tag.

License

The DocuSign Node Client is licensed under the following License.

Notes

This version of the client library does not implement all of the DocuSign REST API methods. The current client omits methods in the Accounts, Billing, Cloud Storage, Connect, Groups (Branding), and Templates (Bulk Recipients) categories. The client's methods support the core set of use cases that most integrations will encounter. For a complete list of omitted endpoints, see Omitted Endpoints.

Keywords

FAQs

Package last updated on 19 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc