├── test ├── mocha.opts ├── docs │ ├── Term_Of_Service.pdf │ ├── World_Wide_Corp_fields.pdf │ ├── World_Wide_Corp_lorem.pdf │ ├── World_Wide_Corp_salary.docx │ └── World_Wide_Corp_Battle_Plan_Trafalgar.docx ├── testConfig.js └── bulkEnvelopesTests.js ├── Procfile ├── public ├── source │ └── .gitkeep ├── images │ └── header.png └── assets │ └── favicon.png ├── .eslintignore ├── views ├── .DS_Store ├── pages │ ├── .DS_Store │ ├── rooms-examples │ │ ├── .DS_Store │ │ ├── eg005GetRoomsWithFilters.ejs │ │ ├── eg001CreateRoomWithData.ejs │ │ ├── eg007CreateFormGroup.ejs │ │ ├── eg003ExportDataFromRoom.ejs │ │ ├── eg006SelectRoomForExternalFormFillSession.ejs │ │ ├── eg006CreateExternalFormFillSession.ejs │ │ ├── eg004AddingFormToRoom.ejs │ │ ├── eg008GrantOfficeAccessToFormGroup.ejs │ │ ├── eg002CreateRoomFromTemplate.ejs │ │ └── eg009AssignFormToFormGroup.ejs │ ├── invalid_with_cfr.ejs │ ├── restart.ejs │ ├── maestro-examples │ │ ├── eg001EmbedWorkflow.ejs │ │ ├── eg001PublishWorkflow.ejs │ │ ├── eg002PauseWorkflow.ejs │ │ ├── eg003ResumeWorkflow.ejs │ │ └── eg004CancelWorkflow.ejs │ ├── eg006RoomsExampleDone.ejs │ ├── index_rooms_examples.ejs │ ├── index_examples.ejs │ ├── admin-examples │ │ ├── eg004ImportUser.ejs │ │ ├── eg005AuditUsers.ejs │ │ ├── eg003BulkExportUserData.ejs │ │ ├── eg004CheckStatus.ejs │ │ ├── eg007GetUserProfileByUserId.ejs │ │ ├── eg006GetUserProfileByEmail.ejs │ │ ├── eg010DeleteUserDataFromOrganization.ejs │ │ ├── eg011DeleteUserDataFromAccount.ejs │ │ ├── eg013CreateAccount.ejs │ │ ├── eg009DeleteUserProductPermissionProfile.ejs │ │ └── eg012CloneAccount.ejs │ ├── examples │ │ ├── eg008CreateTemplate.ejs │ │ ├── eg003ListEnvelopes.ejs │ │ ├── eg024CreatePermission.ejs │ │ ├── eg039SigningInPerson.ejs │ │ ├── eg015EnvelopeTabData.ejs │ │ ├── eg006EnvelopeDocs.ejs │ │ ├── eg018EnvelopeCustomFieldData.ejs │ │ ├── eg004EnvelopeInfo.ejs │ │ ├── eg005EnvelopeRecipients.ejs │ │ ├── eg045RestoreEnvelope.ejs │ │ ├── eg045DeleteEnvelope.ejs │ │ ├── eg033UnpauseSignatureWorkflow.ejs │ │ ├── eg028CreateBrand.ejs │ │ ├── eg012EmbeddedConsole.ejs │ │ ├── eg023IdvAuthentication.ejs │ │ ├── eg022KbaAuthentication.ejs │ │ ├── eg001EmbeddedSigning.ejs │ │ ├── eg044FocusedView.ejs │ │ ├── eg027DeletePermission.ejs │ │ ├── quickEmbeddedSigning.ejs │ │ ├── eg025PermissionSetUserGroup.ejs │ │ ├── eg016SetTabValues.ejs │ │ ├── eg043SharedAccess.ejs │ │ ├── eg035ScheduledSending.ejs │ │ ├── eg007EnvelopeGetDoc.ejs │ │ ├── eg019AccessCodeAuthentication.ejs │ │ ├── eg020PhoneAuthentication.ejs │ │ ├── eg041CFREmbeddedSigning.ejs │ │ ├── eg002SigningViaEmail.ejs │ │ ├── eg010SendBinaryDocs.ejs │ │ ├── eg038ResponsiveSigning.ejs │ │ ├── eg029ApplyBrandToEnvelope.ejs │ │ ├── eg036DelayedRouting.ejs │ │ └── eg014CollectPayment.ejs │ ├── monitor-examples │ │ ├── eg001GetMonitoringData.ejs │ │ └── eg002PostWebQuery.ejs │ ├── navigator-examples │ │ ├── eg001ListAgreements.ejs │ │ └── eg002GetSingleAgreement.ejs │ ├── click-examples │ │ ├── eg004ListClickwraps.ejs │ │ ├── eg001CreateClickwrap.ejs │ │ ├── eg005ClickwrapResponses.ejs │ │ ├── eg002ActivateClickwrap.ejs │ │ └── eg003CreateNewClickwrapVersion.ejs │ ├── webforms-examples │ │ ├── eg001CreateInstance.ejs │ │ ├── eg001WebFormCreate.ejs │ │ ├── eg002WebFormCreate.ejs │ │ └── eg002CreateRemoteInstance.ejs │ ├── error_eg34.ejs │ ├── error.ejs │ ├── error_monitor.ejs │ ├── example_done.ejs │ ├── ds_must_authenticate.ejs │ ├── workspaces-examples │ │ ├── eg001CreateWorkspace.ejs │ │ ├── eg005CreateUploadRequest.ejs │ │ └── eg003SendEnvelopeWithRecipientInfo.ejs │ ├── choose_api.ejs │ ├── example_click6_done.ejs │ ├── ds_return.ejs │ ├── connect-examples │ │ └── eg001ValidateWebhookMessage.ejs │ ├── notary-examples │ │ └── eg004SendThirdPartyNotary.ejs │ └── connected-fields │ │ └── eg001SetConnectedFields.ejs └── partials │ ├── genericFoot.ejs │ ├── continueButton.ejs │ ├── docBody.ejs │ ├── submitButton.ejs │ ├── gitSource.ejs │ ├── functions.ejs │ ├── examplesFoot.ejs │ ├── examplesHead.ejs │ ├── examplesHeadQuickACG.ejs │ ├── genericHead.ejs │ ├── exampleInfo.ejs │ ├── foot.ejs │ └── sourceChooser.ejs ├── lib ├── monitor │ ├── controllers │ │ └── index.js │ └── examples │ │ └── getMonitoringData.js ├── connect │ ├── controllers │ │ └── index.js │ └── examples │ │ └── validateWebhookMessage.js ├── notary │ └── controllers │ │ └── index.js ├── connectedFields │ └── controllers │ │ └── index.js ├── navigator │ ├── controllers │ │ └── index.js │ └── examples │ │ ├── listAgreements.js │ │ └── getSingleAgreement.js ├── webforms │ └── controllers │ │ └── index.js ├── maestro │ ├── controllers │ │ └── index.js │ └── examples │ │ ├── pauseWorkflow.js │ │ ├── resumeWorkflow.js │ │ ├── cancelWorkflow.js │ │ └── triggerWorkflow.js ├── workspaces │ ├── controllers │ │ └── index.js │ └── examples │ │ ├── createWorkspace.js │ │ ├── addDocumentToWorkspace.js │ │ └── createUploadRequest.js ├── click │ ├── controllers │ │ └── index.js │ └── examples │ │ ├── listClickwraps.js │ │ ├── clickwrapResponses.js │ │ └── activateClickwrap.js ├── simple_agreement.html ├── rooms │ ├── controllers │ │ └── index.js │ └── examples │ │ ├── getRoomsWithFilters.js │ │ ├── createFormGroup.js │ │ ├── exportDataFromRoom.js │ │ ├── createExternalFormFillSession.js │ │ └── addingFormToRoom.js ├── admin │ ├── examples │ │ ├── getUserProfileByUserId.js │ │ ├── getUserProfileByEmail.js │ │ ├── deleteUserDataFromAccount.js │ │ ├── importUser.js │ │ ├── auditUsers.js │ │ ├── deleteUserDataFromOrganization.js │ │ ├── deleteUserProductPermissionProfile.js │ │ ├── cloneAccount.js │ │ └── createUser.js │ ├── controllers │ │ └── index.js │ └── getOrganizationId.js ├── common │ └── config.js ├── manifestService.js └── eSignature │ ├── getData.js │ └── examples │ ├── envelopeDocs.js │ ├── envelopeRecipients.js │ ├── envelopeInfo.js │ ├── createBrand.js │ ├── envelopeTabData.js │ ├── envelopeCustomFieldData.js │ ├── deletePermission.js │ ├── unpauseSignatureWorkflow.js │ ├── listEnvelopes.js │ ├── applyBrandToTemplate.js │ ├── permissionChangeSingleSetting.js │ ├── permissionSetUserGroup.js │ ├── embeddedConsole.js │ ├── deleteRestoreEnvelope.js │ └── createPermission.js ├── demo_documents ├── Welcome.txt ├── Term_Of_Service.pdf ├── Offer_Letter_Demo.docx ├── World_Wide_Corp_fields.pdf ├── World_Wide_Corp_lorem.pdf ├── World_Wide_Corp_Web_Form.pdf ├── World_Wide_Corp_salary.docx ├── Offer_Letter_Dynamic_Table.docx ├── World_Wide_Corp_fields_shown.docx ├── World_Wide_Corp_Battle_Plan_Trafalgar.docx └── userData.csv ├── config ├── examplesAPI.json ├── github.json ├── index.js ├── appsettings.example.json └── documentOptions.json ├── docs └── stripe_skip_account_form_link.png ├── jwt_console_project ├── jwtConfig.example.json └── package.json ├── Dockerfile ├── PAYMENTS_INSTALLATION.md ├── LICENSE ├── .gitignore ├── .github └── workflows │ └── node.js.yml ├── quick_acg └── package.json └── package.json /test/mocha.opts: -------------------------------------------------------------------------------- 1 | --recursive -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node index.js 2 | -------------------------------------------------------------------------------- /public/source/.gitkeep: -------------------------------------------------------------------------------- 1 | gitkeep 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | config/* 2 | public/* 3 | node_modules/* 4 | test/* 5 | -------------------------------------------------------------------------------- /views/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/views/.DS_Store -------------------------------------------------------------------------------- /lib/monitor/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001monitor = require('./eg001GetMonitoringData'); 2 | -------------------------------------------------------------------------------- /lib/connect/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001connect = require('./eg001ValidateWebhookMessage'); 2 | -------------------------------------------------------------------------------- /lib/notary/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg004notary = require('./eg004SendThirdPartyNotary'); 2 | -------------------------------------------------------------------------------- /views/pages/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/views/pages/.DS_Store -------------------------------------------------------------------------------- /views/partials/genericFoot.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include("foot") %> 4 | -------------------------------------------------------------------------------- /lib/connectedFields/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001fields = require('./eg001SetConnectedFields'); 2 | -------------------------------------------------------------------------------- /public/images/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/public/images/header.png -------------------------------------------------------------------------------- /demo_documents/Welcome.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to the DocuSign Recruiting Event 5 | 6 | 7 | Please Sign in! -------------------------------------------------------------------------------- /public/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/public/assets/favicon.png -------------------------------------------------------------------------------- /test/docs/Term_Of_Service.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/test/docs/Term_Of_Service.pdf -------------------------------------------------------------------------------- /demo_documents/Term_Of_Service.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/Term_Of_Service.pdf -------------------------------------------------------------------------------- /test/docs/World_Wide_Corp_fields.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/test/docs/World_Wide_Corp_fields.pdf -------------------------------------------------------------------------------- /test/docs/World_Wide_Corp_lorem.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/test/docs/World_Wide_Corp_lorem.pdf -------------------------------------------------------------------------------- /views/pages/rooms-examples/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/views/pages/rooms-examples/.DS_Store -------------------------------------------------------------------------------- /views/partials/continueButton.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/examplesAPI.json: -------------------------------------------------------------------------------- 1 | {"examplesApi":{"isESignatureApi":true,"isRoomsApi":false,"isClickApi":false,"isMonitorApi":false,"isAdminApi":false}} -------------------------------------------------------------------------------- /demo_documents/Offer_Letter_Demo.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/Offer_Letter_Demo.docx -------------------------------------------------------------------------------- /docs/stripe_skip_account_form_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/docs/stripe_skip_account_form_link.png -------------------------------------------------------------------------------- /test/docs/World_Wide_Corp_salary.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/test/docs/World_Wide_Corp_salary.docx -------------------------------------------------------------------------------- /demo_documents/World_Wide_Corp_fields.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/World_Wide_Corp_fields.pdf -------------------------------------------------------------------------------- /demo_documents/World_Wide_Corp_lorem.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/World_Wide_Corp_lorem.pdf -------------------------------------------------------------------------------- /demo_documents/World_Wide_Corp_Web_Form.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/World_Wide_Corp_Web_Form.pdf -------------------------------------------------------------------------------- /demo_documents/World_Wide_Corp_salary.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/World_Wide_Corp_salary.docx -------------------------------------------------------------------------------- /demo_documents/Offer_Letter_Dynamic_Table.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/Offer_Letter_Dynamic_Table.docx -------------------------------------------------------------------------------- /views/partials/docBody.ejs: -------------------------------------------------------------------------------- 1 | <% if (showDoc) { %> 2 |

Documentation about this example.

3 | <% } %> -------------------------------------------------------------------------------- /demo_documents/World_Wide_Corp_fields_shown.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/World_Wide_Corp_fields_shown.docx -------------------------------------------------------------------------------- /test/docs/World_Wide_Corp_Battle_Plan_Trafalgar.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/test/docs/World_Wide_Corp_Battle_Plan_Trafalgar.docx -------------------------------------------------------------------------------- /lib/navigator/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001Navigator = require('./eg001ListAgreements'); 2 | module.exports.eg002Navigator = require('./eg002GetSingleAgreement'); 3 | -------------------------------------------------------------------------------- /config/github.json: -------------------------------------------------------------------------------- 1 | { 2 | "UserAgent": "Example Source Updater", 3 | "AppId": 0, 4 | "ApiUrl": "https://api.github.com/", 5 | "InstallationId": 0, 6 | "PrivateKey": "" 7 | } -------------------------------------------------------------------------------- /demo_documents/World_Wide_Corp_Battle_Plan_Trafalgar.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-node/master/demo_documents/World_Wide_Corp_Battle_Plan_Trafalgar.docx -------------------------------------------------------------------------------- /lib/webforms/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001webforms = require('./eg001CreateInstance'); 2 | module.exports.eg002webforms = require('./eg002CreateRemoteInstance'); 3 | -------------------------------------------------------------------------------- /views/partials/submitButton.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo_documents/userData.csv: -------------------------------------------------------------------------------- 1 | AccountID,FirstName,LastName,UserEmail,PermissionSet 2 | {account_id},First1,Last1,example1@sampleemail.example,DS Admin 3 | {account_id},First2,Last2,example2@sampleemail.example,DS Admin -------------------------------------------------------------------------------- /jwt_console_project/jwtConfig.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "dsJWTClientId": "{INTEGRATION_KEY_JWT}", 3 | "impersonatedUserGuid": "{IMPERSONATED_USER_ID}", 4 | "privateKeyLocation": "./private.key", 5 | "dsOauthServer": "https://account-d.docusign.com" 6 | } -------------------------------------------------------------------------------- /lib/maestro/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001maestro = require('./eg001TriggerWorkflow'); 2 | module.exports.eg002maestro = require('./eg002PauseWorkflow'); 3 | module.exports.eg003maestro = require('./eg003ResumeWorkflow'); 4 | module.exports.eg004maestro = require('./eg004CancelWorkflow'); 5 | -------------------------------------------------------------------------------- /views/pages/invalid_with_cfr.ejs: -------------------------------------------------------------------------------- 1 | <% title = "Error" %> 2 | <%- include("../partials/genericHead") %> 3 |

Problem: an error occurred

4 | 5 |

<%- locals.manifest.SupportingTexts.CFRError %>

6 | 7 |

Continue

8 | 9 | <%- include("../partials/genericFoot") %> 10 | -------------------------------------------------------------------------------- /views/pages/restart.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 |
3 |
4 |

Please restart the app to finish switching to a new API.

5 |

Quit the current app with Control + C, then run npm start again.

6 | 7 | <%- include("../partials/genericFoot") %> 8 | -------------------------------------------------------------------------------- /views/partials/gitSource.ejs: -------------------------------------------------------------------------------- 1 | <% include("functions") %> 2 | 3 | <% if (! locals.dsConfig.multiSourceChooser) { %> 4 |

5 | <%- 6 | formatString(locals.manifest.SupportingTexts.ViewSourceFile, formatString('{1}', sourceUrl, sourceFile)) 7 | %> 8 |

9 | <% } %> -------------------------------------------------------------------------------- /lib/workspaces/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001workspaces = require('./eg001CreateWorkspace'); 2 | module.exports.eg002workspaces = require('./eg002AddDocumentToWorkspace'); 3 | module.exports.eg003workspaces = require('./eg003SendEnvelopeWithRecipientInfo'); 4 | module.exports.eg005workspaces = require('./eg005CreateUploadRequest'); -------------------------------------------------------------------------------- /views/partials/functions.ejs: -------------------------------------------------------------------------------- 1 | <% 2 | formatString = function(inputString) { 3 | var args = Array.prototype.slice.call(arguments, 1); 4 | return inputString.replace(/{(\d+)}/g, function(match, number) { 5 | return typeof args[number] !== 'undefined' 6 | ? args[number] 7 | : match 8 | ; 9 | }); 10 | } 11 | %> -------------------------------------------------------------------------------- /views/partials/examplesFoot.ejs: -------------------------------------------------------------------------------- 1 | <% if (locals.dsConfig.multiSourceChooser) { %> 2 | 3 |
4 | <%- include("sourceChooser") %> 5 |
6 | 7 | <% } %> 8 | 9 | 10 | <%- include("foot") %> 11 | -------------------------------------------------------------------------------- /lib/click/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001click = require('./eg001CreateClickwrap'); 2 | module.exports.eg002click = require('./eg002ActivateClickwrap'); 3 | module.exports.eg003click = require('./eg003CreateNewClickwrapVersion'); 4 | module.exports.eg004click = require('./eg004ListClickwraps'); 5 | module.exports.eg005click = require('./eg005ClickwrapResponses'); 6 | module.exports.eg006click = require('./eg006EmbedClickwrap'); 7 | -------------------------------------------------------------------------------- /views/pages/maestro-examples/eg001EmbedWorkflow.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 |

<%= title %>

4 |

<%- message %>

5 | 6 | 9 | 10 | 13 | 14 |

Continue

15 | 16 | <%- include("../../partials/examplesFoot") %> 17 | -------------------------------------------------------------------------------- /views/pages/maestro-examples/eg001PublishWorkflow.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 |

<%= example.ExampleName %>

4 |

<%- formatString(message, consentUrl) %>

5 | 6 |
7 | 8 | <%- include("../../partials/continueButton") %> 9 |
10 | 11 | <%- include("../../partials/examplesFoot") %> -------------------------------------------------------------------------------- /views/pages/eg006RoomsExampleDone.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 | 3 |

<%= title %>

4 |

<%- message %>

5 | 6 | <%- json %> 7 | 8 |

9 | //ds-snippet-start:Rooms6Step5 10 | 13 | //ds-snippet-end:Rooms6Step5 14 |

15 | 16 |

Continue

17 | 18 | <%- include("../partials/genericFoot") %> -------------------------------------------------------------------------------- /views/pages/index_rooms_examples.ejs: -------------------------------------------------------------------------------- 1 | 2 | <% if (showDoc) { %> 3 |

Documentation on using OAuth Authorization Code Grant and JWT from 4 | a Node Express application.

5 | <% } %> 6 | 7 | <% if (locals.dsConfig.multiSourceChooser) { %> 8 |

Rooms API Code Examples for C#, PHP, Java, Node.js, Python, and Curl

9 | <% } %> 10 | 11 | <%- include("index_rooms_examples_list") %> 12 | -------------------------------------------------------------------------------- /views/partials/examplesHead.ejs: -------------------------------------------------------------------------------- 1 | <%- include("head") %> 2 | 3 | <% if (locals.dsConfig.multiSourceChooser) { %> 4 |
5 |
6 | 7 |
8 |
9 | <% } else { %> 10 |
11 |
12 | <% } %> -------------------------------------------------------------------------------- /views/partials/examplesHeadQuickACG.ejs: -------------------------------------------------------------------------------- 1 | <%- include("headQuickACG") %> 2 | 3 | <% if (locals.dsConfig.multiSourceChooser) { %> 4 |
5 |
6 | 7 |
8 |
9 | <% } else { %> 10 |
11 |
12 | <% } %> -------------------------------------------------------------------------------- /views/pages/index_examples.ejs: -------------------------------------------------------------------------------- 1 | <% if (showDoc) { %> 2 |

Documentation on using OAuth Authorization Code Grant and 3 | JWT from a Node Express application.

4 | <% } %> 5 | 6 | <% if (locals.dsConfig.multiSourceChooser) { %> 7 |

Run and explore eSignature REST API code examples with Authorization Code Grant or JWT Grant authentication

8 | <% } %> 9 | 10 | <%- include("index_examples_list") %> 11 | -------------------------------------------------------------------------------- /lib/simple_agreement.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Agreement

5 |

I agree to the agreement.

6 |

Signed: -signer1sig-

7 |

Name: -signer1name-

8 |

City: -signer1city-

9 | 10 | -------------------------------------------------------------------------------- /views/partials/genericHead.ejs: -------------------------------------------------------------------------------- 1 | <% try { %> 2 | <%- include("head") %> 3 | <% } catch(err) { %> 4 | <%- include("headQuickACG") %> 5 | <% } %> 6 | 7 | <% if (locals.user) { %> 8 |
9 |
10 | <% } else { %> 11 |
12 |
13 | <% } %> 14 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg004ImportUser.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | <%- include("../../partials/submitButton") %> 11 |
12 | 13 | <%- include("../../partials/examplesFoot") %> 14 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg005AuditUsers.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | <%- include("../../partials/submitButton") %> 11 |
12 | 13 | <%- include("../../partials/examplesFoot") %> 14 | -------------------------------------------------------------------------------- /views/pages/examples/eg008CreateTemplate.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/examples/eg003ListEnvelopes.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/monitor-examples/eg001GetMonitoringData.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg005GetRoomsWithFilters.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | <%- include("../../partials/examplesFoot") %> 14 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg003BulkExportUserData.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | <%- include("../../partials/submitButton") %> 11 |
12 | 13 | <%- include("../../partials/examplesFoot") %> 14 | -------------------------------------------------------------------------------- /views/pages/navigator-examples/eg001ListAgreements.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/click-examples/eg004ListClickwraps.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/maestro-examples/eg002PauseWorkflow.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/maestro-examples/eg003ResumeWorkflow.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/maestro-examples/eg004CancelWorkflow.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/webforms-examples/eg001CreateInstance.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /views/pages/error_eg34.ejs: -------------------------------------------------------------------------------- 1 | <% title = "Error" %> 2 | <%- include("../partials/genericHead") %> 3 | 4 |

Problem: an error occurred

5 |

Error information:

6 | 7 | <% if (errorCode) { %> 8 |

<%= errorCode %>: <%= errorMessage %>

9 |

<%- errorInfo %>

10 | <% } else { %> 11 |

<%= err %>

12 | 13 |

Stack trace

14 |

15 |     <%= err.stack %>
16 |   

17 | <% } %> 18 | 19 | 20 |

Continue

21 | 22 | <%- include("../partials/genericFoot") %> 23 | -------------------------------------------------------------------------------- /views/pages/webforms-examples/eg001WebFormCreate.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 |

<%= title %>

4 |

<%- description %>

5 | 6 |
7 | <% if(example.Forms && example.Forms[0].FormName) { %> 8 | <%- example.Forms[0].FormName %> 9 | <% } %> 10 | 11 | 12 | <%- include("../../partials/continueButton") %> 13 |
14 | 15 | <%- include("../../partials/examplesFoot") %> 16 | -------------------------------------------------------------------------------- /views/pages/webforms-examples/eg002WebFormCreate.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 |

<%= title %>

4 |

<%- description %>

5 | 6 |
7 | <% if(example.Forms && example.Forms[0].FormName) { %> 8 | <%- example.Forms[0].FormName %> 9 | <% } %> 10 | 11 | 12 | <%- include("../../partials/continueButton") %> 13 |
14 | 15 | <%- include("../../partials/examplesFoot") %> 16 | -------------------------------------------------------------------------------- /views/pages/webforms-examples/eg002CreateRemoteInstance.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 | 11 | <%- include("../../partials/submitButton") %> 12 |
13 | 14 | <%- include("../../partials/examplesFoot") %> 15 | -------------------------------------------------------------------------------- /lib/maestro/examples/pauseWorkflow.js: -------------------------------------------------------------------------------- 1 | const iam = require('@docusign/iam-sdk'); 2 | 3 | const pauseWorkflow = async (args) => { 4 | //ds-snippet-start:Maestro2Step2 5 | const client = new iam.IamClient({ accessToken: args.accessToken }); 6 | //ds-snippet-end:Maestro2Step2 7 | 8 | //ds-snippet-start:Maestro2Step3 9 | return await client.maestro.workflows.pauseNewWorkflowInstances({ 10 | accountId: args.accountId, 11 | workflowId: args.workflowId 12 | }); 13 | //ds-snippet-end:Maestro2Step3 14 | }; 15 | 16 | module.exports = { pauseWorkflow }; 17 | -------------------------------------------------------------------------------- /lib/maestro/examples/resumeWorkflow.js: -------------------------------------------------------------------------------- 1 | const iam = require('@docusign/iam-sdk'); 2 | 3 | const resumePausedWorkflow = async (args) => { 4 | //ds-snippet-start:Maestro3Step2 5 | const client = new iam.IamClient({ accessToken: args.accessToken }); 6 | //ds-snippet-end:Maestro3Step2 7 | 8 | //ds-snippet-start:Maestro3Step3 9 | return await client.maestro.workflows.resumePausedWorkflow({ 10 | accountId: args.accountId, 11 | workflowId: args.workflowId, 12 | }); 13 | //ds-snippet-end:Maestro3Step3 14 | }; 15 | 16 | module.exports = { resumePausedWorkflow }; 17 | -------------------------------------------------------------------------------- /lib/navigator/examples/listAgreements.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 001: List agreements 4 | * @author DocuSign 5 | */ 6 | 7 | const iam = require('@docusign/iam-sdk'); 8 | 9 | const listAgreements = async (args) => { 10 | //ds-snippet-start:Navigator1Step2 11 | const client = new iam.IamClient({ accessToken: args.accessToken }); 12 | //ds-snippet-end:Navigator1Step2 13 | //ds-snippet-start:Navigator1Step3 14 | return await client.navigator.agreements.getAgreementsList({ accountId: args.accountId }); 15 | }; 16 | 17 | module.exports = { listAgreements }; 18 | //ds-snippet-end:Navigator1Step3 -------------------------------------------------------------------------------- /views/pages/error.ejs: -------------------------------------------------------------------------------- 1 | <% title = "Error" %> 2 | <%- include("../partials/genericHead") %> 3 | 4 |

Problem: an error occurred

5 |

Error information:

6 | 7 | <% if (errorCode) { %> 8 |

<%= errorCode %>: <%= errorMessage %>

9 | <% if (typeof errorInfo !== 'undefined') { %> 10 |

<%- errorInfo %>

11 | <% } %> 12 | <% } else { %> 13 |

<%= err %>

14 | 15 |

Stack trace

16 |

17 |     <%= err.stack %>
18 |   

19 | <% } %> 20 | 21 | 22 |

Continue

23 | 24 | <%- include("../partials/genericFoot") %> 25 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM --platform=linux/amd64 node:16-buster-slim 2 | 3 | ARG UID=34251 4 | ARG GID=34251 5 | ARG USERNAME=ds 6 | ARG GROUPNAME=ds 7 | ARG USERSHELL=/bin/bash 8 | 9 | RUN groupadd --system ${GROUPNAME} -g ${GID} && \ 10 | useradd --create-home --shell ${USERSHELL} --system --no-log-init -g ${GROUPNAME} -u ${UID} ${USERNAME} 11 | 12 | WORKDIR /home/${USERNAME} 13 | 14 | COPY package.json package-lock.json ./ 15 | RUN npm install 16 | 17 | COPY . . 18 | 19 | 20 | RUN chown -R ${USERNAME}:${GROUPNAME} /home/${USERNAME}/ 21 | USER ${USERNAME} 22 | 23 | EXPOSE 3000 24 | 25 | CMD ["npm", "start"] -------------------------------------------------------------------------------- /views/pages/admin-examples/eg004CheckStatus.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/genericHead") %> 2 | 3 | <% if (locals.status == "completed") { %> 4 |

<%= h1 %>

5 |

<%- message %>

6 | 7 | 8 | 9 |

10 | 11 |

Continue

12 | 13 | <% } else { %> 14 |

Request not complete

15 |

The request has not completed, please refresh this page

16 | <% } %> 17 | 18 | <%- include("../../partials/genericFoot") %> 19 | -------------------------------------------------------------------------------- /lib/rooms/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001rooms = require('./eg001CreateRoomWithData'); 2 | module.exports.eg002rooms = require('./eg002CreateRoomFromTemplate'); 3 | module.exports.eg003rooms = require('./eg003ExportDataFromRoom'); 4 | module.exports.eg004rooms = require('./eg004AddingFormToRoom'); 5 | module.exports.eg005rooms = require('./eg005GetRoomsWithFilters'); 6 | module.exports.eg006rooms = require('./eg006CreateExternalFormFillSession'); 7 | module.exports.eg007rooms = require('./eg007CreateFormGroup'); 8 | module.exports.eg008rooms = require('./eg008GrantOfficeAccessToFormGroup'); 9 | module.exports.eg009rooms = require('./eg009AssignFormToFormGroup'); 10 | -------------------------------------------------------------------------------- /test/testConfig.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | function getConfiguration() { 5 | let config; 6 | 7 | if(fs.existsSync(path.resolve(__dirname, '../config/appsettings.json'))) { 8 | config = require('../config/appsettings.json'); 9 | } else { 10 | config = { 11 | signerEmail: process.env.SIGNER_EMAIL, 12 | signerName: process.env.SIGNER_NAME, 13 | appUrl: process.env.APP_URL, 14 | dsJWTClientId: process.env.CLIENT_ID, 15 | impersonatedUserGuid: process.env.USER_ID, 16 | privateKey: process.env.PRIVATE_KEY, 17 | }; 18 | } 19 | 20 | return config; 21 | } 22 | 23 | module.exports = { getConfiguration }; 24 | -------------------------------------------------------------------------------- /views/pages/error_monitor.ejs: -------------------------------------------------------------------------------- 1 | <% title = "Error" %> 2 | <%- include("../partials/genericHead") %> 3 | 4 |

