Code Monkey home page Code Monkey logo

docusign-esign-node-client's Introduction

The Official Docusign eSignature Node Client SDK

NPM version NPM downloads

The Docusign SDK makes integrating Docusign into your apps and websites a seamless experience.

Table of Contents

Introduction

Integrate eSignatures into your application in minutes. The secure and award-winning Docusign eSignature API makes requesting signatures, automating forms, and tracking documents directly from your app easy.

Installation

This client SDK is provided as open source, which enables you to customize its functionality to suit your particular use case. To do so, download or clone the repository. If the SDK’s given functionality meets your integration needs, or if you’re working through our code examples from the Docusign Developer Center, you merely need to install it by following the instructions below.

Version Information

  • API version: v2.1
  • Latest SDK version: 8.0.0

Requirements

Compatibility

  • Node 12+

NPM:

  1. Open your preferred command-line console, then navigate to your project.
  2. In the console, type the following commands:
    npm install docusign-esign -save

SDK Dependencies

This client has the following external dependencies:

Minimum:

  • docusign-esign
  • Axios v1.6.8+
  • @devhigley/parse-proxy v1.0.3+
  • Csv-stringify v1.0.0+
  • Jsonwebtoken v9.0.0+
  • Passport-oauth2 v1.6.1+
  • Safe-buffer v5.1.2+

API Reference

You can refer to the API reference here.

Code examples

Explore our GitHub repository for the Launcher, a self-executing package housing code examples for the eSignature Node SDK. This package showcases several common use cases and their respective source files. Additionally, you can download a version preconfigured for your Docusign developer account from Quickstart. These examples support both the Authorization Code Grant and JSON Web Token (JWT) authentication workflows.

OAuth implementations

For details regarding which type of OAuth grant will work best for your Docusign integration, see Choose OAuth Type in the Docusign Developer Center.

For security purposes, Docusign recommends using the Authorization Code Grant flow.

Changelog

You can refer to the complete changelog here.

Support

Log issues against this client SDK through GitHub. You can also reach out to us through Docusign Community and Stack Overflow.

License

The Docusign eSignature Node Client SDK is licensed under the MIT License.

Additional resources

docusign-esign-node-client's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docusign-esign-node-client's Issues

Unable to send tabs

This issue is related to the post: docusign/docusign-esign-csharp-client#75

I know this is a C# post, but I am going through the exact same issue using the NPM package.

It gives me a "Bad Request" error... I did the same steps on my admin account, got the 'userinfo' CustomField and the code for Tabs.

screen shot 2016-05-19 at 6 55 13 pm

Here is the code:

// create a template role with a valid templateId and roleName and assign signer info
var tRole = new docusign.TemplateRole();
tRole.setRoleName(docusignFields.templateRoleName);
tRole.setName(docusignFields.fullName);
tRole.setEmail(docusignFields.recipientEmail);
tRole.setTabs(new docusign.Tabs());
tRole.getTabs().setTextTabs([]);

var textTab = new docusign.Text();
textTab.setTabLabel("userinfo");
textTab.setValue("IT WORKS!!!");
tRole.getTabs().getTextTabs().push(textTab);

