How to create a envelope in Docusign using Node Js

const axios = require('axios')
const path = require('path')
const fs = require('fs')

const docusign = {
    accountID: 'your account id',
    username: 'your email address',
    password: 'your password',
    integratorKey: 'xxxxx-xxxx-xxxx-xxxx-xxxxxxx'
}


const fileBytes = fs.readFileSync(path.resolve(__dirname, '1538129760865_gg2pbkcnkn9.pdf')) // file 

const base64Doc = Buffer.from(fileBytes).toString('base64')

axios({
    method: 'post',
    url: `https://demo.docusign.net/restapi/v2/accounts/${docusign.accountID}/envelopes`,
    headers: {
        'X-DocuSign-Authentication': JSON.stringify({
            "Username": docusign.username,
            "Password": docusign.password,
            "IntegratorKey": docusign.integratorKey
        }),
        'Content-Type': 'application/json'
    },
    data: {
        "recipients": {
            "signers": [
                {
                    "email": "[email protected]",
                    "name": "Arjun",
                    "recipientId": 1,
                    "tabs": {
                        "signHereTabs": [
                            {
                                "xPosition": "120",
                                "yPosition": "36",
                                "documentId": "1",
                                "pageNumber": "1"
                            }
                        ]
                    }
                }
            ]
        },
        "emailSubject": "DocuSign API - Signature Request on Document Call",
        "documents": [
            {
                "documentId": "1",
                "name": "blank1.pdf",
                "documentBase64": base64Doc
            }
        ],
        "status": "sent"
    }
}).then(console.log).catch(console.log)

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

DMCA.com Protection Status