Skip to content

docusign/docusign-discover-workshop-2

Repository files navigation

docusign-discover-workshop-2

By the end of this lab you will have:

Run the project with mock data

  1. Clone the project repo into VS Code.
git clone https://github.com/docusign/docusign-discover-workshop-2.git
  1. Install dependencies:
npm install
  1. Copy the example.env file to a new file named .env.

  2. Start the server in development mode:

npm run dev
  1. Open http://localhost:3000 in your browser.
  • You should see a list of agreements.
  • These are coming from a Postman mock server, not your real Docusign account.

Create an integration key and obtain an access token using the VSCode Docusign AI Assistant

Follow instructions here

Bulk upload agreements using the Navigator API

Endpoints detailed in bulkUploadWithAPI.md.

Create bulk upload job

  1. The try statement includes an empty body constant. Add the following as the value of body:
{
  "job_name": "test_name",
  "expected_number_of_docs": 2,
  "language": "en_us"
}
  1. The res constant uses a fetch statement. Add the URL for the create job endpoint as the first argument.

  2. The completeRes constant uses a fetch statement. Add the URL for the complete job endpoint as the first argument.

  3. The bulkUploadStatus function makes a request to check the status of jobId. Complete the statusCheck constant with a fetch statement to the check status endpoint that includes Authorization, Accept, and Content-Type headers.

  4. Click the Bulk Upload button. You should see a modal confirming successful upload of 2 agreements.

  5. Click the Check Status button. You should see a modal providing the status of the agreement upload and processing. Status should report complete after about 60 seconds.

Get agreements using the Navigator SDK

The code currently fetches agreements using a REST API call. getAgreements.js

Replace this with the equivalent SDK call to Navigator:

client.navigator.agreements.getAgreementsList({ accountId });

API reference

SDK Documentation

TIP it is expected to get a response validation error from the SDK. Use the following workaround:

} catch (err) {
    if (err?.message?.includes('Response validation failed') && err?.rawValue) {
      console.warn('getAgreements: response validation failed — using rawValue fallback');
      data = err.rawValue;
    } else {
    ...

Restart your server and refresh the browser — you should now see real agreements from your Docusign account.

Implement agreement filtering (optional/advanced)

You can filter agreements by properties such as status, expiration date, party name, etc. The full list of available query parameters is documented on the API reference page.

Try extending your SDK method calls with additional query parameters. Experiment with different combinations to see how you can sort and filter agreements in ways that match the requirements of various use cases.

let options = {
  accountId: accountId,
  limit: 10,
  "effective_date[gte]": "2015-01-01",
  sort: "effective_date",
  direction: "asc"
};

client.navigator.agreements.getAgreementsList( options );

Implement “Delete Agreement” (your task)

  • In the project there’s a stubbed-out function for Delete Agreement using the SDK. deleteAgreement.js

Your job is to complete that function:

client.navigator.agreements.deleteAgreement({ accountId, agreementId });

API reference

  • Test it by deleting one of your agreements.

Add OAuth (Optional, advanced)

Auth examples

  • Right now you pasted in an access token manually.

  • For a production app, you should implement an OAuth flow to fetch/refresh tokens automatically.

  • Choose either:

    • Authorization Code Grant (browser + server flow)

    • JWT Grant (server-to-server)

  • The project has an auth.js file stubbed out for you to implement.

Create and Test Connect Webhooks

Events detailed in createWebhooks.md.

  1. Visit https://apps-d.docusign.com/admin/connect/.

  2. Click Add Configuration > Custom.

  3. In the Name box, type Navigator API test or another configuration name of your choosing.

  4. In a new tab, open https://webhook.site, then click the generated URL to copy it.

  5. Return to your Custom Connect configuration, then in the URL to Publish box paste the URL you copied.

  6. In the Trigger Events section, open the Navigator list and check all 5 events.

  7. Click Add Configuration.

  8. In a new tab, open https://apps-d.docusign.com/send/documents, then in the sidebar, click Completed.

  9. Click an agreement with the icon for AI suggestions (purple star), click Review All, approve one of the AI-suggested values, then click Save.

  10. On the webhook.site tab, review the agreement-extractions-reviewed message.

  11. In your open agreement, click Review All, approve all remaining AI-suggested values, then click Save.

  12. On the webhook.site tab, review the agreement-reviews-complete message.

  13. In your open agreement, click the edit icon (pencil), change a data value, then click Save.

  14. On the webhook.site tab, review the agreement-updated message.

  15. Return to your open agreement close it, in the agreements list click the vertical ellipsis () for the agreement, click Remove, then click Remove Agreement.

  16. On the webhook.site tab, review the agreement-deleted message.

Connect to the Docusign MCP server

Check out the discover-mcp-workshop branch of this repo. You'll need to work in this branch to ensure clean context for the agent you're building.

git checkout discover-mcp-workshop

See Docusign MCP Workshop: AI-Powered Agreement Analysis for your instructions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •