npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

notarize-sdk

0.1.1 • Public • Published

Node.js SDK for Notarize eSign API

It takes minutes to get started with Notarize eSign API. It's free for single signer signature requests.

For full reference, check out https://dev.notarize.com/reference.

Step 0: Create a Notarize API key

Before you start the tutorials, go to https://business.notarize.com/settings/api and click on Generate Full Access Key. Copy the value of the key. We are going to refer to it in the tutorials below as <ApiKey>.

Step 1: Install Node.JS

Install the latest Node.JS at https://nodejs.org/en/download/.

Step 2: Create a sample app

  • Run npm install notarize-sdk or yarn add notarize-sdk if you are a yarn user.
  • Copy and paste the following snippet into a file called app.js.
  • Change <REPLACE WITH YOUR API KEY> with your API key and <REPLACE WITH YOUR EMAIL> with the email you would like to use. You could use your own email when testing this program.
  • Make sure you have a pdf file called sample.pdf in the same directory as app.js.
const fs = require("fs");
const Notarize = require("notarize-sdk");

// Get your API key from https://business.notarize.com/settings/api
const API_KEY = process.env.NOTARIZE_API_KEY || "<REPLACE WITH YOUR API KEY>";

// What email should this signature request be sent to?
const SIGNER_EMAIL = process.env.SIGNER_EMAIL || "<REPLACE WITH YOUR EMAIL>";

const { signatureRequests } = Notarize.init(API_KEY);

const signers = [{
  signer_email: SIGNER_EMAIL, // required
  first_name: "John", // required
  last_name: "Doe"  // required
}];

const files = [
  __dirname + "/sample.pdf"
];

const fields = [
  {
    field_type: "signature",
    signer: 0,
    file: 0,
    page: 1,
    x: 200,
    y: 200,
    width: 200,
    height: 30
  },
  {
    field_type: "initials",
    signer: 0,
    file: 0,
    page: 0,
    x: 200,
    y: 200,
    width: 200,
    height: 30
  }
];

signatureRequests
  .send({
    title: "Sample eSign Document",
    signers,
    files: files.map(f => fs.createReadStream(f)),
    fields,
  })
  .then(document => {
    console.log(`Document successfully sent to ${signers.map(signer => signer.signer_email)}.`);
    console.log(`Use "${document.id}" to retrieve document when it's signed.`);
  }).catch(err => {
    console.log(`Failed to send signature request: ${err}`);
  });

Step 3: Run the app

node app.js

You should receive an email notification within seconds.

install

npm i notarize-sdk

Downloadsweekly downloads

32

version

0.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability