This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var docusign = require('docusign-esign'); | |
var async = require('async'); | |
var integratorKey = '[INTEGRATOR_KEY]', // Integrator Key associated with your DocuSign Integration | |
email = '[EMAIL]', // Email for your DocuSign Account | |
password = '[PASSWORD]', // Password for your DocuSign Account | |
recipientName = '[RECIPIENT_NAME]', // Recipient's Full Name | |
recipientEmail = '[RECIPIENT_EMAIL]'; // Recipient's Email | |
var basePath = "https://demo.docusign.net/restapi"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install NPM package or download source | |
// https://www.npmjs.com/package/docusign-node | |
var docusign = require('docusign-node'); | |
var async = require('async'); | |
var assert = require('assert'); | |
var fs = require('fs'); | |
var integratorKey = "INTEGRATOR_KEY"; | |
var email = "EMAIL"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createAndSendEnvelope (loginAccounts, next) { | |
var fileBytes = null; | |
try { | |
var fs = require('fs'), | |
path = require('path'); | |
// read file from a local directory | |
fileBytes = fs.readFileSync(path.resolve(__filename + '/..' + SignTest1File)); | |
} catch (ex) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install NPM package or download source | |
// https://www.npmjs.com/package/docusign-node | |
var docusign = require('docusign-node'); | |
var async = require('async'); | |
var assert = require('assert'); | |
var fs = require('fs'); | |
var integratorKey = "INTEGRATOR_KEY"; | |
var email = "EMAIL"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createAndSendEnvelopeWithEmbeddedRecipient (loginAccounts, next) { | |
var fileBytes = null; | |
try { | |
var fs = require('fs'), | |
path = require('path'); | |
// read file from a local directory | |
fileBytes = fs.readFileSync(path.resolve(__filename + '/..' + SignTest1File)); | |
} catch (ex) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function requestRecipientView (envelopeId, loginAccounts, next) { | |
// set where the recipient should be re-directed once they are done signing | |
const returnUrl = "http://www.docusign.com/developer-center"; | |
var recipientView = new docusign.RecipientViewRequest(); | |
recipientView.setReturnUrl(returnUrl); | |
recipientView.setUserName("[RECIPIENT_NAME]"); | |
recipientView.setEmail("[RECIPIENT_EMAIL]"); | |
recipientView.setAuthenticationMethod("email"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the authorization code that was added as a query param to the redirect URI. | |
// from the previous request. You should set up a route that handles the redirect | |
// and parses the code so you can then pass it to token endpoint: | |
String code = "{ENTER_YOUR_AUTHORIZATION_CODE}"; | |
// assign it to the token endpoint | |
apiClient.getTokenEndPoint().setCode(code); | |
// optionally register to get notified when a new token arrives | |
apiClient.registerAccessTokenListener(new AccessTokenListener() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthenticationApi authApi = new AuthenticationApi(apiClient); | |
LoginInformation loginInfo = authApi.login(); | |
// note that the user might belong to multiple accounts, here we simply get first | |
String accountId = loginInfo.getLoginAccounts().get(0).getAccountId(); | |
String baseUrl = loginInfo.getLoginAccounts().get(0).getBaseUrl(); | |
// important: below code is required for production as the account sub-domains vary in the | |
// live system. We strip the base URI down to the form https://{env}.docusign.net/restapi | |
// then re-configure the api client with the new base path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the recipient | |
DocuSignWeb.Recipient recipient = new DocuSignWeb.Recipient(); | |
recipient.Email = "Test email"; | |
recipient.UserName = "Testing account"; | |
recipient.Type = DocuSignWeb.RecipientTypeCode.Signer; | |
recipient.ID = "1"; | |
recipient.RoutingOrder = 1; | |
// Need to specify captive info to embed the recipient | |
recipient.CaptiveInfo = new DocuSignWeb.RecipientCaptiveInfo(); |