Problem: an error occurred

5 |

Error information:

6 | 7 | <% if (errorCode) { %> 8 |

<%= errorCode %>: <%= errorMessage %>

9 |

<%- errorInfo %>

10 | <% } else { %> 11 |

<%= err %>

12 |

You do not have Monitor enabled for your account, follow https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/ to get it enabled.

13 |

Stack trace

14 |

15 |     <%= err.stack %>
16 |   

17 | <% } %> 18 | 19 | 20 |

Continue

21 | 22 | <%- include("../partials/genericFoot") %> 23 | -------------------------------------------------------------------------------- /views/pages/example_done.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 | 3 |

<%= title %>

4 |

<%- message %>

5 | 6 | <% if (locals.json) { %> 7 | 8 | 9 |

10 | <% } %> 11 | 12 | <% if (locals.checkStatus) { %> 13 |

Check the request status

14 | <% } %> 15 | 16 | <% if (locals.redirectUrl) { %> 17 |

Continue

18 | <% } else { %> 19 |

Continue

20 | <% } %> 21 | 22 | 23 | <%- include("../partials/genericFoot") %> 24 | -------------------------------------------------------------------------------- /views/pages/examples/eg024CreatePermission.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 13 |
14 | 15 | <%- include("../../partials/submitButton") %> 16 |
17 | 18 | <%- include("../../partials/examplesFoot") %> 19 | -------------------------------------------------------------------------------- /views/pages/examples/eg039SigningInPerson.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 13 |
14 | 15 | 16 | <%- include("../../partials/submitButton") %> 17 |
18 | <%- include("../../partials/examplesFoot") %> 19 | -------------------------------------------------------------------------------- /lib/workspaces/examples/createWorkspace.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 001: Create a workspaces 4 | * @author DocuSign 5 | */ 6 | 7 | const iam = require('@docusign/iam-sdk'); 8 | 9 | const createWorkspace = async (args) => { 10 | //ds-snippet-start:Workspaces1Step2 11 | const client = new iam.IamClient({ accessToken: args.accessToken }); 12 | //ds-snippet-end:Workspaces1Step2 13 | 14 | //ds-snippet-start:Workspaces1Step3 15 | const createWorkspaceBody = { 16 | name: args.workspaceName, 17 | }; 18 | //ds-snippet-end:Workspaces1Step3 19 | 20 | //ds-snippet-start:Workspaces1Step4 21 | return await client.workspaces1.workspaces.createWorkspace({ accountId: args.accountId, createWorkspaceBody }); 22 | //ds-snippet-end:Workspaces1Step4 23 | }; 24 | 25 | module.exports = { createWorkspace }; 26 | -------------------------------------------------------------------------------- /lib/admin/examples/getUserProfileByUserId.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | 3 | /** 4 | * This function gets a user profile by user ID 5 | */ 6 | const getUserProfileByUserId = async (args) => { 7 | // Data for this method 8 | // args.basePath 9 | // args.accessToken 10 | // args.userId 11 | 12 | //ds-snippet-start:Admin7Step2 13 | const apiClient = new docusignAdmin.ApiClient(); 14 | apiClient.setBasePath(args.basePath); 15 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 16 | //ds-snippet-end:Admin7Step2 17 | 18 | //ds-snippet-start:Admin7Step3 19 | const usersApi = new docusignAdmin.UsersApi(apiClient); 20 | return usersApi.getUserDSProfile(args.organizationId, args.userId); 21 | //ds-snippet-end:Admin7Step3 22 | }; 23 | 24 | module.exports = { getUserProfileByUserId }; 25 | -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg001CreateRoomWithData.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 | 16 | <%- include("../../partials/submitButton") %> 17 |
18 | <%- include("../../partials/examplesFoot") %> 19 | -------------------------------------------------------------------------------- /views/pages/click-examples/eg001CreateClickwrap.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 | 16 | <%- include("../../partials/submitButton") %> 17 |
18 | 19 | <%- include("../../partials/examplesFoot") %> 20 | -------------------------------------------------------------------------------- /views/pages/ds_must_authenticate.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 |
3 | <%- locals.manifest.SupportingTexts.LoginPage.LoginHeader %> 4 |

5 |

6 |
7 |
11 | 12 |
13 |
14 |

15 |
16 |

<%- locals.manifest.SupportingTexts.LoginPage.LoginHelperText %>

17 | 18 |
19 | <%- include("../partials/genericFoot") %> 20 | -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg007CreateFormGroup.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 | 16 | <%- include("../../partials/submitButton") %> 17 |
18 | 19 | <%- include("../../partials/examplesFoot") %> 20 | -------------------------------------------------------------------------------- /views/pages/workspaces-examples/eg001CreateWorkspace.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 |
10 | 11 | 13 |
14 | 15 | 16 | <%- include("../../partials/submitButton") %> 17 |
18 | 19 | <%- include("../../partials/examplesFoot") %> 20 | -------------------------------------------------------------------------------- /lib/admin/examples/getUserProfileByEmail.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | 3 | /** 4 | * This function gets a user profile by email 5 | */ 6 | const getUserProfileByEmail = async (args) => { 7 | // Data for this method 8 | // args.basePath 9 | // args.accessToken 10 | // args.email 11 | 12 | //ds-snippet-start:Admin6Step2 13 | const apiClient = new docusignAdmin.ApiClient(); 14 | apiClient.setBasePath(args.basePath); 15 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 16 | //ds-snippet-end:Admin6Step2 17 | 18 | //ds-snippet-start:Admin6Step3 19 | const usersApi = new docusignAdmin.UsersApi(apiClient); 20 | return usersApi.getUserDSProfilesByEmail(args.organizationId, { email: args.email }); 21 | //ds-snippet-end:Admin6Step3 22 | }; 23 | 24 | module.exports = { getUserProfileByEmail }; 25 | -------------------------------------------------------------------------------- /lib/common/config.js: -------------------------------------------------------------------------------- 1 | const settings = require('./appsettings.json'); 2 | 3 | const dsOauthServer = settings.production 4 | ? 'https://account.docusign.com' 5 | : 'https://account-d.docusign.com'; 6 | 7 | settings.dsClientSecret = process.env.DS_CLIENT_SECRET || settings.dsClientSecret; 8 | settings.signerEmail = process.env.DS_SIGNER_EMAIL || settings.signerEmail; 9 | settings.signerName = process.env.DS_SIGNER_NAME || settings.signerName; 10 | settings.dsClientId = process.env.DS_CLIENT_ID || settings.dsClientId; 11 | settings.appUrl = process.env.DS_APP_URL || settings.appUrl; 12 | settings.privateKeyLocation = process.env.DS_PRIVATE_KEY_PATH || settings.privateKeyLocation; 13 | settings.impersonatedUserGuid = process.env.DS_IMPERSONATED_USER_GUID || settings.impersonatedUserGuid; 14 | 15 | exports.config = { 16 | dsOauthServer, 17 | ...settings 18 | }; 19 | -------------------------------------------------------------------------------- /lib/navigator/examples/getSingleAgreement.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 002: Get a single agreement 4 | * @author DocuSign 5 | */ 6 | 7 | const iam = require('@docusign/iam-sdk'); 8 | 9 | const listAgreements = async (args) => { 10 | //ds-snippet-start:Navigator2Step2 11 | const client = new iam.IamClient({ accessToken: args.accessToken }); 12 | //ds-snippet-end:Navigator2Step2 13 | return await client.navigator.agreements.getAgreementsList({ accountId: args.accountId }); 14 | }; 15 | 16 | //ds-snippet-start:Navigator2Step3 17 | const getAgreement = async (args) => { 18 | const client = new iam.IamClient({ accessToken: args.accessToken, serverURL: args.basePath }); 19 | return await client.navigator.agreements.getAgreement({ accountId: args.accountId, agreementId: args.agreementId }); 20 | }; 21 | 22 | module.exports = { listAgreements, getAgreement }; 23 | //ds-snippet-end:Navigator2Step3 -------------------------------------------------------------------------------- /lib/manifestService.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch').default; 2 | 3 | const getManifest = async (manifestUrl) => { 4 | return await loadManifest(manifestUrl); 5 | }; 6 | 7 | const loadManifest = async (manifestUrl) => { 8 | const response = await fetch(manifestUrl); 9 | const manifest = await response.json(); 10 | 11 | if (!manifest) { 12 | throw new Error('Manifest is not valid!'); 13 | } 14 | 15 | return manifest; 16 | }; 17 | 18 | const getExampleByNumber = (manifest, number, apiName) => { 19 | if (!manifest || !manifest.APIs) { 20 | return undefined; 21 | } 22 | 23 | const api = manifest.APIs.filter(a => a.Name === apiName)[0]; 24 | const exampleList = api.Groups.flatMap(g => g.Examples); 25 | const example = exampleList.filter(e => e.ExampleNumber === number)[0]; 26 | 27 | return example; 28 | }; 29 | 30 | module.exports = { getManifest, getExampleByNumber }; 31 | -------------------------------------------------------------------------------- /views/pages/choose_api.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 |
3 | <%- locals.manifest.SupportingTexts.SelectAPIPage.SelectAPIHeader %> 4 |

5 |

6 |
7 |
14 | 15 |
16 |
17 |

18 |
19 | 20 |
21 | <%- include("../partials/genericFoot") %> -------------------------------------------------------------------------------- /views/pages/example_click6_done.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 | 3 |

<%= title %>

4 |

<%- message %>

5 | 6 |

Agreement URL received back from the API call: <%- agreementUrl %>

7 | 8 |

9 | <%- locals.manifest.SupportingTexts.HelpingTexts.NOTAGREED %> 10 |

11 | 12 |
13 | 14 | 22 | 23 | 24 |

Continue

25 | 26 | <%- include("../partials/genericFoot") %> -------------------------------------------------------------------------------- /views/pages/admin-examples/eg007GetUserProfileByUserId.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 |
16 | 17 | <%- include("../../partials/submitButton") %> 18 |
19 | 20 | <%- include("../../partials/examplesFoot") %> 21 | -------------------------------------------------------------------------------- /views/pages/examples/eg015EnvelopeTabData.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% if (envelopeOk) { %> 6 |
7 | <% if(example.Forms && example.Forms[0].FormName) { %> 8 | <%- example.Forms[0].FormName %> 9 | <% } %> 10 | 11 | 12 | <%- include("../../partials/submitButton") %> 13 |
14 | 15 | <% } else { %> 16 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 17 | 18 |
19 | <%- include("../../partials/continueButton") %> 20 |
21 | <% } %> 22 | 23 | <%- include("../../partials/examplesFoot") %> 24 | -------------------------------------------------------------------------------- /views/pages/navigator-examples/eg002GetSingleAgreement.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 17 |
18 | 19 | 20 | <%- include("../../partials/submitButton") %> 21 |
22 | 23 | <%- include("../../partials/examplesFoot") %> 24 | -------------------------------------------------------------------------------- /views/pages/examples/eg006EnvelopeDocs.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | <% if (envelopeOk) { %> 7 |
8 | <% if(example.Forms && example.Forms[0].FormName) { %> 9 | <%- example.Forms[0].FormName %> 10 | <% } %> 11 | 12 | 13 | <%- include("../../partials/submitButton") %> 14 |
15 | 16 | <% } else { %> 17 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 18 | 19 |
20 | <%- include("../../partials/continueButton") %> 21 |
22 | <% } %> 23 | 24 | <%- include("../../partials/examplesFoot") %> 25 | -------------------------------------------------------------------------------- /views/pages/examples/eg018EnvelopeCustomFieldData.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% if (envelopeOk) { %> 6 |
7 | <% if(example.Forms && example.Forms[0].FormName) { %> 8 | <%- example.Forms[0].FormName %> 9 | <% } %> 10 | 11 | 12 | <%- include("../../partials/submitButton") %> 13 |
14 | 15 | <% } else { %> 16 |

17 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg0{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 18 |

19 | 20 |
21 | <%- include("../../partials/continueButton") %> 22 |
23 | <% } %> 24 | 25 | <%- include("../../partials/examplesFoot") %> 26 | -------------------------------------------------------------------------------- /lib/admin/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports.eg001admin = require('./eg001CreateUser'); 2 | module.exports.eg002admin = require('./eg002CreateCLMESignUser'); 3 | module.exports.eg003admin = require('./eg003BulkExportUserData'); 4 | module.exports.eg004admin = require('./eg004ImportUser'); 5 | module.exports.eg005admin = require('./eg005AuditUsers'); 6 | module.exports.eg006admin = require('./eg006GetUserProfileByEmail'); 7 | module.exports.eg007admin = require('./eg007GetUserProfileByUserId'); 8 | module.exports.eg008admin = require('./eg008UpdateUserProductPermissionProfile'); 9 | module.exports.eg009admin = require('./eg009DeleteUserProductPermissionProfile'); 10 | module.exports.eg010admin = require('./eg010DeleteUserDataFromOrganization'); 11 | module.exports.eg011admin = require('./eg011DeleteUserDataFromAccount'); 12 | module.exports.eg012admin = require('./eg012CloneAccount'); 13 | module.exports.eg013admin = require('./eg013CreateAccount'); 14 | -------------------------------------------------------------------------------- /views/pages/examples/eg004EnvelopeInfo.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (envelopeOk) { %> 8 |
9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 | 14 | <%- include("../../partials/submitButton") %> 15 |
16 | 17 | <% } else { %> 18 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 19 | 20 |
21 | <%- include("../../partials/continueButton") %> 22 |
23 | <% } %> 24 | 25 | <%- include("../../partials/examplesFoot") %> 26 | -------------------------------------------------------------------------------- /views/pages/examples/eg005EnvelopeRecipients.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (envelopeOk) { %> 8 |
9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 | 14 | <%- include("../../partials/submitButton") %> 15 |
16 | 17 | <% } else { %> 18 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 19 | 20 |
21 | <%- include("../../partials/continueButton") %> 22 |
23 | <% } %> 24 | 25 | <%- include("../../partials/examplesFoot") %> 26 | -------------------------------------------------------------------------------- /views/pages/examples/eg045RestoreEnvelope.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 |

<%= example.ExampleName %>

4 |

<%- example.ExampleDescription %>

5 |

<%- formatString(locals.manifest.SupportingTexts.HelpingTexts.EnvelopeWillBeRestored, envelopeId) %>

6 | 7 |
8 | <% if(example.Forms && example.Forms[0].FormName) { %> 9 | <%- example.Forms[0].FormName %> 10 | <% } %> 11 | 12 |
13 | 14 | 16 |
17 | 18 | 19 | <%- include("../../partials/submitButton") %> 20 |
21 | 22 | <%- include("../../partials/examplesFoot") %> 23 | -------------------------------------------------------------------------------- /lib/maestro/examples/cancelWorkflow.js: -------------------------------------------------------------------------------- 1 | const iam = require('@docusign/iam-sdk'); 2 | 3 | const getWorkflowInstance = async (args) => { 4 | const client = new iam.IamClient({ accessToken: args.accessToken }); 5 | 6 | return await client.maestro.workflowInstanceManagement.getWorkflowInstance({ 7 | accountId: args.accountId, 8 | workflowId: args.workflowId, 9 | instanceId: args.instanceId 10 | }); 11 | }; 12 | 13 | const cancelWorkflow = async (args) => { 14 | //ds-snippet-start:Maestro4Step2 15 | const client = new iam.IamClient({ accessToken: args.accessToken }); 16 | //ds-snippet-end:Maestro4Step2 17 | 18 | //ds-snippet-start:Maestro4Step3 19 | return await client.maestro.workflowInstanceManagement.cancelWorkflowInstance({ 20 | accountId: args.accountId, 21 | workflowId: args.workflowId, 22 | instanceId: args.instanceId 23 | }); 24 | //ds-snippet-end:Maestro4Step3 25 | }; 26 | 27 | module.exports = { getWorkflowInstance, cancelWorkflow }; 28 | -------------------------------------------------------------------------------- /lib/rooms/examples/getRoomsWithFilters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 005: Get Rooms With Filters 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignRooms = require('docusign-rooms'); 8 | 9 | /** 10 | * Get filtered rooms 11 | * @param {object} args 12 | */ 13 | const getRoomsWithFilters = async (args) => { 14 | //ds-snippet-start:Rooms5Step2 15 | let dsApiClient = new docusignRooms.ApiClient(); 16 | 17 | dsApiClient.setBasePath(args.basePath); 18 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 19 | //ds-snippet-end:Rooms5Step2 20 | 21 | //ds-snippet-start:Rooms5Step4 22 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 23 | let results = null; 24 | 25 | results = await roomsApi.getRooms(args.accountId, args.roomsArgs); 26 | //ds-snippet-end:Rooms5Step4 27 | 28 | console.log(`Get Rooms with filters ${JSON.stringify(results)}`); 29 | 30 | return results; 31 | }; 32 | 33 | module.exports = { getRoomsWithFilters }; 34 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg006GetUserProfileByEmail.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 15 |
16 | 17 | <%- include("../../partials/submitButton") %> 18 |
19 | 20 | <%- include("../../partials/examplesFoot") %> 21 | -------------------------------------------------------------------------------- /views/pages/examples/eg045DeleteEnvelope.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.DefaultEnvelopeId %> 16 | 17 |
18 | 19 | 20 | <%- include("../../partials/submitButton") %> 21 |
22 | 23 | <%- include("../../partials/examplesFoot") %> 24 | -------------------------------------------------------------------------------- /lib/eSignature/getData.js: -------------------------------------------------------------------------------- 1 | const docusign = require('docusign-esign'); 2 | 3 | async function getUserInfo(accessToken, basePath){ 4 | const apiClient = new docusign.ApiClient(); 5 | apiClient.setBasePath(basePath); 6 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + accessToken); 7 | 8 | const userInfo = await apiClient.getUserInfo(accessToken); 9 | if (!userInfo) { 10 | throw new Exception('The user does not have access to account'); 11 | } 12 | return userInfo; 13 | } 14 | 15 | function getFolderIdByName(folders, folderName) { 16 | for (const folder of folders) { 17 | if (folder.name.toLowerCase() === folderName.toLowerCase()) { 18 | return folder.folderId; 19 | } 20 | 21 | if (folder.folders?.length > 0) { 22 | const folderId = getFolderIdByName(folder.folders, folderName); 23 | if (folderId) { 24 | return folderId; 25 | } 26 | } 27 | } 28 | 29 | return null; 30 | } 31 | 32 | module.exports = { getUserInfo, getFolderIdByName }; 33 | -------------------------------------------------------------------------------- /views/pages/ds_return.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../partials/genericHead") %> 2 | 3 |

Returned data from DocuSign!

4 |

Data:

5 | 6 | <% if (event) { %> 7 |

event: <%= event %>. This event parameter is supplied by DocuSign. 8 | Since it could have been spoofed, don't make business decisions based on 9 | its value. Instead, query DocuSign as appropriate.

10 | <% } %> 11 | 12 | <% if (envelopeId) { %> 13 |

envelopeId: <%= envelopeId %>. The envelopeId parameter is supplied by DocuSign. 14 | Since it could have been spoofed, don't make business decisions based on 15 | its value. Instead, query DocuSign as appropriate.

16 | <% } %> 17 | 18 | <% if (state) { %> 19 |

state: <%= state %>. This example state was sent to DocuSign and has now been received back. 20 | It is usually better to store state in your web framework's session.

21 | <% } %> 22 | 23 |

Continue

24 | 25 | <%- include("../partials/genericFoot") %> 26 | -------------------------------------------------------------------------------- /views/pages/monitor-examples/eg002PostWebQuery.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | required> 13 |
14 | 15 |
16 | 17 | required> 18 |
19 | 20 | 21 | <%- include("../../partials/submitButton") %> 22 |
23 | 24 | <%- include("../../partials/examplesFoot") %> 25 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg010DeleteUserDataFromOrganization.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailAddressOfUserToDelete %> 15 |
16 | 17 | <%- include("../../partials/submitButton") %> 18 |
19 | 20 | <%- include("../../partials/examplesFoot") %> 21 | -------------------------------------------------------------------------------- /lib/click/examples/listClickwraps.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 4: Get list of elastic templates 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignClick = require('docusign-click'); 8 | 9 | /** 10 | * Get list of elastic templates 11 | * @param {Object} args Arguments for creating elastic templates 12 | * @return {Object} The object with value of clickwrapId or error 13 | */ 14 | const getClickwraps = async (args) => { 15 | // Call the Click API. Create Click API client 16 | //ds-snippet-start:Click4Step2 17 | const dsApiClient = new docusignClick.ApiClient(); 18 | dsApiClient.setBasePath(args.basePath); 19 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 20 | //ds-snippet-end 21 | //ds-snippet-start:Click4Step3 22 | const accountApi = new docusignClick.AccountsApi(dsApiClient); 23 | 24 | // Get a list of all elastic templates 25 | return await accountApi.getClickwraps(args.accountId); 26 | }; 27 | //ds-snippet-end 28 | 29 | module.exports = { getClickwraps }; 30 | -------------------------------------------------------------------------------- /lib/admin/getOrganizationId.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Get orgnization id 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignAdmin = require('docusign-admin'); 8 | const dsConfig = require('../../config/index.js').config; 9 | 10 | /** 11 | * This function retrieves an organization id for the user 12 | */ 13 | async function getOrganizationId(req) { 14 | if (!req.session.organizationId){ 15 | let dsApiClient = new docusignAdmin.ApiClient(); 16 | dsApiClient.setBasePath(`${dsConfig.adminAPIUrl}`); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + req.user.accessToken); 18 | 19 | const accountsApi = new docusignAdmin.AccountsApi(dsApiClient); 20 | const organizations = await accountsApi.getOrganizations(); 21 | 22 | // It's possible to belong to more than one organization, but we assume you are in a single organization. 23 | const orgId = organizations.organizations[0].id; 24 | req.session.organizationId = orgId; 25 | } 26 | } 27 | 28 | module.exports = { getOrganizationId }; 29 | -------------------------------------------------------------------------------- /jwt_console_project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jwt_console_project", 3 | "version": "1.0.0", 4 | "description": "JWT authentication with a single DocuSign code example", 5 | "main": "jwtConsole.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "relocate": "[ ! -d 'node_modules' ] || (rm -rf ../node_modules && mv -f node_modules ../)", 9 | "relocate_windows": "(if exist node_modules/ (cd ../ && remove-node-modules && move jwt_console_project/node_modules ./))", 10 | "start": "(npm run relocate --silent || npm run relocate_windows --silent) && node jwtConsole.js" 11 | }, 12 | "author": "DocuSign, Inc", 13 | "license": "ISC", 14 | "dependencies": { 15 | "docusign-esign": "^8.0.1", 16 | "fs": "^0.0.1-security", 17 | "fs-extra": "^11.2.0", 18 | "path": "^0.12.7", 19 | "prompt-sync": "^4.2.0", 20 | "remove-node-modules": "^1.7.6" 21 | }, 22 | "overrides": { 23 | "pac-resolver": "^7.0.1", 24 | "semver": "^7.5.4" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /views/pages/examples/eg033UnpauseSignatureWorkflow.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (envelopeOk) { %> 8 |

The envelope you created in example 32 will be queried.

9 |
10 | <% if(example.Forms && example.Forms[0].FormName) { %> 11 | <%- example.Forms[0].FormName %> 12 | <% } %> 13 | 14 | 15 | <%- include("../../partials/submitButton") %> 16 |
17 | <% } else { %> 18 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg0{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 19 |
20 | <%- include("../../partials/continueButton") %> 21 |
22 | <% } %> 23 | 24 | <%- include("../../partials/examplesFoot") %> 25 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg011DeleteUserDataFromAccount.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.UserIDOfUserToDelete %> 16 |
17 | 18 | <%- include("../../partials/submitButton") %> 19 |
20 | 21 | <%- include("../../partials/examplesFoot") %> 22 | -------------------------------------------------------------------------------- /lib/eSignature/examples/envelopeDocs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 006: List an envelope's documents 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of listing the envelope's documents 11 | * @param {object} args object 12 | */ 13 | const getDocuments = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | // args.envelopeId 19 | 20 | //ds-snippet-start:eSign6Step2 21 | let dsApiClient = new docusign.ApiClient(); 22 | dsApiClient.setBasePath(args.basePath); 23 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 24 | //ds-snippet-end:eSign6Step2 25 | 26 | //ds-snippet-start:eSign6Step3 27 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 28 | 29 | let results = await envelopesApi.listDocuments( 30 | args.accountId, 31 | args.envelopeId, 32 | null 33 | ); 34 | //ds-snippet-end:eSign6Step3 35 | return results; 36 | }; 37 | 38 | module.exports = { getDocuments }; 39 | -------------------------------------------------------------------------------- /PAYMENTS_INSTALLATION.md: -------------------------------------------------------------------------------- 1 | # Configure a payment gateway 2 | 3 | DocuSign offers built-in connections to multiple payment gateways. The payments code example uses a developer account via the Stripe gateway service. 4 | 5 | 6 | ## Create a Stripe payment gateway 7 | 8 | 1. Select the Stripe button on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. 9 | 10 | 1. For development, you can skip the Stripe account application by using the **Skip this account form** link at the top of the page.
11 | 12 | ![Skipping the Stripe account form](docs/stripe_skip_account_form_link.png) 13 | 14 | An enabled Stripe payment gateway is now associated with your Docusign developer account and is shown under **Payment Gateway**. 15 | 16 | 1. Save the **Gateway Account ID** GUID to the code example launcher configuration file. 17 | 18 | 19 | ## Additional documentation 20 | * [Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways) 21 | * [How to send a request for payment](https://developers.docusign.com/docs/esign-rest-api/how-to/request-a-payment) 22 | -------------------------------------------------------------------------------- /lib/eSignature/examples/envelopeRecipients.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 005: envelope list recipients 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of listing the envelope's recipients 11 | * @param {object} args object 12 | */ 13 | const listRecipients = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | // args.envelopeId 19 | 20 | //ds-snippet-start:eSign5Step2 21 | let dsApiClient = new docusign.ApiClient(); 22 | dsApiClient.setBasePath(args.basePath); 23 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 24 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 25 | let results = null; 26 | // Step 1. EnvelopeRecipients::list. 27 | // Exceptions will be caught by the calling function 28 | results = await envelopesApi.listRecipients( 29 | args.accountId, 30 | args.envelopeId, 31 | null 32 | ); 33 | //ds-snippet-end:eSign5Step2 34 | return results; 35 | }; 36 | 37 | module.exports = { listRecipients }; 38 | -------------------------------------------------------------------------------- /views/pages/examples/eg028CreateBrand.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 |
16 | 17 | 20 |
21 | 22 | <%- include("../../partials/submitButton") %> 23 |
24 | 25 | <%- include("../../partials/examplesFoot") %> 26 | -------------------------------------------------------------------------------- /lib/eSignature/examples/envelopeInfo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 004: Get an envelope's basic information and status 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of getting the envelope information 11 | * @param {object} args 12 | */ 13 | const getEnvelope = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | // args.envelopeId 19 | 20 | //ds-snippet-start:eSign4Step2 21 | let dsApiClient = new docusign.ApiClient(); 22 | dsApiClient.setBasePath(args.basePath); 23 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 24 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 25 | let results = null; 26 | 27 | // Step 1. Call Envelopes::get 28 | // Exceptions will be caught by the calling function 29 | results = await envelopesApi.getEnvelope( 30 | args.accountId, 31 | args.envelopeId, 32 | null 33 | ); 34 | //ds-snippet-end:eSign4Step2 35 | return results; 36 | }; 37 | 38 | module.exports = { getEnvelope }; 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2018 DocuSign, Inc. (https://www.docusign.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/eSignature/examples/createBrand.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 028: Create new brand 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of creating the brand 11 | */ 12 | const createBrand = async (args) => { 13 | // Construct your API headers 14 | //ds-snippet-start:eSign28Step2 15 | let dsApiClient = new docusign.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | let accountsApi = new docusign.AccountsApi(dsApiClient); 19 | //ds-snippet-end:eSign28Step2 20 | 21 | // Construct the request body 22 | //ds-snippet-start:eSign28Step3 23 | let callback = { 24 | brand: { 25 | brandName: args.brandName, 26 | defaultBrandLanguage: args.defaultBrandLanguage, 27 | }, 28 | }; 29 | //ds-snippet-end:eSign28Step3 30 | 31 | // Call the eSignature REST API 32 | //ds-snippet-start:eSign28Step4 33 | results = await accountsApi.createBrand(args.accountId, callback); 34 | return results; 35 | //ds-snippet-end:eSign28Step4 36 | }; 37 | 38 | module.exports = { createBrand }; 39 | -------------------------------------------------------------------------------- /lib/eSignature/examples/envelopeTabData.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 015: Get an envelope's tab (field) data 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of getting the envelope information 11 | * @param {object} args 12 | */ 13 | const getEnvelopeFormData = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | // args.envelopeId 19 | 20 | //ds-snippet-start:eSign15Step2 21 | let dsApiClient = new docusign.ApiClient(); 22 | dsApiClient.setBasePath(args.basePath); 23 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 24 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 25 | let results = null; 26 | //ds-snippet-end:eSign15Step2 27 | 28 | // Step 1. Call EnvelopeFormData::get 29 | // Exceptions will be caught by the calling function 30 | //ds-snippet-start:eSign15Step3 31 | results = await envelopesApi.getFormData(args.accountId, args.envelopeId); 32 | //ds-snippet-end:eSign15Step3 33 | return results; 34 | }; 35 | 36 | module.exports = { getEnvelopeFormData }; 37 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | exports.docOptions = require('./documentOptions.json'); 2 | exports.docNames = require('./documentNames.json'); 3 | const settings = require('./appsettings.json'); 4 | exports.github = require('./github.json'); 5 | 6 | const dsOauthServer = settings.production 7 | ? 'https://account.docusign.com' 8 | : 'https://account-d.docusign.com'; 9 | 10 | settings.gatewayAccountId = process.env.DS_PAYMENT_GATEWAY_ID || settings.gatewayAccountId; 11 | settings.dsClientSecret = process.env.DS_CLIENT_SECRET || settings.dsClientSecret; 12 | settings.signerEmail = process.env.DS_SIGNER_EMAIL || settings.signerEmail; 13 | settings.signerName = process.env.DS_SIGNER_NAME || settings.signerName; 14 | settings.dsClientId = process.env.DS_CLIENT_ID || settings.dsClientId; 15 | settings.appUrl = process.env.DS_APP_URL || settings.appUrl; 16 | settings.dsJWTClientId = process.env.DS_JWT_CLIENT_ID || settings.dsJWTClientId; 17 | settings.privateKeyLocation = process.env.DS_PRIVATE_KEY_PATH || settings.privateKeyLocation; 18 | settings.impersonatedUserGuid = process.env.DS_IMPERSONATED_USER_GUID || settings.impersonatedUserGuid; 19 | 20 | exports.config = { 21 | dsOauthServer, 22 | ...settings 23 | }; 24 | -------------------------------------------------------------------------------- /lib/click/examples/clickwrapResponses.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 5: Get elastic template responses 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignClick = require('docusign-click'); 8 | 9 | /** 10 | * Get elastic template responses using SDK 11 | * @param {Object} args Arguments for creating elastic template 12 | * @return {Object} The object with value of clickwrapId or error 13 | */ 14 | const getClickwrapAgreements = async (args) => { 15 | // Call the Click API. Create click API client 16 | //ds-snippet-start:Click5Step2 17 | const dsApiClient = new docusignClick.ApiClient(); 18 | dsApiClient.setBasePath(args.basePath); 19 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 20 | //ds-snippet-end 21 | //ds-snippet-start:Click5Step3 22 | const accountApi = new docusignClick.AccountsApi(dsApiClient); 23 | 24 | const options = { 25 | status: 'agreed' 26 | }; 27 | 28 | // Get elastic template responses using SDK 29 | return await accountApi.getClickwrapAgreements( 30 | args.accountId, 31 | args.clickwrapId, 32 | options 33 | ); 34 | //ds-snippet-end 35 | }; 36 | 37 | module.exports = { getClickwrapAgreements }; 38 | -------------------------------------------------------------------------------- /lib/admin/examples/deleteUserDataFromAccount.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | 3 | /** 4 | * This function deletes user data from an account using user ID 5 | * @param {Object} args - object with arguments 6 | * @param {string} args.basePath 7 | * @param {string} args.accessToken 8 | * @param {string} args.accountId 9 | * @param {string} args.userId 10 | */ 11 | const deleteUser = async (args) => { 12 | //ds-snippet-start:Admin11Step2 13 | const apiClient = new docusignAdmin.ApiClient(); 14 | apiClient.setBasePath(args.basePath); 15 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 16 | //ds-snippet-end:Admin11Step2 17 | 18 | //ds-snippet-start:Admin11Step3 19 | const accountsApi = new docusignAdmin.AccountsApi(apiClient); 20 | const membershipDataRedactionRequest = docusignAdmin.IndividualMembershipDataRedactionRequest.constructFromObject({ 21 | user_id: args.userId, 22 | }); 23 | //ds-snippet-end:Admin11Step3 24 | 25 | //ds-snippet-start:Admin11Step4 26 | return await accountsApi.redactIndividualMembershipData(membershipDataRedactionRequest, args.accountId); 27 | //ds-snippet-end:Admin11Step4 28 | 29 | }; 30 | 31 | module.exports = { deleteUser }; 32 | -------------------------------------------------------------------------------- /lib/workspaces/examples/addDocumentToWorkspace.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 002: Add a document to a Workspaces 4 | * @author DocuSign 5 | */ 6 | 7 | const iam = require('@docusign/iam-sdk'); 8 | const fs = require('fs').promises; 9 | 10 | const addDocumentToWorkspace = async (args) => { 11 | //ds-snippet-start:Workspaces2Step2 12 | const client = new iam.IamClient({ accessToken: args.accessToken }); 13 | //ds-snippet-end:Workspaces2Step2 14 | 15 | //ds-snippet-start:Workspaces2Step3 16 | const buffer = await fs.readFile(args.documentPath); 17 | const uint8array = new Uint8Array( 18 | buffer.buffer, 19 | buffer.byteOffset, 20 | buffer.byteLength 21 | ); 22 | const addWorkspaceDocumentRequest = { 23 | file: { 24 | fileName: args.documentName, 25 | content: uint8array, 26 | }, 27 | }; 28 | //ds-snippet-end:Workspaces2Step3 29 | 30 | //ds-snippet-start:Workspaces2Step4 31 | return await client.workspaces1.workspaceDocuments.addWorkspaceDocument({ 32 | accountId: args.accountId, 33 | workspaceId: args.workspaceId, 34 | addWorkspaceDocumentRequest, 35 | }); 36 | //ds-snippet-end:Workspaces2Step4 37 | }; 38 | 39 | module.exports = { addDocumentToWorkspace }; 40 | -------------------------------------------------------------------------------- /lib/eSignature/examples/envelopeCustomFieldData.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 018: Get an envelope's custom field data 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of getting the envelope information 11 | * @param {object} args 12 | */ 13 | const listCustomFields = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | // args.envelopeId 19 | 20 | //ds-snippet-start:eSign18Step2 21 | let dsApiClient = new docusign.ApiClient(); 22 | dsApiClient.setBasePath(args.basePath); 23 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 24 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 25 | let results = null; 26 | //ds-snippet-end:eSign18Step2 27 | 28 | // Step 1. Call EnvelopeCustomFields::get 29 | // Exceptions will be caught by the calling function 30 | //ds-snippet-start:eSign18Step3 31 | results = await envelopesApi.listCustomFields( 32 | args.accountId, 33 | args.envelopeId, 34 | null 35 | ); 36 | //ds-snippet-end:eSign18Step3 37 | return results; 38 | }; 39 | 40 | module.exports = { listCustomFields }; 41 | -------------------------------------------------------------------------------- /views/partials/exampleInfo.ejs: -------------------------------------------------------------------------------- 1 |

<%= example.ExampleName %>

2 | 3 |

<%- example.ExampleDescription %>

4 | 5 | <%- include("docBody") %> 6 | 7 | <% if(example.Notes) { %> 8 | <%- example.Notes %> 9 | <% } %> 10 | 11 |

12 | <% if (example.LinksToAPIMethod && example.LinksToAPIMethod.length !== 0) { %> 13 | <% if (example.LinksToAPIMethod.length > 1) { %> 14 | <%= locals.manifest.SupportingTexts.APIMethodUsedPlural %> 15 | <% } else { %> 16 | <%= locals.manifest.SupportingTexts.APIMethodUsed %> 17 | <% } %> 18 | 19 | <% for (var i = 0; i < example.LinksToAPIMethod.length; i++) {%> 20 | <% if (i + 1 == example.LinksToAPIMethod.length - 1) { %> 21 | <%= example.LinksToAPIMethod[i].PathName %>, and 22 | <% } else if (i == example.LinksToAPIMethod.length - 1) { %> 23 | <%= example.LinksToAPIMethod[i].PathName %> 24 | <% } else { %> 25 | <%= example.LinksToAPIMethod[i].PathName %>, 26 | <% } %> 27 | <% } %> 28 | <% } %> 29 |

30 | 31 | <%- include("gitSource") %> -------------------------------------------------------------------------------- /lib/rooms/examples/createFormGroup.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 007: Create Form Group 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignRooms = require('docusign-rooms'); 8 | 9 | /** 10 | * Create form group 11 | * @param {object} args 12 | */ 13 | const createFormGroup = async (args) => { 14 | //ds-snippet-start:Rooms7Step2 15 | let dsApiClient = new docusignRooms.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | //ds-snippet-end:Rooms7Step2 19 | 20 | //ds-snippet-start:Rooms7Step3 21 | const form = new docusignRooms.FormGroupForCreate.constructFromObject({ 22 | name: args.formGroupName, 23 | }); 24 | //ds-snippet-end:Rooms7Step2 25 | 26 | // Post the form object using SDK 27 | //ds-snippet-start:Rooms7Step4 28 | const formsGroupsApi = new docusignRooms.FormGroupsApi(dsApiClient); 29 | const results = await formsGroupsApi.createFormGroup(args.accountId, { 30 | body: form, 31 | }); 32 | //ds-snippet-end:Rooms7Step4 33 | 34 | console.log( 35 | `Form Group ${args.formGroupName} has been created. Form Group ID ${results.formGroupId}` 36 | ); 37 | return results; 38 | }; 39 | 40 | module.exports = { createFormGroup }; 41 | -------------------------------------------------------------------------------- /views/pages/examples/eg012EmbeddedConsole.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (!envelopeOk) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 | <% } %> 10 | 11 |
12 | <% if(example.Forms && example.Forms[0].FormName) { %> 13 | <%- example.Forms[0].FormName %> 14 | <% } %> 15 | 16 |
17 | 18 | 23 |
24 | 25 | <%- include("../../partials/submitButton") %> 26 |
27 | 28 | <%- include("../../partials/examplesFoot") %> 29 | -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg003ExportDataFromRoom.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (rooms && rooms.length > 0) { %> 8 |
9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 |
14 | 15 | 20 |
21 | 22 | <%- include("../../partials/submitButton") %> 23 |
24 | <% } else { %> 25 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="reg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 26 | 27 |
28 | <%- include("../../partials/continueButton") %> 29 |
30 | <% } %> 31 | <%- include("../../partials/examplesFoot") %> 32 | -------------------------------------------------------------------------------- /views/pages/examples/eg023IdvAuthentication.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 15 |
16 |
17 | 18 | 20 |
21 | 22 | <%- include("../../partials/submitButton") %> 23 |
24 | 25 | <%- include("../../partials/examplesFoot") %> 26 | -------------------------------------------------------------------------------- /views/pages/examples/eg022KbaAuthentication.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 15 |
16 |
17 | 18 | 20 |
21 | 22 | <%- include("../../partials/submitButton") %> 23 |
24 | 25 | <%- include("../../partials/examplesFoot") %> -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg006SelectRoomForExternalFormFillSession.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (rooms && rooms.length > 0) { %> 8 |
9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[1].FormName %> 11 | <% } %> 12 | 13 |
14 | 15 | 20 |
21 | 22 | <%- include("../../partials/submitButton") %> 23 |
24 | <% } else { %> 25 | 26 | <%- formatString(example.RedirectsToOtherCodeExamples[1].RedirectText, formatString('href="reg00{0}"', example.RedirectsToOtherCodeExamples[1].CodeExampleToRedirectTo)) %> 27 | 28 |
29 | <%- include("../../partials/continueButton") %> 30 |
31 | <% } %> 32 | <%- include("../../partials/examplesFoot") %> 33 | -------------------------------------------------------------------------------- /lib/maestro/examples/triggerWorkflow.js: -------------------------------------------------------------------------------- 1 | const iam = require('@docusign/iam-sdk'); 2 | 3 | const getMaestroWorkflows = async (args) => { 4 | //ds-snippet-start:Maestro1Step2 5 | const client = new iam.IamClient({ accessToken: args.accessToken }); 6 | //ds-snippet-end:Maestro1Step2 7 | //ds-snippet-start:Maestro1Step3 8 | return await client.maestro.workflows.getWorkflowsList({ accountId: args.accountId, status: 'active' }); 9 | //ds-snippet-end:Maestro1Step3 10 | }; 11 | 12 | const triggerWorkflow = async (args, workflowId) => { 13 | const client = new iam.IamClient({ accessToken: args.accessToken }); 14 | 15 | const instanceName = args.instanceName; 16 | //ds-snippet-start:Maestro1Step4 17 | const triggerInputs = { 18 | signerName: args.signerName, 19 | signerEmail: args.signerEmail, 20 | ccName: args.ccName, 21 | ccEmail: args.ccEmail, 22 | }; 23 | //ds-snippet-end:Maestro1Step4 24 | 25 | //ds-snippet-start:Maestro1Step5 26 | const triggerWorkflow = { instanceName, triggerInputs }; 27 | 28 | const result = await client.maestro.workflows.triggerWorkflow({ 29 | accountId: args.accountId, 30 | workflowId: workflowId, 31 | triggerWorkflow, 32 | }); 33 | 34 | return result; 35 | //ds-snippet-end:Maestro1Step5 36 | }; 37 | 38 | module.exports = { triggerWorkflow, getMaestroWorkflows }; 39 | -------------------------------------------------------------------------------- /views/pages/connect-examples/eg001ValidateWebhookMessage.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |

6 | Prerequisites: See How to validate a webhook message using HMAC. 7 |

8 | 9 |
10 | <% if(example.Forms && example.Forms[0].FormName) { %> 11 | <%- example.Forms[0].FormName %> 12 | <% } %> 13 |
14 | 15 | 17 |
18 |
19 | 20 | 22 |
23 | 24 | 25 | <%- include("../../partials/submitButton") %> 26 |
27 | 28 | <%- include("../../partials/examplesFoot") %> 29 | -------------------------------------------------------------------------------- /views/pages/examples/eg001EmbeddedSigning.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 | 23 | 24 | <%- include("../../partials/submitButton") %> 25 |
26 | 27 | <%- include("../../partials/examplesFoot") %> 28 | -------------------------------------------------------------------------------- /views/pages/examples/eg044FocusedView.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 | 23 | 24 | <%- include("../../partials/submitButton") %> 25 |
26 | 27 | <%- include("../../partials/examplesFoot") %> 28 | -------------------------------------------------------------------------------- /views/pages/examples/eg027DeletePermission.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (profiles.length == 0) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg0{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 | 10 |
11 | <%- include("../../partials/continueButton") %> 12 |
13 | <% } else { %> 14 |
15 | <% if(example.Forms && example.Forms[0].FormName) { %> 16 | <%- example.Forms[0].FormName %> 17 | <% } %> 18 | 19 |
20 | 21 | 26 |
27 | 28 | <%- include("../../partials/submitButton") %> 29 |
30 | <% } %> 31 | 32 | <%- include("../../partials/examplesFoot") %> 33 | -------------------------------------------------------------------------------- /views/pages/examples/quickEmbeddedSigning.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHeadQuickACG") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 | 23 | 24 | <%- include("../../partials/submitButton") %> 25 |
26 | 27 | <%- include("../../partials/examplesFoot") %> 28 | -------------------------------------------------------------------------------- /views/pages/examples/eg025PermissionSetUserGroup.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 17 |
18 | 19 |
20 | 21 | 26 |
27 | 28 | 29 | <%- include("../../partials/submitButton") %> 30 |
31 | 32 | <%- include("../../partials/examplesFoot") %> 33 | -------------------------------------------------------------------------------- /views/pages/examples/eg016SetTabValues.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 | 23 | <%- include("../../partials/submitButton") %> 24 |
25 | 26 | <%- include("../../partials/examplesFoot") %> 27 | 28 | -------------------------------------------------------------------------------- /views/pages/notary-examples/eg004SendThirdPartyNotary.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 |
10 | 11 | 14 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 15 |
16 |
17 | 18 | 20 |
21 | 22 | 23 | <%- include("../../partials/submitButton") %> 24 |
25 | 26 | <%- include("../../partials/examplesFoot") %> 27 | -------------------------------------------------------------------------------- /lib/eSignature/examples/deletePermission.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 027: Deleting a permission profile 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of deleting the permission 11 | */ 12 | const deletePermission = async (args) => { 13 | // Construct your API headers 14 | //ds-snippet-start:eSign27Step2 15 | let dsApiClient = new docusign.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | let accountsApi = new docusign.AccountsApi(dsApiClient); 19 | //ds-snippet-end:eSign27Step2 20 | 21 | //ds-snippet-start:eSign27Step3 22 | await accountsApi.deletePermissionProfile(args.accountId, args.profileId); 23 | //ds-snippet-end:eSign27Step3 24 | }; 25 | 26 | /** 27 | * Form page for this application 28 | */ 29 | const getPermissions = async (args) => { 30 | let dsApiClient = new docusign.ApiClient(); 31 | dsApiClient.setBasePath(args.basePath); 32 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 33 | 34 | let accountApi = new docusign.AccountsApi(dsApiClient); 35 | let profiles = await accountApi.listPermissions(args.accountId); 36 | let permissionProfiles = profiles.permissionProfiles; 37 | 38 | return permissionProfiles; 39 | }; 40 | 41 | 42 | module.exports = { deletePermission, getPermissions }; 43 | -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg006CreateExternalFormFillSession.ejs: -------------------------------------------------------------------------------- 1 | 2 | <%- include("../../partials/examplesHead") %> 3 | 4 | <%- include("../../partials/exampleInfo") %> 5 | 6 | <% include("../../partials/functions") %> 7 | 8 | <% if (documents && documents.length > 0) { %> 9 |
10 | <% if(example.Forms && example.Forms[0].FormName) { %> 11 | <%- example.Forms[0].FormName %> 12 | <% } %> 13 | 14 |
15 | 16 | 21 |
22 | 23 | 24 | <%- include("../../partials/submitButton") %> 25 |
26 | <% } else { %> 27 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="reg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 28 |
29 | <%- include("../../partials/continueButton") %> 30 |
31 | <% } %> 32 | <%- include("../../partials/examplesFoot") %> 33 | -------------------------------------------------------------------------------- /lib/connect/examples/validateWebhookMessage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 001: Validate webhook message using HMAC 4 | * @author DocuSign 5 | */ 6 | 7 | const crypto = require('crypto'); 8 | 9 | /** 10 | * This function computes the hash. 11 | * @param {object} args parameters for computing the hash. 12 | * @param {string} args.secret hmac secret key. 13 | * @param {string} args.payload plain text payload. 14 | * @return {string} Computed hash. 15 | */ 16 | //ds-snippet-start:Connect1Step1 17 | const computeHash = (args) => { 18 | const hmac = crypto.createHmac('sha256', args.secret); 19 | hmac.write(args.payload); 20 | hmac.end(); 21 | return hmac.read().toString('base64'); 22 | }; 23 | 24 | //ds-snippet-end:Connect1Step1 25 | 26 | /** 27 | * This function validates a webhook message. 28 | * @param {object} args parameters for validating the message. 29 | * @param {string} args.verify hash value as base64 string. 30 | * @param {string} args.secret hmac secret key. 31 | * @param {string} args.payload plain text payload. 32 | * @return {boolean} Returns true if the provided hash matches the computed hash, otherwise false. 33 | */ 34 | 35 | //ds-snippet-start:Connect1Step1 36 | const isHashValid = (args) => { 37 | return crypto.timingSafeEqual(Buffer.from(args.verify, 'base64'), Buffer.from(computeHash(args), 'base64')); 38 | }; 39 | //ds-snippet-end:Connect1Step1 40 | module.exports = { computeHash, isHashValid }; 41 | 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | .idea/ 8 | *.iml 9 | .idea/* 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | *.pid.lock 16 | 17 | # Directory for instrumented libs generated by jscoverage/JSCover 18 | lib-cov 19 | 20 | # Coverage directory used by tools like istanbul 21 | coverage 22 | 23 | # nyc test coverage 24 | .nyc_output 25 | 26 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 27 | .grunt 28 | 29 | # Bower dependency directory (https://bower.io/) 30 | bower_components 31 | 32 | # node-waf configuration 33 | .lock-wscript 34 | 35 | # Compiled binary addons (http://nodejs.org/api/addons.html) 36 | build/Release 37 | 38 | # Dependency directories 39 | node_modules/ 40 | jspm_packages/ 41 | 42 | # Typescript v1 declaration files 43 | typings/ 44 | 45 | # Optional npm cache directory 46 | .npm 47 | 48 | # Optional eslint cache 49 | .eslintcache 50 | 51 | # Optional REPL history 52 | .node_repl_history 53 | 54 | # Output of 'npm pack' 55 | *.tgz 56 | 57 | # Yarn Integrity file 58 | .yarn-integrity 59 | 60 | # dotenv environment variables file 61 | .env 62 | 63 | # ignore config file 64 | appsettings.json 65 | jwtConfig.json 66 | secret 67 | 68 | # ignore vs settings 69 | .vs 70 | 71 | # ignore RSA keys 72 | private.key 73 | 74 | # ignore Web Form config 75 | web-form-config.json -------------------------------------------------------------------------------- /views/pages/admin-examples/eg013CreateAccount.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 |
16 | 17 | 19 |
20 |
21 | 22 | 24 |
25 | 26 | <%- include("../../partials/submitButton") %> 27 |
28 | 29 | <%- include("../../partials/examplesFoot") %> 30 | -------------------------------------------------------------------------------- /lib/admin/examples/importUser.js: -------------------------------------------------------------------------------- 1 | const docusign = require('docusign-admin'); 2 | const fs = require('fs'); 3 | 4 | const createBulkImportRequest = async (args) => { 5 | //ds-snippet-start:Admin4Step2 6 | const apiClient = new docusign.ApiClient(); 7 | apiClient.setBasePath(args.basePath); 8 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 9 | //ds-snippet-end:Admin4Step2 10 | 11 | //ds-snippet-start:Admin4Step3 12 | const bulkImportsApi = new docusign.BulkImportsApi(apiClient); 13 | 14 | // get the user data from the csv file 15 | let userData = fs.readFileSync(args.csvFilePath).toString(); 16 | 17 | // replace all {account_id} occurrences with the actual account id value 18 | userData = Buffer.from(userData.replace(/{account_id}/g, args.accountId)); 19 | 20 | return await bulkImportsApi.createBulkImportAddUsersRequest(args.organizationId, userData); 21 | //ds-snippet-end:Admin4Step3 22 | }; 23 | 24 | const checkStatus = async (args) => { 25 | const apiClient = new docusign.ApiClient(); 26 | apiClient.setBasePath(args.basePath); 27 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 28 | 29 | const bulkImportsApi = new docusign.BulkImportsApi(apiClient); 30 | 31 | //ds-snippet-start:Admin4Step4 32 | return await bulkImportsApi.getBulkUserImportRequest(args.organizationId, args.importId); 33 | //ds-snippet-end:Admin4Step4 34 | }; 35 | 36 | module.exports = { createBulkImportRequest, checkStatus}; 37 | -------------------------------------------------------------------------------- /lib/admin/examples/auditUsers.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | const dsConfig = require('../../../config/index.js').config; 3 | const moment = require('moment'); 4 | 5 | /** 6 | * audit recently modified users in your account 7 | * @param {object} args 8 | */ 9 | const auditUsers = async (args) => { 10 | //ds-snippet-start:Admin5Step2 11 | let dsApiClient = new docusignAdmin.ApiClient(); 12 | dsApiClient.setBasePath(dsConfig.adminAPIUrl); 13 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 14 | //ds-snippet-end:Admin5Step2 15 | 16 | //ds-snippet-start:Admin5Step3 17 | let options = { 18 | accountId: args.accountId, 19 | lastModifiedSince: moment().subtract(10, 'days').format() 20 | }; 21 | 22 | const usersApi = new docusignAdmin.UsersApi(dsApiClient); 23 | const modifiedUsers = (await usersApi.getUsers(args.organizationId, options)).users; 24 | //ds-snippet-end:Admin5Step3 25 | 26 | //ds-snippet-start:Admin5Step5 27 | let results = []; 28 | let opts = {}; 29 | 30 | for (const user of modifiedUsers) { 31 | //ds-snippet-end:Admin5Step5 32 | //ds-snippet-start:Admin5Step4 33 | opts.email = user.email; 34 | //ds-snippet-end:Admin5Step4 35 | //ds-snippet-start:Admin5Step5 36 | const result = await usersApi.getUserProfiles(args.organizationId, opts); 37 | results.push(result.users); 38 | } 39 | //ds-snippet-end:Admin5Step5 40 | return results; 41 | }; 42 | 43 | module.exports = { auditUsers }; 44 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [14.x, 16.x, 18.x] 20 | 21 | steps: 22 | - uses: actions/checkout@v3 23 | - name: Use Node.js ${{ matrix.node-version }} 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version: ${{ matrix.node-version }} 27 | cache: 'npm' 28 | 29 | - name: Run clean install 30 | run: | 31 | npm cache clean --force 32 | npm cache verify 33 | npm install 34 | 35 | - name: Run linter 36 | run: npm run lint 37 | 38 | - name: Run build 39 | run: npm run build --if-present 40 | 41 | - name: Run tests 42 | run: npm test 43 | env: 44 | CLIENT_ID: ${{ secrets.CLIENT_ID }} 45 | USER_ID: ${{ secrets.USER_ID }} 46 | APP_URL: ${{ secrets.APP_URL }} 47 | SIGNER_EMAIL: ${{ secrets.SIGNER_EMAIL }} 48 | SIGNER_NAME: ${{ secrets.SIGNER_NAME }} 49 | PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} 50 | -------------------------------------------------------------------------------- /lib/rooms/examples/exportDataFromRoom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 003: Export Data From Room 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignRooms = require('docusign-rooms'); 8 | 9 | /** 10 | * Get Room Field Data 11 | * @param {object} args 12 | */ 13 | const exportDataFromRoom = async (args) => { 14 | //ds-snippet-start:Rooms3Step2 15 | let dsApiClient = new docusignRooms.ApiClient(); 16 | 17 | dsApiClient.setBasePath(args.basePath); 18 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 19 | //ds-snippet-end:Rooms3Step2 20 | 21 | //ds-snippet-start:Rooms3Step3 22 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 23 | let results = null; 24 | results = roomsApi.getRoomFieldData(args.accountId, args.roomsArgs.roomId); 25 | //ds-snippet-end:Rooms3Step3 26 | 27 | console.log(`Rooms Data retrieved: ${JSON.stringify(results)}`); 28 | return results; 29 | }; 30 | 31 | /** 32 | * Form page for this application 33 | */ 34 | const getRooms = async (args) => { 35 | let dsApiClient = new docusignRooms.ApiClient(); 36 | dsApiClient.setBasePath(args.basePath); 37 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 38 | 39 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 40 | let userRooms = null; 41 | 42 | userRooms = await roomsApi.getRooms( 43 | args.accountId, 44 | { count: 5 } /* optional*/, 45 | null 46 | ); 47 | 48 | return userRooms; 49 | }; 50 | 51 | module.exports = { exportDataFromRoom, getRooms }; 52 | -------------------------------------------------------------------------------- /views/pages/click-examples/eg005ClickwrapResponses.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (clickwrapsData.clickwraps.length == 0) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="ceg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 |
10 | <%- include("../../partials/continueButton") %> 11 |
12 | <% } else { %> 13 |
14 | <% if(example.Forms && example.Forms[0].FormName) { %> 15 | <%- example.Forms[0].FormName %> 16 | <% } %> 17 | 18 |
19 | 20 | 26 |
27 | 28 | <%- include("../../partials/submitButton") %> 29 |
30 | <% } %> 31 | 32 | <%- include("../../partials/examplesFoot") %> 33 | -------------------------------------------------------------------------------- /views/pages/click-examples/eg002ActivateClickwrap.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (clickwrapsData.clickwraps.length == 0) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="ceg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 |
10 | <%- include("../../partials/continueButton") %> 11 |
12 | <% } else { %> 13 |
14 | <% if(example.Forms && example.Forms[0].FormName) { %> 15 | <%- example.Forms[0].FormName %> 16 | <% } %> 17 | 18 |
19 | 20 | 28 |
29 | 30 | <%- include("../../partials/submitButton") %> 31 |
32 | <% } %> 33 | 34 | <%- include("../../partials/examplesFoot") %> 35 | -------------------------------------------------------------------------------- /lib/eSignature/examples/unpauseSignatureWorkflow.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 33: Unpause a signature workflow 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * Work with creating of the envelope 11 | * @param {Object} args Arguments for creating envelope 12 | * @return {Object} The object with value of envelopeId or error 13 | */ 14 | const unpauseSignatureWorkflow = async (args) => { 15 | // Step 1. Construct your API headers 16 | //ds-snippet-start:eSign33Step2 17 | let dsApiClient = new docusign.ApiClient(); 18 | dsApiClient.setBasePath(args.basePath); 19 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 20 | //ds-snippet-end:eSign33Step2 21 | 22 | // Step 2. Construct the request body 23 | //ds-snippet-start:eSign33Step3 24 | const workflow = docusign.Workflow.constructFromObject({ 25 | workflowStatus: 'in_progress', 26 | }); 27 | const envelopeDefinition = docusign.EnvelopeDefinition.constructFromObject({ 28 | workflow, 29 | }); 30 | //ds-snippet-end:eSign33Step3 31 | 32 | // Step 3. Call the eSignature API 33 | // Exceptions will be caught by the calling function 34 | //ds-snippet-start:eSign33Step4 35 | const envelopesApi = new docusign.EnvelopesApi(dsApiClient); 36 | const result = await envelopesApi.update(args.accountId, args.envelopeId, { 37 | envelopeDefinition, 38 | resendEnvelope: true, 39 | }); 40 | //ds-snippet-end:eSign33Step4 41 | 42 | return { envelopeId: result.envelopeId }; 43 | }; 44 | 45 | module.exports = { unpauseSignatureWorkflow }; 46 | -------------------------------------------------------------------------------- /views/pages/examples/eg043SharedAccess.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 |
10 | 11 | 13 |
14 |
15 | 16 | 18 |
19 |
20 | 21 | 23 | <%= locals.manifest.SupportingTexts.HelpingTexts.SaveAgentActivationCode %> 24 |
25 | 26 | 27 | <%- include("../../partials/submitButton") %> 28 |
29 | 30 | <%- include("../../partials/examplesFoot") %> 31 | -------------------------------------------------------------------------------- /config/appsettings.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "dsClientId": "{INTEGRATION_KEY_AUTH_CODE}", 3 | "dsClientSecret": "{SECRET_KEY}", 4 | "dsJWTClientId": "{INTEGRATION_KEY_JWT}", 5 | "privateKeyLocation": "config/private.key", 6 | "impersonatedUserGuid": "{IMPERSONATED_USER_ID}", 7 | "signerEmail": "{SIGNER_EMAIL}", 8 | "signerName": "{SIGNER_NAME}", 9 | "appUrl": "http://localhost:3000", 10 | "production": false, 11 | "debug": true, 12 | "sessionSecret": "12345", 13 | "allowSilentAuthentication": true, 14 | "targetAccountId": false, 15 | "demoDocPath": "demo_documents", 16 | "docDocx": "World_Wide_Corp_Battle_Plan_Trafalgar.docx", 17 | "docPdf": "World_Wide_Corp_lorem.pdf", 18 | "docTxt": "Welcome.txt", 19 | "docTermsPdf": "Term_Of_Service.pdf", 20 | "gatewayAccountId": "{GATEWAY_ACCOUNT_ID}", 21 | "gatewayName": "stripe", 22 | "gatewayDisplayName": "Stripe", 23 | "githubExampleUrl": "https://github.com/docusign/code-examples-node/tree/master/lib/", 24 | "documentation": null, 25 | "multiSourceChooser": false, 26 | "quickstart" : "{QUICKSTART_VALUE}", 27 | "quickACG" : "{QUICKACG_VALUE}", 28 | "roomsApiUrl": "https://demo.rooms.docusign.com", 29 | "clickAPIUrl": "https://demo.docusign.net/clickapi", 30 | "adminAPIUrl": "https://api-d.docusign.net/management", 31 | "monitorApiUrl": "https://lens-d.docusign.net", 32 | "webformsApiUrl": "https://apps-d.docusign.com/api/webforms", 33 | "iamBasePath": "https://api-d.docusign.com/v1", 34 | "codeExamplesManifest": "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/CodeExamplesManifest.json" 35 | } 36 | -------------------------------------------------------------------------------- /quick_acg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docusign-code-examples-quick-acg", 3 | "version": "1.0.0", 4 | "description": "DocuSign eSignature Code example using either Authorization Code Grant", 5 | "main": "quickACG.js", 6 | "scripts": { 7 | "test": "run-script-os", 8 | "test:win32": "(if exist node_modules/ (cd ../ && remove-node-modules && move quick_acg/node_modules ./))", 9 | "test:default": "[ ! -d 'node_modules' ] || (rm -rf ../node_modules && mv -f node_modules ../)", 10 | "start": "npm test && node quickACG.js" 11 | }, 12 | "author": "DocuSign, Inc", 13 | "license": "MIT", 14 | "engines": { 15 | "node": ">=8.10" 16 | }, 17 | "dependencies": { 18 | "axios": "^1.7.7", 19 | "body-parser": "^1.20.3", 20 | "cookie-parser": "^1.4.7", 21 | "csurf": "^1.11.0", 22 | "docusign-esign": "^8.0.1", 23 | "ejs": "^3.1.10", 24 | "express": "^4.21.1", 25 | "express-flash": "0.0.2", 26 | "express-session": "^1.18.1", 27 | "fs": "0.0.1-security", 28 | "fs-extra": "^11.2.0", 29 | "helmet": "^3.23.3", 30 | "memorystore": "^1.6.7", 31 | "moment": "^2.30.1", 32 | "passport": "^0.7.0", 33 | "passport-docusign": "^1.3.0", 34 | "path": "^0.12.7", 35 | "run-script-os": "^1.1.6", 36 | "remove-node-modules": "^1.7.6", 37 | "validator": "^13.12.0", 38 | "node-fetch": "2.7.0" 39 | }, 40 | "devDependencies": { 41 | "chai": "^4.5.0", 42 | "mocha": "^10.7.3" 43 | }, 44 | "overrides": { 45 | "braces": "^3.0.3", 46 | "pac-resolver": "^7.0.1", 47 | "semver": "^7.5.4" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/admin/examples/deleteUserDataFromOrganization.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | 3 | /** 4 | * This function deletes user data from an account using email address 5 | * @param {Object} args - object with arguments 6 | * @param {string} args.basePath 7 | * @param {string} args.accessToken 8 | * @param {string} args.email 9 | * @param {string} args.organizationId 10 | */ 11 | const deleteUser = async (args) => { 12 | //ds-snippet-start:Admin10Step2 13 | const apiClient = new docusignAdmin.ApiClient(); 14 | apiClient.setBasePath(args.basePath); 15 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 16 | //ds-snippet-end:Admin10Step2 17 | 18 | const usersApi = new docusignAdmin.UsersApi(apiClient); 19 | const profiles = await usersApi.getUserDSProfilesByEmail(args.organizationId, { email: args.email }); 20 | const user = profiles.users[0]; 21 | 22 | //ds-snippet-start:Admin10Step3 23 | const organizationsApi = new docusignAdmin.OrganizationsApi(apiClient); 24 | const userRedactionRequest = 25 | docusignAdmin.IndividualUserDataRedactionRequest.constructFromObject({ 26 | user_id: user.id, 27 | memberships: [ 28 | docusignAdmin.MembershipDataRedactionRequest.constructFromObject({ 29 | account_id: user.memberships[0].account_id, 30 | }), 31 | ], 32 | }); 33 | //ds-snippet-end:Admin10Step3 34 | 35 | 36 | //ds-snippet-start:Admin10Step4 37 | return await organizationsApi.redactIndividualUserData(userRedactionRequest, args.organizationId); 38 | //ds-snippet-end:Admin10Step4 39 | }; 40 | 41 | module.exports = { deleteUser }; 42 | -------------------------------------------------------------------------------- /lib/eSignature/examples/listEnvelopes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 003: List envelopes in the user's account 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | const moment = require('moment'); 9 | 10 | /** 11 | * This function does the work of listing the envelopes 12 | */ 13 | const listEnvelope = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | 19 | //ds-snippet-start:eSign3Step2 20 | let dsApiClient = new docusign.ApiClient(); 21 | dsApiClient.setBasePath(args.basePath); 22 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 23 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 24 | let results = null; 25 | //ds-snippet-end:eSign3Step2 26 | 27 | // Step 1. List the envelopes 28 | // The Envelopes::listStatusChanges method has many options 29 | // See https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/liststatuschanges/ 30 | 31 | // The list status changes call requires at least a from_date OR 32 | // a set of envelopeIds. Here we filter using a from_date. 33 | // Here we set the from_date to filter envelopes for the last month 34 | // Use ISO 8601 date format 35 | let options = { fromDate: moment().subtract(30, 'days').format('YYYY-MM-DD') }; 36 | 37 | // Exceptions will be caught by the calling function 38 | //ds-snippet-start:eSign3Step2 39 | results = await envelopesApi.listStatusChanges(args.accountId, options); 40 | //ds-snippet-end:eSign3Step2 41 | return results; 42 | }; 43 | 44 | module.exports = { listEnvelope }; 45 | -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg004AddingFormToRoom.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (rooms && rooms.length > 0) { %> 8 |
9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 |
14 | 15 | 20 |
21 |
22 | 23 | 28 |
29 | 30 | <%- include("../../partials/submitButton") %> 31 |
32 | <% } else { %> 33 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="reg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 34 | 35 |
36 | <%- include("../../partials/continueButton") %> 37 |
38 | <% } %> 39 | <%- include("../../partials/examplesFoot") %> 40 | -------------------------------------------------------------------------------- /lib/workspaces/examples/createUploadRequest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 005: Create a workspace upload request 4 | * @author DocuSign 5 | */ 6 | 7 | const iam = require('@docusign/iam-sdk'); 8 | const moment = require('moment'); 9 | 10 | const createUploadRequest = async (args) => { 11 | //ds-snippet-start:Workspaces5Step2 12 | const client = new iam.IamClient({ accessToken: args.accessToken }); 13 | //ds-snippet-end:Workspaces5Step2 14 | 15 | const dueDate = moment().add(7, 'days').toDate(); 16 | 17 | //ds-snippet-start:Workspaces5Step3 18 | // create assignments 19 | const assigneeAssignment = { 20 | uploadRequestResponsibilityTypeId: 'assignee', 21 | firstName: 'Test', 22 | lastName: 'User', 23 | email: args.assigneeEmail, 24 | }; 25 | const watcherAssignments = { 26 | assigneeUserId: args.workspaceCreatorId, 27 | uploadRequestResponsibilityTypeId: 'watcher' 28 | }; 29 | 30 | // create upload request 31 | const createWorkspaceUploadRequestBody = { 32 | name: `Upload Request example ${dueDate}`, 33 | description: 'This is an example upload request created via the workspaces API', 34 | dueDate: dueDate, 35 | status: 'draft', 36 | assignments: [assigneeAssignment, watcherAssignments], 37 | }; 38 | //ds-snippet-end:Workspaces5Step3 39 | 40 | //ds-snippet-start:Workspaces5Step4 41 | return await client.workspaces1.workspaceUploadRequest.createWorkspaceUploadRequest( 42 | { 43 | accountId: args.accountId, 44 | workspaceId: args.workspaceId, 45 | createWorkspaceUploadRequestBody, 46 | } 47 | ); 48 | //ds-snippet-end:Workspaces5Step4 49 | }; 50 | 51 | module.exports = { createUploadRequest }; 52 | -------------------------------------------------------------------------------- /views/pages/examples/eg035ScheduledSending.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 25 | Please choose a date in the future. 26 |
27 | 28 | <%- include("../../partials/submitButton") %> 29 |
-------------------------------------------------------------------------------- /views/pages/rooms-examples/eg008GrantOfficeAccessToFormGroup.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 |
8 | <% if (formGroups && formGroups.length > 0) { %> 9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 |
14 | 15 | 20 | 21 | 26 |
27 | 28 | <%- include("../../partials/submitButton") %> 29 | <% } else { %> 30 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="reg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 31 | <% } %> 32 |
33 | 34 | <%- include("../../partials/examplesFoot") %> 35 | -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg002CreateRoomFromTemplate.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (templates && templates.length > 0) { %> 8 |
9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 |
14 | 15 | 17 |
18 |
19 | 20 | 25 |
26 | 27 | <%- include("../../partials/submitButton") %> 28 |
29 | <% } else { %> 30 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 31 | 32 |
33 | <%- include("../../partials/continueButton") %> 34 |
35 | <% } %> 36 | 37 | <%- include("../../partials/examplesFoot") %> -------------------------------------------------------------------------------- /views/pages/rooms-examples/eg009AssignFormToFormGroup.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 |
8 | <% if (formGroups && formGroups.length > 0) { %> 9 | <% if(example.Forms && example.Forms[0].FormName) { %> 10 | <%- example.Forms[0].FormName %> 11 | <% } %> 12 | 13 |
14 | 15 | 20 | 21 | 26 |
27 | 28 | <%- include("../../partials/submitButton") %> 29 | <% } else { %> 30 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="reg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 31 | <% } %> 32 |
33 | 34 | <%- include("../../partials/examplesFoot") %> -------------------------------------------------------------------------------- /views/pages/examples/eg007EnvelopeGetDoc.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (! envelopeOk) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 | 10 |
11 | <%- include("../../partials/continueButton") %> 12 |
13 | <% } else if (!documentsOk) { %> 14 | <%- formatString(example.RedirectsToOtherCodeExamples[1].RedirectText, formatString('href="eg00{0}"', example.RedirectsToOtherCodeExamples[1].CodeExampleToRedirectTo)) %> 15 | 16 |
17 | <%- include("../../partials/continueButton") %> 18 |
19 | <% } else { %> 20 |
21 | <% if(example.Forms && example.Forms[0].FormName) { %> 22 | <%- example.Forms[0].FormName %> 23 | <% } %> 24 | 25 |
26 | 27 | 33 |
34 | 35 | <%- include("../../partials/submitButton") %> 36 |
37 | <% } %> 38 | 39 | <%- include("../../partials/examplesFoot") %> 40 | -------------------------------------------------------------------------------- /views/pages/examples/eg019AccessCodeAuthentication.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 |
16 | 17 | 20 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 21 |
22 |
23 | 24 | 26 |
27 | 28 | <%- include("../../partials/submitButton") %> 29 |
30 | 31 | <%- include("../../partials/examplesFoot") %> 32 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg009DeleteUserProductPermissionProfile.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (emailOk) { %> 8 | <% if(example.Forms && example.Forms[0].FormName) { %> 9 | <%- formatString(example.Forms[0].FormName, email) %> 10 | <% } %> 11 | 12 |
13 | <% if (permissionProfileList && permissionProfileList.length > 0) { %> 14 |
15 | 16 | 21 |
22 | <% } else { %> 23 |

Problem: Please first create a user with permission profile. 24 |
Thank you.

25 | <% } %> 26 | 27 | <%- include("../../partials/submitButton") %> 28 |
29 | <% } else { %> 30 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="aeg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 31 | 32 |
33 | <%- include("../../partials/continueButton") %> 34 |
35 | <% } %> 36 | 37 | <%- include("../../partials/examplesFoot") %> 38 | -------------------------------------------------------------------------------- /lib/eSignature/examples/applyBrandToTemplate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 030: Apply Brand to Template 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of creating the envelope 11 | */ 12 | const applyBrandToTemplate = async (args) => { 13 | // Step 1. Construct your API headers 14 | //ds-snippet-start:eSign30Step2 15 | let dsApiClient = new docusign.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 19 | //ds-snippet-end:eSign30Step2 20 | 21 | // Step 2. Construct your request body 22 | //ds-snippet-start:eSign30Step3 23 | const envDef = { 24 | envelopeDefinition: { 25 | templateId: args.templateId, 26 | brandId: args.brandId, 27 | templateRoles: args.templateRoles, 28 | status: 'sent', 29 | }, 30 | }; 31 | //ds-snippet-end:eSign30Step3 32 | 33 | // Step 3. Call the eSignature REST API 34 | //ds-snippet-start:eSign30Step4 35 | let results = await envelopesApi.createEnvelope(args.accountId, envDef); 36 | //ds-snippet-end:eSign30Step4 37 | return results; 38 | }; 39 | 40 | /** 41 | * Form page for this application 42 | */ 43 | const getBrands = async (args) => { 44 | let dsApiClient = new docusign.ApiClient(); 45 | dsApiClient.setBasePath(args.basePath); 46 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 47 | 48 | let brandApi = new docusign.AccountsApi(dsApiClient); 49 | brandsResponse = await brandApi.listBrands(args.accountId); 50 | 51 | return brandsResponse; 52 | }; 53 | 54 | module.exports = { applyBrandToTemplate, getBrands }; 55 | -------------------------------------------------------------------------------- /views/partials/foot.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | <% if (false) { %> 22 | 23 |
24 |   locals:
25 |   <%= JSON.stringify(locals, null, "    ") %>
26 |   
27 | <% } %> 28 | 29 | 30 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /config/documentOptions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "langCode": "csharp", 4 | "name": "C#", 5 | "githubExampleUrl": "https://github.com/docusign/code-examples-csharp-core/tree/master/code-examples-csharp-core/Controllers/", 6 | "owner": "docusign", 7 | "repo": "code-examples-csharp-core", 8 | "pathPrefix": "code-examples-csharp-core/Controllers/" 9 | }, 10 | { 11 | "langCode": "php", 12 | "name": "PHP", 13 | "githubExampleUrl": "https://github.com/docusign/code-examples-php/blob/master/src/", 14 | "owner": "docusign", 15 | "repo": "code-examples-php", 16 | "pathPrefix": "src/" 17 | }, 18 | { 19 | "langCode": "java", 20 | "name": "Java", 21 | "githubExampleUrl": "https://github.com/docusign/code-examples-java/tree/master/src/main/java/com/docusign/controller/examples/", 22 | "owner": "docusign", 23 | "repo": "code-examples-java", 24 | "pathPrefix": "src/main/java/com/docusign/controller/examples/" 25 | }, 26 | { 27 | "langCode": "node", 28 | "name": "Node.js", 29 | "githubExampleUrl": "https://github.com/docusign/code-examples-node/tree/master/lib/examples/", 30 | "owner": "docusign", 31 | "repo": "code-examples-node", 32 | "pathPrefix": "lib/examples/" 33 | }, 34 | { 35 | "langCode": "bash", 36 | "name": "API / bash", 37 | "githubExampleUrl": "https://github.com/docusign/code-examples-bash/tree/master/examples/", 38 | "owner": "docusign", 39 | "repo": "code-examples-bash", 40 | "pathPrefix": "examples/" 41 | }, 42 | { 43 | "langCode": "python", 44 | "name": "Python", 45 | "githubExampleUrl": "https://github.com/docusign/code-examples-python/tree/master/app/", 46 | "owner": "docusign", 47 | "repo": "code-examples-python", 48 | "pathPrefix": "app/" 49 | } 50 | ] -------------------------------------------------------------------------------- /lib/eSignature/examples/permissionChangeSingleSetting.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 026: Updateing individual permission profile settings 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of updating the permission profile 11 | */ 12 | const updatePermissionProfile = async (args) => { 13 | // Step 1. Construct your API headers 14 | //ds-snippet-start:eSign26Step2 15 | let dsApiClient = new docusign.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | let accountsApi = new docusign.AccountsApi(dsApiClient); 19 | //ds-snippet-end:eSign26Step2 20 | 21 | // Step 2. Construct the request 22 | //ds-snippet-start:eSign26Step3 23 | const requestBody = { 24 | permissionProfile: { 25 | permissionProfileName: args.profileName, 26 | }, 27 | }; 28 | //ds-snippet-end:eSign26Step3 29 | 30 | // Step 3. Call the eSignature REST API 31 | //ds-snippet-start:eSign26Step4 32 | let results = await accountsApi.updatePermissionProfile( 33 | args.accountId, 34 | args.selectedId, 35 | requestBody 36 | ); 37 | //ds-snippet-end:eSign26Step4 38 | 39 | return results; 40 | }; 41 | 42 | /** 43 | * Form page for this application 44 | */ 45 | const getProfiles = async (args) => { 46 | let dsApiClient = new docusign.ApiClient(); 47 | dsApiClient.setBasePath(args.basePath); 48 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 49 | 50 | let accountApi = new docusign.AccountsApi(dsApiClient); 51 | let profiles = await accountApi.listPermissions(args.accountId); 52 | 53 | return profiles; 54 | }; 55 | 56 | module.exports = { updatePermissionProfile, getProfiles }; 57 | -------------------------------------------------------------------------------- /views/pages/connected-fields/eg001SetConnectedFields.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 29 |
30 | 31 | 32 | <%- include("../../partials/submitButton") %> 33 |
34 | 35 | <%- include("../../partials/examplesFoot") %> 36 | -------------------------------------------------------------------------------- /views/pages/workspaces-examples/eg005CreateUploadRequest.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% if (!workspaceIdOk) { %> 6 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="work00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 7 |
8 | <%- include("../../partials/continueButton") %> 9 |
10 | <% } else if (!workspaceCreatorIdOk) { %> 11 | <%- formatString(example.RedirectsToOtherCodeExamples[1].RedirectText, formatString('href="work00{0}"', example.RedirectsToOtherCodeExamples[1].CodeExampleToRedirectTo)) %> 12 |
13 | <%- include("../../partials/continueButton") %> 14 |
15 | <% } else { %> 16 |
17 | <% if(example.Forms && example.Forms[0].FormName) { %> 18 | <%- example.Forms[0].FormName %> 19 | <% } %> 20 | 21 |
22 | 23 | 26 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 27 |
28 | 29 | 30 | <%- include("../../partials/submitButton") %> 31 |
32 | <% } %> 33 | 34 | <%- include("../../partials/examplesFoot") %> 35 | -------------------------------------------------------------------------------- /lib/monitor/examples/getMonitoringData.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 001: Getting the monitoring data 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-monitor'); 8 | 9 | /** 10 | * This function does the work of getting the monitoring data 11 | */ 12 | const getMonitoringData = async (args) => { 13 | //ds-snippet-start:Monitor1Step2 14 | let dsApiClient = new docusign.ApiClient(); 15 | dsApiClient.setBasePath(args.basePath); 16 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 17 | //ds-snippet-end:Monitor1Step2 18 | 19 | //ds-snippet-start:Monitor1Step3 20 | const cursorDate = new Date(); 21 | cursorDate.setDate(cursorDate.getDate() - 1); 22 | const limit = 2000; // Amount of records you want to read in one request 23 | let functionResult = []; 24 | 25 | let complete = false; 26 | let cursorValue = cursorDate.toISOString().split('T')[0] + 'T00:00:00Z' 27 | let cursoredResult; 28 | const datasetApi = new docusign.DataSetApi(dsApiClient); 29 | 30 | let options = { 31 | limit: limit, 32 | }; 33 | 34 | // Get monitoring data 35 | do { 36 | if (cursorValue != null) { 37 | options.cursor = cursorValue; 38 | } 39 | cursoredResult = await datasetApi.getStream('2.0', 'monitor', options); 40 | let endCursor = cursoredResult.endCursor; 41 | 42 | // If the endCursor from the response is the same as the one that you already have, 43 | // it means that you have reached the end of the records 44 | if (endCursor === cursorValue) { 45 | complete = true; 46 | } else { 47 | cursorValue = endCursor; 48 | functionResult.push(cursoredResult.data); 49 | } 50 | } while (!complete); 51 | 52 | //ds-snippet-end:Monitor1Step3 53 | return functionResult; 54 | }; 55 | 56 | module.exports = { getMonitoringData }; 57 | -------------------------------------------------------------------------------- /views/pages/click-examples/eg003CreateNewClickwrapVersion.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (clickwrapsData.clickwraps.length == 0) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="ceg00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 |
10 | <%- include("../../partials/continueButton") %> 11 |
12 | <% } else { %> 13 | 14 |
15 | <% if(example.Forms && example.Forms[0].FormName) { %> 16 | <%- example.Forms[0].FormName %> 17 | <% } %> 18 | 19 |
20 | 21 | 27 |
28 |
29 | 30 | 32 |
33 | 34 | <%- include("../../partials/submitButton") %> 35 |
36 | <% } %> 37 | 38 | <%- include("../../partials/examplesFoot") %> 39 | -------------------------------------------------------------------------------- /views/pages/examples/eg020PhoneAuthentication.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 14 |
15 |
16 | 17 | 19 |
20 |
21 | 22 | 24 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 25 |
26 |
27 | 28 | 30 |
31 | 32 | <%- include("../../partials/submitButton") %> 33 |
34 | 35 | <%- include("../../partials/examplesFoot") %> 36 | -------------------------------------------------------------------------------- /lib/admin/examples/deleteUserProductPermissionProfile.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | 3 | /** 4 | * Delete user product permission profiles using an email address 5 | */ 6 | const deleteUserProductPermissionProfile = async (args) => { 7 | //ds-snippet-start:Admin9Step2 8 | const dsApiClient = new docusignAdmin.ApiClient(); 9 | dsApiClient.setBasePath(args.basePath); 10 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 11 | //ds-snippet-end:Admin9Step2 12 | 13 | //ds-snippet-start:Admin9Step4 14 | const userProductProfileDeleteRequest = { 15 | user_email: args.email, 16 | product_ids: [ args.productId ] 17 | }; 18 | //ds-snippet-end:Admin9Step4 19 | 20 | //ds-snippet-start:Admin9Step5 21 | const productPermissionProfilesApi = new docusignAdmin.ProductPermissionProfilesApi(dsApiClient); 22 | return productPermissionProfilesApi.removeUserProductPermission(userProductProfileDeleteRequest, args.organizationId, args.accountId); 23 | //ds-snippet-end:Admin9Step5 24 | }; 25 | 26 | const getProductPermissionProfilesByEmail = async (args) => { 27 | // Create an API Client with headers 28 | const dsApiClient = new docusignAdmin.ApiClient(); 29 | dsApiClient.setBasePath(args.basePath); 30 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 31 | 32 | //ds-snippet-start:Admin9Step3 33 | const productPermissionProfilesApi = new docusignAdmin.ProductPermissionProfilesApi(dsApiClient); 34 | const getUserProductPermission = { 35 | email: args.email 36 | }; 37 | 38 | const permissionProfiles = await productPermissionProfilesApi.getUserProductPermissionProfilesByEmail(args.organizationId, args.accountId, getUserProductPermission); 39 | return permissionProfiles['product_permission_profiles']; 40 | //ds-snippet-end:Admin9Step3 41 | }; 42 | 43 | module.exports = { deleteUserProductPermissionProfile, getProductPermissionProfilesByEmail }; 44 | -------------------------------------------------------------------------------- /test/bulkEnvelopesTests.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const chai = require('chai'); 3 | const chaiExclude = require('chai-exclude'); 4 | const should = chai.should(); 5 | 6 | const { bulkSendEnvelopes } = require('../lib/eSignature/examples/bulkSendEnvelope'); 7 | const { TEST_TIMEOUT_MS, authenticate, config } = require('./testHelpers'); 8 | 9 | const { 10 | TEST_PDF_FILE, 11 | BASE_PATH, 12 | CC_EMAIL, 13 | CC_NAME, 14 | SIGNER2_NAME, 15 | SIGNER2_EMAIL, 16 | CC2_NAME, 17 | CC2_EMAIL, 18 | } = require('./constants') 19 | 20 | chai.use(chaiExclude); 21 | 22 | let ACCOUNT_ID; 23 | let ACCESS_TOKEN; 24 | 25 | describe ('BulkEnvelopesApi tests:', function() { 26 | before(async function() { 27 | this.timeout(TEST_TIMEOUT_MS); 28 | 29 | const { accountId, accessToken } = await authenticate(); 30 | 31 | should.exist(accountId); 32 | should.exist(accessToken); 33 | 34 | ACCOUNT_ID = accountId; 35 | ACCESS_TOKEN = accessToken; 36 | }); 37 | 38 | it('bulkSendEnvelopes method should create a bulk send request if correct data is provided', async function() { 39 | this.timeout(TEST_TIMEOUT_MS); 40 | 41 | const list1 = { 42 | signer: { 43 | name: config.signerName, 44 | email: config.signerEmail, 45 | }, 46 | cc: { 47 | name: CC_NAME, 48 | email: CC_EMAIL, 49 | } 50 | }; 51 | const list2 = { 52 | signer: { 53 | name: SIGNER2_NAME, 54 | email: SIGNER2_EMAIL, 55 | }, 56 | cc: { 57 | name: CC2_NAME, 58 | email: CC2_EMAIL, 59 | } 60 | }; 61 | 62 | const args = { 63 | accessToken: ACCESS_TOKEN, 64 | basePath: BASE_PATH, 65 | accountId: ACCOUNT_ID, 66 | list1: list1, 67 | list2: list2, 68 | docFile: path.resolve(TEST_PDF_FILE) 69 | }; 70 | 71 | const bulkSendStatus = await bulkSendEnvelopes(args); 72 | 73 | should.exist(bulkSendStatus); 74 | }); 75 | }) 76 | -------------------------------------------------------------------------------- /views/pages/examples/eg041CFREmbeddedSigning.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 26 |
27 |
28 | 29 | 31 |
32 | 33 | 34 | <%- include("../../partials/submitButton") %> 35 |
36 | 37 | <%- include("../../partials/examplesFoot") %> 38 | -------------------------------------------------------------------------------- /lib/eSignature/examples/permissionSetUserGroup.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 025: The permission was set 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of updating groups permissions 11 | */ 12 | const setPermission = async (args) => { 13 | // Step 1. Construct your API headers 14 | //ds-snippet-start:eSign25Step2 15 | let dsApiClient = new docusign.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | let groupApi = new docusign.GroupsApi(dsApiClient); 19 | //ds-snippet-end:eSign25Step2 20 | 21 | // Step 2: Construct the reqeust body 22 | //ds-snippet-start:eSign25Step3 23 | const requestBody = { 24 | groupInformation: { 25 | groups: [ 26 | { 27 | permissionProfileId: args.permissionProfileId, 28 | groupId: args.userGroupId, 29 | }, 30 | ], 31 | }, 32 | }; 33 | //ds-snippet-end:eSign25Step3 34 | 35 | //ds-snippet-start:eSign25Step4 36 | let results = await groupApi.updateGroups(args.accountId, requestBody); 37 | //ds-snippet-end:eSign25Step4 38 | 39 | return results; 40 | }; 41 | 42 | /** 43 | * This function does the work of listing the user's permissions and groups 44 | */ 45 | const getGroupsAndPermissions = async (args) => { 46 | let dsApiClient = new docusign.ApiClient(); 47 | dsApiClient.setBasePath(args.basePath); 48 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 49 | 50 | let accountApi = new docusign.AccountsApi(dsApiClient); 51 | let listPermissions = await accountApi.listPermissions(args.accountId); 52 | 53 | let groupApi = new docusign.GroupsApi(dsApiClient); 54 | let userGroups = await groupApi.listGroups(args.accountId); 55 | 56 | return { listPermissions: listPermissions, userGroups: userGroups }; 57 | }; 58 | 59 | module.exports = { setPermission, getGroupsAndPermissions }; 60 | -------------------------------------------------------------------------------- /lib/eSignature/examples/embeddedConsole.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 012: Embedded NDSE (console) 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of returning a URL for the NDSE view 11 | * @param {object} args object 12 | */ 13 | const createEmbeddedConsoleView = async (args) => { 14 | // Data for this method 15 | // args.basePath 16 | // args.accessToken 17 | // args.accountId 18 | // args.dsReturnUrl 19 | // args.startingView 20 | // args.envelopeId 21 | 22 | //ds-snippet-start:eSign12Step2 23 | let dsApiClient = new docusign.ApiClient(); 24 | dsApiClient.setBasePath(args.basePath); 25 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 26 | let envelopesApi = new docusign.EnvelopesApi(dsApiClient); 27 | 28 | // Step 1. create the NDSE view 29 | let viewRequest = makeConsoleViewRequest(args); 30 | // Call the CreateSenderView API 31 | // Exceptions will be caught by the calling function 32 | let results = await envelopesApi.createConsoleView(args.accountId, { 33 | consoleViewRequest: viewRequest, 34 | }); 35 | let url = results.url; 36 | //ds-snippet-end:eSign12Step2 37 | console.log(`NDSE view URL: ${url}`); 38 | return { redirectUrl: url }; 39 | }; 40 | 41 | function makeConsoleViewRequest(args) { 42 | // Data for this method 43 | // args.dsReturnUrl 44 | // args.startingView 45 | // args.envelopeId 46 | 47 | let viewRequest = new docusign.ConsoleViewRequest(); 48 | // Set the url where you want the recipient to go once they are done 49 | // with the NDSE. It is usually the case that the 50 | // user will never "finish" with the NDSE. 51 | // Assume that control will not be passed back to your app. 52 | viewRequest.returnUrl = args.dsReturnUrl; 53 | if (args.startingView === 'envelope' && args.envelopeId) { 54 | viewRequest.envelopeId = args.envelopeId; 55 | } 56 | return viewRequest; 57 | } 58 | 59 | module.exports = { createEmbeddedConsoleView }; 60 | -------------------------------------------------------------------------------- /views/pages/workspaces-examples/eg003SendEnvelopeWithRecipientInfo.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% if (!workspaceIdOk) { %> 6 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="work00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 7 |
8 | <%- include("../../partials/continueButton") %> 9 |
10 | <% } else if (!documentIdOk) { %> 11 | <%- formatString(example.RedirectsToOtherCodeExamples[1].RedirectText, formatString('href="work00{0}"', example.RedirectsToOtherCodeExamples[1].CodeExampleToRedirectTo)) %> 12 |
13 | <%- include("../../partials/continueButton") %> 14 |
15 | <% } else { %> 16 |
17 | <% if(example.Forms && example.Forms[0].FormName) { %> 18 | <%- example.Forms[0].FormName %> 19 | <% } %> 20 | 21 |
22 | 23 | 26 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 27 |
28 | 29 |
30 | 31 | 33 |
34 | 35 | 36 | <%- include("../../partials/submitButton") %> 37 |
38 | <% } %> 39 | 40 | <%- include("../../partials/examplesFoot") %> 41 | -------------------------------------------------------------------------------- /views/pages/examples/eg002SigningViaEmail.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 |
10 | 11 | 14 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 15 |
16 |
17 | 18 | 20 |
21 |
22 | 23 | <%= locals.manifest.SupportingTexts.HelpingTexts.CCEmailShouldDifferFromSigner %> 26 |
27 |
28 | 29 | 31 |
32 | 33 | 34 | <%- include("../../partials/submitButton") %> 35 |
36 | 37 | <%- include("../../partials/examplesFoot") %> 38 | -------------------------------------------------------------------------------- /views/pages/examples/eg010SendBinaryDocs.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | <%= locals.manifest.SupportingTexts.HelpingTexts.CCEmailShouldDifferFromSigner %> 27 |
28 |
29 | 30 | 32 |
33 | 34 | <%- include("../../partials/submitButton") %> 35 |
36 | 37 | <%- include("../../partials/examplesFoot") %> 38 | -------------------------------------------------------------------------------- /views/pages/examples/eg038ResponsiveSigning.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 26 | <%= locals.manifest.SupportingTexts.HelpingTexts.CCEmailShouldDifferFromSigner %> 27 |
28 |
29 | 30 | 32 |
33 | 34 | <%- include("../../partials/submitButton") %> 35 |
36 | 37 | <%- include("../../partials/examplesFoot") %> 38 | -------------------------------------------------------------------------------- /views/partials/sourceChooser.ejs: -------------------------------------------------------------------------------- 1 | 2 | <% if (locals.dsConfig.multiSourceChooser) { 3 | // Get list of potential languages 4 | let languages = locals.dsConfig.docOptions.map (item => item.langCode); 5 | // Filter out languages that don't have source for this example 6 | languages = languages.filter(langCode => 7 | locals.dsConfig.docNames[langCode][eg]); 8 | // Create sources object for client side: 9 | // [ {langCode, url} ] 10 | let sources = languages.map( langCode => { 11 | let info = locals.dsConfig.docOptions.find(item => item.langCode == langCode); 12 | let docName = locals.dsConfig.docNames[langCode][eg]; 13 | return {langCode: langCode, name: info.name, 14 | url: info.githubExampleUrl + docName, 15 | docName: docName}}); 16 | sourcesJson = JSON.stringify(sources, null, " "); 17 | %> 18 |
19 |

View the source

20 |
21 | <% sources.forEach(source => { 22 | let active = source.langCode == "node" ? "active" : ""; 23 | let checked = source.langCode == "node" ? "checked" : ""; 24 | %> 25 | > 32 | 33 | <% }) %> 34 |
35 |

Github: <%= sourceFile %>

36 |

Adjust the column width by dragging the column divider.

37 |
38 |
39 | <% } else { %> 40 |

41 | View source file <%= sourceFile %> on GitHub. 42 |

43 | <% } %> -------------------------------------------------------------------------------- /lib/admin/examples/cloneAccount.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | 3 | /** 4 | * This function clones an account 5 | * @param {object} args parameters for account cloning 6 | * @returns {docusignAdmin.AssetGroupAccountClone} Summary of cloning an account 7 | */ 8 | const cloneAccount = async (args) => { 9 | //ds-snippet-start:Admin12Step2 10 | const apiClient = new docusignAdmin.ApiClient(); 11 | apiClient.setBasePath(args.basePath); 12 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 13 | //ds-snippet-end:Admin12Step2 14 | 15 | //ds-snippet-start:Admin12Step4 16 | const accountData = docusignAdmin.AssetGroupAccountClone.constructFromObject({ 17 | sourceAccount: { 18 | id: args.sourceAccountId, 19 | }, 20 | targetAccount: { 21 | name: args.targetAccountName, 22 | admin: { 23 | firstName: args.targetAccountFirstName, 24 | lastName: args.targetAccountLastName, 25 | email: args.targetAccountEmail, 26 | }, 27 | countryCode: 'US', 28 | } 29 | }); 30 | //ds-snippet-end:Admin12Step4 31 | 32 | //ds-snippet-start:Admin12Step5 33 | const assetGroupApi = new docusignAdmin.ProvisionAssetGroupApi(apiClient); 34 | return assetGroupApi.cloneAssetGroupAccount(accountData, args.organizationId); 35 | //ds-snippet-end:Admin12Step5 36 | }; 37 | 38 | /** 39 | * Get list of asset group accounts for an organization 40 | * @param {object} args parameters for getting the accounts 41 | * @returns {docusignAdmin.AssetGroupAccountsResponse} Asset group accounts information 42 | */ 43 | const getAccounts = async (args) => { 44 | const apiClient = new docusignAdmin.ApiClient(); 45 | apiClient.setBasePath(args.basePath); 46 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 47 | 48 | //ds-snippet-start:Admin12Step3 49 | const assetGroupApi = new docusignAdmin.ProvisionAssetGroupApi(apiClient); 50 | const options = { 51 | compliant: true, 52 | }; 53 | const accounts = await assetGroupApi.getAssetGroupAccounts(args.organizationId, options); 54 | //ds-snippet-end:Admin12Step3 55 | 56 | return accounts; 57 | }; 58 | 59 | module.exports = { cloneAccount, getAccounts }; 60 | -------------------------------------------------------------------------------- /views/pages/examples/eg029ApplyBrandToEnvelope.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% include("../../partials/functions") %> 6 | 7 | <% if (brands.length == 0) { %> 8 | <%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="eg0{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %> 9 | 10 |
11 | <%- include("../../partials/continueButton") %> 12 |
13 | <% } else { %> 14 |
15 | <% if(example.Forms && example.Forms[0].FormName) { %> 16 | <%- example.Forms[0].FormName %> 17 | <% } %> 18 | 19 |
20 | 21 | 24 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 25 |
26 |
27 | 28 | 30 |
31 |
32 | 33 | 38 |
39 | 40 | 41 | <%- include("../../partials/submitButton") %> 42 |
43 | <% } %> 44 | 45 | <%- include("../../partials/examplesFoot") %> 46 | -------------------------------------------------------------------------------- /lib/eSignature/examples/deleteRestoreEnvelope.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 45: Delete and Restore an Envelope 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * Moves the envelope to a specified folder 11 | */ 12 | const deleteEnvelope = async (args) => { 13 | //ds-snippet-start:eSign45Step2 14 | const dsApiClient = new docusign.ApiClient(); 15 | dsApiClient.setBasePath(args.basePath); 16 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 17 | const foldersApi = new docusign.FoldersApi(dsApiClient); 18 | //ds-snippet-end:eSign45Step2 19 | 20 | //ds-snippet-start:eSign45Step3 21 | const foldersRequest = docusign.FoldersRequest.constructFromObject({ 22 | envelopeIds: [args.envelopeId], 23 | }); 24 | //ds-snippet-end:eSign45Step3 25 | 26 | //ds-snippet-start:eSign45Step4 27 | return await foldersApi.moveEnvelopes(args.accountId, args.deleteFolderId, { foldersRequest }); 28 | //ds-snippet-end:eSign45Step4 29 | }; 30 | 31 | const moveEnvelopeToFolder = async (args) => { 32 | const dsApiClient = new docusign.ApiClient(); 33 | dsApiClient.setBasePath(args.basePath); 34 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 35 | const foldersApi = new docusign.FoldersApi(dsApiClient); 36 | 37 | //ds-snippet-start:eSign45Step6 38 | const foldersRequest = docusign.FoldersRequest.constructFromObject({ 39 | envelopeIds: [args.envelopeId], 40 | fromFolderId: args.fromFolderId, 41 | }); 42 | 43 | return await foldersApi.moveEnvelopes(args.accountId, args.folderId, { foldersRequest }); 44 | //ds-snippet-end:eSign45Step6 45 | }; 46 | 47 | /** 48 | * Retrieves the list of folders 49 | */ 50 | const getFolders = async (args) => { 51 | const dsApiClient = new docusign.ApiClient(); 52 | dsApiClient.setBasePath(args.basePath); 53 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 54 | const foldersApi = new docusign.FoldersApi(dsApiClient); 55 | 56 | //ds-snippet-start:eSign45Step5 57 | return await foldersApi.list(args.accountId); 58 | //ds-snippet-end:eSign45Step5 59 | }; 60 | 61 | module.exports = { deleteEnvelope, moveEnvelopeToFolder, getFolders }; 62 | -------------------------------------------------------------------------------- /lib/rooms/examples/createExternalFormFillSession.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 006: Create External Form Fill Session 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignRooms = require('docusign-rooms'); 8 | 9 | /** 10 | * This function does the work of creating the form fill session 11 | */ 12 | const createExternalFormFillSession = async (args) => { 13 | //ds-snippet-start:Rooms6Step2 14 | let dsApiClient = new docusignRooms.ApiClient(); 15 | dsApiClient.setBasePath(args.basePath); 16 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 17 | //ds-snippet-end:Rooms6Step2 18 | 19 | if (args.docuSignFormId) { 20 | //ds-snippet-start:Rooms6Step4 21 | let externalFormFillSessionApi = 22 | new docusignRooms.ExternalFormFillSessionsApi(dsApiClient); 23 | let externalForm = null; 24 | //ds-snippet-end:Rooms6Step4 25 | 26 | //ds-snippet-start:Rooms6Step3 27 | let requestBody = { formId: args.docuSignFormId, roomId: args.roomId, xFrameAllowedUrl: 'http://localhost:3000' }; 28 | //ds-snippet-end:Rooms6Step3 29 | 30 | //ds-snippet-start:Rooms6Step4 31 | externalForm = 32 | await externalFormFillSessionApi.createExternalFormFillSession( 33 | args.accountId, 34 | { body: requestBody } 35 | ); 36 | 37 | return externalForm; 38 | //ds-snippet-end:Rooms6Step4 39 | } else { 40 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 41 | let roomDocuments = null; 42 | 43 | roomDocuments = await roomsApi.getDocuments( 44 | args.accountId, 45 | args.roomId 46 | ); 47 | return roomDocuments; 48 | } 49 | }; 50 | 51 | /** 52 | * Form page for this application 53 | */ 54 | const getRooms = async (args) => { 55 | let dsApiClient = new docusignRooms.ApiClient(); 56 | dsApiClient.setBasePath(args.basePath); 57 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 58 | 59 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 60 | let userRooms = null; 61 | 62 | userRooms = await roomsApi.getRooms( 63 | args.accountId, 64 | { count: 5 } /* optional*/ 65 | ); 66 | 67 | return userRooms; 68 | }; 69 | 70 | module.exports = { createExternalFormFillSession, getRooms }; 71 | -------------------------------------------------------------------------------- /views/pages/examples/eg036DelayedRouting.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 15 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 26 |
27 |
28 | 29 | 31 |
32 |
33 | 34 | 36 |
37 | 38 | <%- include("../../partials/submitButton") %> 39 |
-------------------------------------------------------------------------------- /lib/click/examples/activateClickwrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 2: Activating a clickwrap 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignClick = require('docusign-click'); 8 | 9 | /** 10 | * Work with activating the clickwrap 11 | * @param {Object} args Arguments for creating a clickwrap 12 | * @return {Object} The object with value of clickwrapId or error 13 | */ 14 | const activateClickwrap = async (args) => { 15 | // Step 2. Construct the request body 16 | // Create clickwrapRequest model 17 | //ds-snippet-start:Click2Step3 18 | const clickwrapRequest = docusignClick.ClickwrapRequest.constructFromObject({ 19 | status: 'active', 20 | }); 21 | //ds-snippet-end:Click2Step3 22 | 23 | // Step 4. Call the Click API 24 | // Create Click API client 25 | //ds-snippet-start:Click2Step2 26 | const dsApiClient = new docusignClick.ApiClient(); 27 | dsApiClient.setBasePath(args.basePath); 28 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 29 | //ds-snippet-end:Click1Step2 30 | const accountApi = new docusignClick.AccountsApi(dsApiClient); 31 | 32 | // Update and activate a clickwrap 33 | //ds-snippet-start:Click2Step4 34 | const result = await accountApi.updateClickwrapVersion( 35 | args.accountId, 36 | args.clickwrapId, 37 | args.clickwrapVersionNumber, 38 | { clickwrapRequest } 39 | ); 40 | //ds-snippet-end:Click2Step4 41 | console.log(`Clickwrap was updated. ClickwrapId ${result.clickwrapId}`); 42 | return result; 43 | }; 44 | 45 | // get inactive clickwraps 46 | const getInactiveClickwraps = async (args) => { 47 | // Call the Click API 48 | // Create Click API client 49 | const dsApiClient = new docusignClick.ApiClient(); 50 | dsApiClient.setBasePath(args.basePath); 51 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 52 | const accountApi = new docusignClick.AccountsApi(dsApiClient); 53 | 54 | // Get a list of inactive clickwraps 55 | let clickwraps = []; 56 | for (const status of args.statuses) { 57 | const response = await accountApi.getClickwraps(args.accountId, { status }); 58 | clickwraps = clickwraps.concat(response.clickwraps); 59 | } 60 | 61 | return { clickwraps }; 62 | }; 63 | 64 | module.exports = { activateClickwrap, getInactiveClickwraps }; 65 | -------------------------------------------------------------------------------- /lib/admin/examples/createUser.js: -------------------------------------------------------------------------------- 1 | const docusignAdmin = require('docusign-admin'); 2 | const docusignESign = require('docusign-esign'); 3 | 4 | /** 5 | * This function creates a new user with active status 6 | */ 7 | const createUser = async (args) => { 8 | // Data for this method 9 | // args.requestUrl 10 | // args.accessToken 11 | // args.email 12 | // args.user_name 13 | // args.first_name 14 | // args.last_name 15 | // args.permission_profile_id 16 | // args.group_id 17 | 18 | //ds-snippet-start:Admin1Step2 19 | const apiClient = new docusignAdmin.ApiClient(); 20 | apiClient.setBasePath(args.basePath); 21 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 22 | //ds-snippet-end:Admin1Step2 23 | 24 | //ds-snippet-start:Admin1Step5 25 | const userData = { 26 | user_name: args.user_name, 27 | first_name: args.first_name, 28 | last_name: args.last_name, 29 | email: args.email, 30 | auto_activate_memberships: true, 31 | accounts: [ 32 | { 33 | id: args.accountId, 34 | permission_profile: { 35 | id: args.permission_profile_id 36 | }, 37 | groups: [ 38 | { 39 | id: args.group_id 40 | } 41 | ] 42 | } 43 | ] 44 | }; 45 | //ds-snippet-end:Admin1Step5 46 | 47 | //ds-snippet-start:Admin1Step6 48 | const usersApi = new docusignAdmin.UsersApi(apiClient); 49 | return usersApi.createUser(userData, args.organizationId); 50 | //ds-snippet-end:Admin1Step6 51 | }; 52 | 53 | const getPermissionProfilesAndGroups = async (args) => { 54 | const apiClient = new docusignESign.ApiClient(); 55 | apiClient.setBasePath(args.basePath); 56 | apiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 57 | 58 | //ds-snippet-start:Admin1Step3 59 | const accountsApi = new docusignESign.AccountsApi(apiClient); 60 | const profiles = await accountsApi.listPermissions(args.accountId); 61 | //ds-snippet-end:Admin1Step3 62 | 63 | //ds-snippet-start:Admin1Step4 64 | const groupsApi = new docusignESign.GroupsApi(apiClient); 65 | const groups = await groupsApi.listGroups(args.accountId); 66 | //ds-snippet-end:Admin1Step4 67 | 68 | return { profiles, groups }; 69 | }; 70 | 71 | module.exports = { createUser, getPermissionProfilesAndGroups }; 72 | -------------------------------------------------------------------------------- /views/pages/admin-examples/eg012CloneAccount.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 |
6 | <% if(example.Forms && example.Forms[0].FormName) { %> 7 | <%- example.Forms[0].FormName %> 8 | <% } %> 9 | 10 |
11 | 12 | 17 |
18 |
19 | 20 | 22 |
23 |
24 | 25 | 27 |
28 |
29 | 30 | 32 |
33 |
34 | 35 | 37 |
38 | 39 | <%- include("../../partials/submitButton") %> 40 |
41 | 42 | <%- include("../../partials/examplesFoot") %> 43 | -------------------------------------------------------------------------------- /views/pages/examples/eg014CollectPayment.ejs: -------------------------------------------------------------------------------- 1 | <%- include("../../partials/examplesHead") %> 2 | 3 | <%- include("../../partials/exampleInfo") %> 4 | 5 | <% if (gatewayOk) { %> 6 |
7 | <% if(example.Forms && example.Forms[0].FormName) { %> 8 | <%- example.Forms[0].FormName %> 9 | <% } %> 10 | 11 |
12 | 13 | 16 | <%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %> 17 |
18 |
19 | 20 | 22 |
23 |
24 | 25 | <%= locals.manifest.SupportingTexts.HelpingTexts.CCEmailShouldDifferFromSigner %> 28 |
29 |
30 | 31 | 33 |
34 | 35 | <%- include("../../partials/submitButton") %> 36 |
37 | <% } else { %> 38 | <%- example.RedirectsToOtherCodeExamples[0].RedirectText %> 39 | <% } %> 40 | 41 | <%- include("../../partials/examplesFoot") %> 42 | 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docusign-code-examples", 3 | "version": "1.0.0", 4 | "description": "DocuSign eSignature Code examples using either Authorization Code Grant and JWT OAuth", 5 | "main": "index.js", 6 | "scripts": { 7 | "debug": "node --inspect-brk index.js", 8 | "start": "node index.js", 9 | "test": "mocha", 10 | "update-sources": "node lib/utilities/updateSources.js", 11 | "update-sources-debug": "node --inspect-brk lib/utilities/updateSources.js", 12 | "lint": "eslint .", 13 | "lint-fix": "eslint --fix --debug ." 14 | }, 15 | "directories": { 16 | "test": "test" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/docusign/code-examples-nodejs" 21 | }, 22 | "author": "DocuSign, Inc", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/docusign/code-examples-nodejs/issues" 26 | }, 27 | "homepage": "https://github.com/docusign/code-examples-nodejs#readme", 28 | "engines": { 29 | "node": ">=8.10" 30 | }, 31 | "dependencies": { 32 | "@docusign/iam-sdk": "^1.0.0-beta.5", 33 | "axios": "^1.7.7", 34 | "body-parser": "^1.20.3", 35 | "cookie-parser": "^1.4.7", 36 | "csurf": "^1.11.0", 37 | "docusign-admin": "^3.0.0", 38 | "docusign-click": "^2.2.0", 39 | "docusign-esign": "^8.4.0", 40 | "docusign-monitor": "^2.1.0", 41 | "docusign-rooms": "^2.0.0", 42 | "docusign-webforms": "^2.1.0", 43 | "ejs": "^3.1.10", 44 | "express": "^4.21.1", 45 | "express-flash": "0.0.2", 46 | "express-session": "^1.18.1", 47 | "fs": "0.0.1-security", 48 | "fs-extra": "^11.2.0", 49 | "helmet": "^3.23.3", 50 | "jsonwebtoken": "^9.0.2", 51 | "memorystore": "^1.6.7", 52 | "moment": "^2.30.1", 53 | "node-fetch": "2.7.0", 54 | "passport": "^0.7.0", 55 | "passport-docusign": "^1.3.0", 56 | "path": "^0.12.7", 57 | "store2": "^2.14.3", 58 | "stream": "0.0.2", 59 | "uuid": "^11.0.2", 60 | "validator": "^13.12.0" 61 | }, 62 | "devDependencies": { 63 | "chai": "^4.5.0", 64 | "chai-exclude": "^2.1.1", 65 | "eslint": "^8.57.0", 66 | "eslint-config-standard": "^17.1.0", 67 | "mocha": "^10.7.3" 68 | }, 69 | "overrides": { 70 | "braces": "^3.0.3", 71 | "degenerator": "^5.0.1", 72 | "pac-resolver": "^7.0.1", 73 | "formidable": "^3.5.1", 74 | "socks": "^2.8.3" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/rooms/examples/addingFormToRoom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 004: Adding Form To Room 4 | * @author DocuSign 5 | */ 6 | 7 | const docusignRooms = require('docusign-rooms'); 8 | 9 | /** 10 | * This function does creation of the room with data 11 | * @param {object} args 12 | */ 13 | const addFormToRoom = async (args) => { 14 | //ds-snippet-start:Rooms4Step2 15 | let dsApiClient = new docusignRooms.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 18 | //ds-snippet-end:Rooms4Step2 19 | 20 | //ds-snippet-start:Rooms4Step4 21 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 22 | let results = null; 23 | 24 | results = roomsApi.addFormToRoom( 25 | args.accountId, 26 | args.roomsArgs.roomId, 27 | { body: { formId: args.roomsArgs.libraryFormId } }, 28 | null 29 | ); 30 | //ds-snippet-end:Rooms4Step4 31 | 32 | console.log(`Room with data was created. RoomId ${results.roomId}`); 33 | return results; 34 | }; 35 | 36 | /** 37 | * Form page for this application 38 | */ 39 | const getFormsAndRooms = async (args) => { 40 | let dsApiClient = new docusignRooms.ApiClient(); 41 | dsApiClient.setBasePath(args.basePath); 42 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 43 | 44 | //ds-snippet-start:Rooms4Step3 45 | let formLibrariesApi = new docusignRooms.FormLibrariesApi(dsApiClient); 46 | let formLibrariesResults = null; 47 | 48 | formLibrariesResults = await formLibrariesApi.getFormLibraries( 49 | args.accountId 50 | ); 51 | 52 | if (formLibrariesResults.formsLibrarySummaries.length === 0) { 53 | return; 54 | } 55 | 56 | const firstFormLibraryId = formLibrariesResults.formsLibrarySummaries.find( 57 | (lib) => lib.formCount > 0 58 | ).formsLibraryId; 59 | const formsResults = await formLibrariesApi.getFormLibraryForms( 60 | args.accountId, 61 | firstFormLibraryId 62 | ); 63 | //ds-snippet-end:Rooms4Step3 64 | 65 | let roomsApi = new docusignRooms.RoomsApi(dsApiClient); 66 | let userRooms = null; 67 | 68 | userRooms = await roomsApi.getRooms( 69 | args.accountId, 70 | { count: 5 } /* optional*/, 71 | null 72 | ); 73 | 74 | return { formsResults, userRooms }; 75 | }; 76 | 77 | module.exports = { addFormToRoom, getFormsAndRooms }; 78 | -------------------------------------------------------------------------------- /lib/eSignature/examples/createPermission.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Example 024: Creating a permission profile 4 | * @author DocuSign 5 | */ 6 | 7 | const docusign = require('docusign-esign'); 8 | 9 | /** 10 | * This function does the work of creating the permission profile 11 | */ 12 | const createPermission = async (args) => { 13 | // Step 1. Construct your API headers 14 | //ds-snippet-start:eSign24Step2 15 | let dsApiClient = new docusign.ApiClient(); 16 | dsApiClient.setBasePath(args.basePath); 17 | 18 | dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); 19 | let accountsApi = new docusign.AccountsApi(dsApiClient); 20 | //ds-snippet-end:eSign24Step2 21 | 22 | // Step 2: Construct the request body 23 | //ds-snippet-start:eSign24Step3 24 | const requestBody = { 25 | permissionProfile: { 26 | permissionProfileName: args.profileName, 27 | settings: { 28 | useNewDocuSignExperienceInterface: 0, 29 | allowBulkSending: 'true', 30 | allowEnvelopeSending: 'true', 31 | allowSignerAttachments: 'true', 32 | allowTaggingInSendAndCorrect: 'true', 33 | allowWetSigningOverride: 'true', 34 | allowedAddressBookAccess: 'personalAndShared', 35 | allowedTemplateAccess: 'share', 36 | enableRecipientViewingNotifications: 'true', 37 | enableSequentialSigningInterface: 'true', 38 | receiveCompletedSelfSignedDocumentsAsEmailLinks: 'false', 39 | signingUiVersion: 'v2', 40 | useNewSendingInterface: 'true', 41 | allowApiAccess: 'true', 42 | allowApiAccessToAccount: 'true', 43 | allowApiSendingOnBehalfOfOthers: 'true', 44 | allowApiSequentialSigning: 'true', 45 | enableApiRequestLogging: 'true', 46 | allowDocuSignDesktopClient: 'false', 47 | allowSendersToSetRecipientEmailLanguage: 'true', 48 | allowVaulting: 'false', 49 | allowedToBeEnvelopeTransferRecipient: 'true', 50 | enableTransactionPointIntegration: 'false', 51 | powerFormRole: 'admin', 52 | vaultingMode: 'none', 53 | }, 54 | }, 55 | }; 56 | //ds-snippet-end:eSign24Step3 57 | 58 | //ds-snippet-start:eSign24Step4 59 | let results = await accountsApi.createPermissionProfile( 60 | args.accountId, 61 | requestBody 62 | ); 63 | //ds-snippet-end:eSign24Step4 64 | 65 | return results; 66 | }; 67 | 68 | module.exports = { createPermission }; 69 | --------------------------------------------------------------------------------