// 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();
loginAccount = 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 (err, envelopeSummary, response) {

    if (err) {
        defer.reject("[DOCUSIGN] Error: " + err);
    } else {
        console.log('EnvelopeSummary: ' + JSON.stringify(envelopeSummary));
        defer.resolve(envelopeSummary);
    }

});```

Any ideas?

TypeError: self.envelopeTemplateDefinition.constructFromObject is not a function

I am getting error when use TemplateApi.get method:

TypeError: self.envelopeTemplateDefinition.constructFromObject is not a function

at EnvelopeTemplate.self.constructFromObject (\node_modules\docusign-esign\src\model\EnvelopeTemplate.js:304:41)
at handleResponse (\node_modules\docusign-esign\src\api\TemplatesApi.js:183:20)
at \node_modules\docusign-esign\src\ApiClient.js:215:9
at Request.callback (\node_modules\docusign-esign\node_modules\superagent\lib\node\index.js:816:12)
at IncomingMessage. (\node_modules\docusign-esign\node_modules\superagent\lib\node\index.js:1046:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)

TypeError: boolean is not a function in envelopes.js

TypeError: boolean is not a function

at Request._callback (/node_modules/docusign-node/dsUtils.js:142:7)
at Request.self.callback (/node_modules/docusign-node/node_modules/request/index.js:148:22)
at Request.emit (events.js:110:17)
at Request. (/node_modules/docusign-node/node_modules/request/index.js:886:14)
at Request.emit (events.js:129:20)
at IncomingMessage. (/node_modules/docusign-node/node_modules/request/index.js:837:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)

change envelopes.js line 812
dsUtils.makeRequest('Get List of Recipients', options, false, callback); => dsUtils.makeRequest('Get List of Recipients', options, callback);

Getting a list of tags from a template

Hello,

I'm trying to create an envelope and then query the list of tags present in that envelope in order to populate them dynamically. After calling envDef.setTemplateId('xxx') is there a way to query the tags similar to https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{templateId}}/recipients?include_tabs=true&include_extended=true so that these can then be populated dynamically?

I can't seem to find this in the API docs.

Or even: GET /v2/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients

I can achieve by writing:

rp({
        method: 'get',
        uri: `${config.docusign.baseUrl}/v2/accounts/${accountId}/templates/${templateId}/recipients?include_tabs=true&include_extended=true`,
        headers: {
          'X-DocuSign-Authentication': creds
        },
        json: true
      })
      .then(response => {
        console.log(response.signers.tabs.textTabs)

.
.
.

But is there something within the library that does this call?

Prefixing Text Fields 'Tab Label' with \\* has undocumented behavior

I'm concerned the Asterisk functionality is working incorrectly. I'm not sure if its on the Node side of docusign or the docusign API backend.

When you have a field like VerificationNo and SecondaryVerificationNo setup in your document and you use a text field label in this way {"tabLabel":"\\*VerificationNo","value":"######"} (without sending SecondaryVerificationNo) it'll populate both fields with the data provided in VerificationNo. Is this a bug or how its intended?

Script to get initial `config.json` values

It's unclear how one is supposed to get the values for:

  • DOCUSIGN_TEST_ENVELOPE_ID
  • DOCUSIGN_TEST_TEMPLATE_ID
  • DOCUSIGN_TEST_TEMPLATE_ROLE

To improve the first user experience when running tests or trying this module out, it would be useful to have a script which gets this values and populates them in the config.json

refactor to decouple oauth token fetch from init

Every time someone uses the package to log a given user in they consume 2 API calls.

This has the negative side effect of eating an unnecessary call. We could handle this more cleanly if we make the SDK consumers store they oauth token and use it explicitly for every call.

Alternatively they could also choose to use username/password auth for every call as well.

Need some time to think about how this should be implemented.

Display SecureField initial value to all recipients via API

In order to show the contents of tabs to other signers, I had to move from the new docusign UI to the classic one and then go to Preferences > Features and turn on Display SecureField initial value to all recipients

screen shot 2017-05-23 at 13 38 59

Is is possible to do this with the API? Because I've lost about 3 days looking for this and it is extremely unclear.

Some DocuSign API calls don't like null as object property value

The Node SDK sets up some object properties to null (Such as EnvelopeDefinition), which makes the API call fail with 404 ("The request body is missing or improperly formatted. Null object cannot be converted to a value type.").

A workaround is to loop through the object properties recursively and delete the properties that has null values in them, before calling DocuSign API. Here is a code snippet:

removeNulls(envelopeDefinition);
envelopesApi.createEnvelope(dsAccountId, envelopeDefinition, null, function(error, envelopeSummary, response) {
}

Here is the code for removeNulls helper function:

removeNulls = function(obj) {
  var isArray = obj instanceof Array;
  for (var k in obj) {
    if (obj[k] === null) isArray ? obj.splice(k, 1) : delete obj[k];
    else if (typeof obj[k] == "object") removeNulls(obj[k]);
    if (isArray && obj.length == k) removeNulls(obj);
  }
  return obj;
}

document tabs not populating sdk 3.0.0

here is my code to populate fields in the template i uploaded to my docusign account.

var role, tabs, textTab, textTabs, val;

role = new docusign.TemplateRole;
role.roleName = 'something';
role.name = 'nothing';
role.email = '[email protected]';

textTabs = []
textTab = new docusign.Text;
textTab.tabLabel = 'foo';
textTab.value = 'bar';

textTabs.push(textTab);

tabs = new docusign.Tabs;
tabs.textTabs = textTabs;

role.tabs = tabs;

The tabs are not filling up with the content.
Anyone?

Update documentation please

Hi, great work with the node client. I think it'll be alot easier for people unfamiliar w the codebase if the code samples/readme reflect the recent changes being made to the node client itself.

Example : The getter and setters are scrapped from the node client but the github repo still has examples using those getter and setters that no longer work anymore.

Apart from that, its a nice client 💯

Constructor error

Hello,
I am receiving the below error on CoreRecipes.js. Can anyone please correct what is wrong on this.

var loginOps = new authApi.LoginOptions();
^
TypeError: authApi.LoginOptions is not a constructor
at RequestSignatureOnDocument (/root/IdeaProjects/docusignapp/test/Recipes/CoreRecipes.js:51:18)
at Object. (/root/IdeaProjects/docusignapp/test/Recipes/CoreRecipes.js:959:1)
at Module._compile (module.js:570:14)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3

Docusign hangs when making a sendTemplate request even though a response is received

Using the example from introduction. It seems like the issue is in here as the request callback is not passed into the method

return dsUtils.makeRequest('Send Template', options);

The following method update seems to do the trick:

add
 * @param {function} [callback] - Returns the response body from DS API
add parameter at the end:
function sendTemplate (apiToken, baseUrl, emailSubject, templateId, templateRoles, additionalParams, callback) {

add parameter at the end
return dsUtils.makeRequest('Send Template', options, callback);

Make sure to update the example as follows

client.envelopes.sendTemplate(subject, templateId, templateRoles, null, function (err, response) {

What's the latest and the stable version of the client?

I see master branch is different from 8.x.x tag. Also there are branches like 8.x.x and oauth. Which one should I be using for production?

Assume I'll install npm install docusign-esign --save, I assume the package installed is the one from master branch? or which one?

type.constructFromObject is not a function

At the moment, I have:

function listRecipientsFromTemplate(
  accountId,
  templateId,
  opts
) {
  return new Promise((resolve, reject) => {
    try {
      const templatesApi = new docusign.TemplatesApi();

      templatesApi.listRecipients(accountId, templateId, opts, (error, data, response) => {
        if (error) {
          if (debug) console.log(chalk.red(error));
          return reject(error);
        }
        return resolve(data);
      });
    } catch(e) {
      return reject(e);
    }
  });
}

But I am getting (node:14176) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): AssertionError: expected [TypeError: type.constructFromObject is not a function] to have a property 'firstName'.

I can't seem to find out what the issue is? My template does not include a firstName property.

If I remove all of the fields apart from one Signature tab, I can move forward but when I get to creating an envelope, I get:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): AssertionError: expected [Error: Bad Request] to have a property 'firstName'

Update

My opts looks like:

{
  includeTabs: true
}

If I set to null, I get further but I still get the error: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): AssertionError: expected [Error: Bad Request] to have a property 'firstName'

Not support promise?

I tried:

authApi.login(loginOps).then(function(){
...
});

Getting this error:

authApi.login(...).then(...).then(...).then(...).catch
     is not a function

Add more examples

I think it's hard to get even the tests running since even before you can, you need to:

  • create an envelope
  • create a template

It would be useful to new consumers of this module to have a guide for how to do this programmatically using this module.

API does not conform to the Node.js style of error passing

The API this module implements is very inconsistent throughout the code base. Sometimes calling callbacks with error first, other times wrapping the error in a plain object and sticking it on an error property.

This goes against the standard of always passing errors as the first parameter to any callback, and this module should be refactored to follow that standard.

Also there seems to be a pattern of passing strings as errors, when in fact a custom error class should be used instead.

sendEnvelope does not support many available request parameters

First off, thanks for maintaining an official Node.js client!

Second, if I'm reading the source correctly, it seems like the Envelopes.sendEnvelope function only supports the recipient, files, and subject request params.

In particular, I'm interested in the EventNotification param, but was wondering if you'd see any problem with me simply adding an additionalParams argument to the sendEnvelope function signature that would get merged into the request body before sending (https://github.com/docusign/DocuSign-Node-Client/blob/master/components/envelopes.js#L294)?

All params listed here

Add comma on docusign.js:121

/node_modules/docusign-node/docusign.js:121
createClientFromAuthAsync: bluebird.promisify(createClientBase),
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier

Sample not working

Hi there!

I'd propose to have several fixes in your sample (Async one).

  1. Typo (was "succesfully")
if (response.message === 'successfully initialized') {
  1. The argument passed in createClient should be "client", not "docusign.client":
    function createClient(next) {
        docusign.client(email, password, function (err, client) {
            if (err) {
                return next(err);
            }
            next(null, client);
        });
    }

Where can I find docs for the 2.1.0?

Our codebase is somewhat legacy and I'm trying to change from Legacy Header to OAuth without having to update to 3.2.1. Do you have any available documentation for 2.1.0?

tabs.constructFromObject is not a function

Hi

Having issues with node sdk. The models dont seems to export the .constructFromObject method.

const docusign = require('docusign-esign');
var tab = new docusign.Text();
tab.constructFromObject(data);

This is throwing an error. tab.constructFromObject is not a function. I have checked the source and it is there.

Cheers
Olaf

Resend / Update Recipient Info

It would be nice if we had a way of updating a recipient's name / email to trigger a new email to be sent out through this library.

Basic info on how to trigger a resend / update a recipient's info can be found here. It's pretty easy to trigger API-wise, just a matter of setting it up in the library.

Does this sound like something you guys would be willing to add? It seems fairly simple, though I've not dug in deep into the library to know what implementation would look like.

PDF form fields are not detected by DocuSign

I have a PDF file with form fields.
I have successfully uploaded pdf template, but fields are not detected by DocuSign for some reason.
Are there any options which I need to turn on/off? Please advice.

Tests are very fragile

The tests rely on way too much external state to be useful. They should be mocked out use nock not only to run faster but to also run reliably.

Updating account settings

I'm trying to use this: PUT /v2/accounts/{accountId}/settings.

The docs here: https://docs.docusign.com/esign/restapi/Accounts/Accounts/updateSettings/#/definitions/accountSettingsInformation suggest that the requestBody should be called accountSettingsInformation and yet the JSON example shows:

{
    "accountSettings": [
        {}
    ]
}

However, the API looks like it fetches: opts['accountSettingsInformation'];
https://github.com/docusign/docusign-node-client/blob/master/src/api/AccountsApi.js#L1986

 var postBody = opts['accountSettingsInformation'];

Fix

function accountSettings(accountId) {
  return new Promise((resolve, reject) => {
      const accountsApi = new docusign.AccountsApi();
      const opts = {
        accountSettingsInformation: {
          accountSettings: [{
            name: 'signerShowSecureFieldInitialValues',
            value: 'true'
          }]
        }
      };

      accountsApi
      .updateSettings(accountId, opts, (err, data, response) => {
        if (err) return reject(err);
        return resolve(accountId);
      });
  });
}

Rate Limit

Is these node module builtin implementation of DocuSign rate limit or not?

Proxy Server

Our severs behind firewall, how to setup the proxy server for the API client

Broke all of our buillds

Hey guys, I understand you wanted to change the name of your node module to docusign instead of docusign-node, but you cannot simply abuse npm and unpublish all your old versions and not even make them available.

According to #38 you've said you follow semver, which means that 7.0 is not compatible with 6.0. So I cannot even hardlink my services to the version I was using, and our entire organization has QA'd and tested.

Is there something I'm missing? Is there a reason why all versions < 7 are no longer available on npm?

JSDoc usage example isnt working.

Trying to use: http://docusign.github.io/docusign-node-client/
Getting the error docusign.ApiClient is not a function.

My code up to the error:

/* DOCUSIGN  */
var docusign = require('docusign');
var async = require('async');
var email = process.env.EMAIL;
var integratorKey = process.env.INTEGRATOR_KEY;
var password = process.env.API_PASSWORD;
var docusignEnv = 'demo';
var fullName = 'Max Ray';
var recipientEmail = process.env.EMAIL;
var templateId = process.env.TEMPLATE_ID;
var templateRoleName = 'testing';
var debug = true;

var templateRoles = ({
    email: email,
    name: fullName,
    roleName: templateRoleName
});
var additionalParams = {};

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

Add a roadmap

So potential contributors have a clear idea of where we want to go, and potential consumers can suggest for features.

Account ID Inconsistency in request headers

During the Docusign certification process, I was notified that it seems like for multi-part requests, we are sending the actual AccountId as the header, instead of the Guid.

This is just a FYI. Not critical to be changed, but would be nice for it to be consistent.

From my initial investigation, it seems to be caused by the different methods used to construct the headers between dsUtils.makeRequest and dsUtils.sendMultipart

Remove duplicated methods via promisify

The API stands to be cleaner if we move the promisification within each method whereby the return value is a promise if no callback is given to the method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.