1.8.0 • Published 7 years ago

yousign-nodejs-api-wrapper v1.8.0

Weekly downloads
13
License
MIT
Repository
github
Last release
7 years ago

YouSign-NodeJS-API-Wrapper

A Node.js API client for the YouSign signature API. Works as a wrapper around the Yousign PHP API client

The original PHP Api : https://github.com/Yousign/yousign-api-client-php

Usage:

  1. Get a recent Node.js version (with ES6 support)
  2. Install PHP (version 7+ recommended). Make it so that you can run php by typing "php" in terminal
  3. Install this module into your project
npm i yousign-nodejs-api-wrapper --save
  1. Copy example_ysApiParameters.ini in the module's folder into your project root, rename it to ysApiParameters.ini
  2. Set your Yousign credentials into the file. Please note that if isEncryptedPassword = true your password must be in the following format : sha1(sha1(YOUR_PASSWORD)+sha1(YOUR_PASSWORD)) (with + being a concat operator). Otherwise set the boolean to false and just leave it as clear text. But that's bad mkay.
  3. Import the index.js module into your project
  4. Call the checkAuth() function (all functions are promise-based, so you can do .then and .catch on it

How to list signatures:

var ysAPIWrapper = require('yousign-nodejs-api-wrapper')

ysAPIWrapper.listSignatures("jean@dubois.org").then((res)=>{
    console.log(res)
}).catch((err)=>{
    console.error(err)
})

Available functions :

checkAuth()

Checks if the YouSign API is up and if our credentials are valid

Kind: global function

initSignature(filesToSign, firstName, lastName, email, phone, signatures, userSuccessRedirectUrl, userCancelRedirectUrl, onSignatureStatusChangedUrl) ⇒ string | object

Inits a signature and returns the url of the signing page

Kind: global function Returns: string - iframeUrl - the url of the iframe to do the signatureobject - details - details of the signature, contains de demand ID which can be used later on

ParamTypeDescription
filesToSignarrayAn array of absolute paths to the documents that you wish to sign. Example : /Users/joe/document1.pdf, /Users/joe/document2.pdf Alternatively, you can send a string if you only have one file to sign Example : document1.pdf
firstNamestringFirstname of the person that will sign
lastNamestringLastname of the person that will sign
emailstringEmail of the person that will sign
phonestringPhone of the person that will sign, including prefix (+33...). Must be a real Phone number as the user will receive an SMS confirmation code.
signaturesarrayAn array of objects, each object containing the following data for a signature : page, document number, pixel coordinates of the rectangle where it will appear. Example for two signatures on page 2 and 4 on the first document of the filesToSign, and on page 2 of the second document: {rectangleCoords: "337,59,572,98", page:"2", document:"1"}, {rectangleCoords: "337,193,572,232", page:"4", document:"1"}, {rectangleCoords: "100,200,300,400", page:"2", document:"2"}, If you only have one signature, and want to put on page 1 of first document, you can send only a string of coordinates instead of an array : "337,59,572,98"
userSuccessRedirectUrlstringA url where the user will be redirected to after he signs
userCancelRedirectUrlstringA url where the user will be redirected to after he cancels the signature process
onSignatureStatusChangedUrlstringThe YouSign server will send GET requests to this url when the signature status changes. Statuses can be : init, cancel, waiting, signed, signed_complete

downloadSignaturesFiles(search, absoluteOutFolderPath)

Downloads all the files in the signature process corresponding to the search parameter provided

Kind: global function

ParamTypeDescription
searchstringThe YouSign search parameters. This can be the email of the person who signed, the filename... Example : john@test.com - will download all the files in a signature process with john@test.com
absoluteOutFolderPathstringAn absolute path to the output folder for the downloaded files (without trailing /) Example : /Users/joe/out - the folder MUST already exist and be writeable

listSignatures(email)

Lists the existing signatures and the corresponding statuses for an email

Kind: global function

ParamTypeDescription
emailstringEmail of the person whose signatures we want to get
1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago