DocuSign

Overview

The DocuSign connector enables your Leena AI Agents to integrate with your organization's DocuSign platform, facilitating automated electronic signature workflows, envelope management, and document signing processes.

DocuSign is the leading electronic signature and agreement cloud platform that enables organizations to automate the agreement process by preparing, signing, acting on, and managing documents digitally. The DocuSign connector allows Leena AI to automate signature workflows, send documents for signing, track envelope status, and manage digital signing processes seamlessly.

API Details

Leena AI integrates with DocuSign via the eSignature REST API v2.1.

Documentation link: https://developers.docusign.com/docs/esign-rest-api/

Setup

The DocuSign connector supports two OAuth 2.0 authentication methods:

  • OAuth 2.0 Authorization Code Grant: Recommended when a user is present and able to authenticate interactively
  • OAuth 2.0 JWT Bearer: Recommended for server-to-server integrations without user interaction

Prerequisites

Before setting up the DocuSign connector, ensure you have:

  • Administrator access to your DocuSign account
  • A DocuSign Developer account (for testing) or Production account
  • Access to DocuSign Admin Settings > Apps and Keys
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to create an Integration Key (App) in DocuSign:

  1. Log in to your DocuSign account as an Administrator
    1. For Demo/Sandbox: https://account-d.docusign.com
    2. For Production: https://account.docusign.com
  2. Navigate to Apps and Keys:
    1. Click on Settings in the top menu bar
    2. Under Integrations, click Apps and Keys
  3. Create a New App:
    1. Click Add App and Integration Key
    2. Enter a descriptive name for your application (e.g., "Leena AI Integration")
    3. Click Create App
  4. Note the Integration Key:
    1. Copy the Integration Key (this is your Client ID)
    2. This is a GUID (32-digit hexadecimal number)
  5. Configure Authentication Settings based on your chosen method:

For OAuth 2.0 Authorization Code Grant:

  1. Under Authentication, ensure Authorization Code Grant is selected
  2. Click Add Secret Key to generate a Client Secret
  3. Copy and securely store the Secret Key (displayed only once)
  4. Under Redirect URIs, click Add URI
  5. Add the Callback URL from Leena AI (obtained after initial connector setup)

For OAuth 2.0 JWT Bearer:

  1. Under Service Integration, click Generate RSA
  2. Copy and securely store the RSA Private Key (displayed only once)
  3. Note your User ID (API Username):
    1. Go to Settings > Users and Groups > Users
    2. Select your user and copy the API Username (User ID)
  4. Grant consent for your application:
    1. Navigate to the consent URL provided during connector setup
    2. Sign in and grant permission to the application

Note Your Account ID:

  1. On the Apps and Keys page, find My Account Information
  2. Copy the API Account ID

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "DocuSign" and select it from the list to add its new connector
  4. Select Environment:
    1. Environment: Choose Demo/Sandbox for testing or Production for live use
  5. Select Authentication Type:
    1. Auth Type: Choose between "OAuth 2.0 Authorization Code Grant" or "OAuth 2.0 JWT Bearer"

For OAuth 2.0 Authorization Code Grant:

  1. Configure the connector:
    1. Integration Key (Client ID): Your DocuSign Integration Key
    2. Client Secret: The Secret Key generated in DocuSign
    3. Account ID: Your DocuSign API Account ID
  2. Save the connector configuration
  3. Complete OAuth Flow:
    1. Click Connect or Authorize in Leena AI
    2. You'll be redirected to DocuSign authorization page
    3. Sign in to your DocuSign account if prompted
    4. Click Allow to grant permissions
    5. You'll be redirected back to Leena AI with a successful connection
  4. Copy the Callback URL from Leena AI and add it to your DocuSign App's Redirect URIs

For OAuth 2.0 JWT Bearer:

  1. Configure the connector:
    1. Integration Key (Client ID): Your DocuSign Integration Key
    2. User ID (API Username): The User ID for impersonation
    3. Account ID: Your DocuSign API Account ID
    4. RSA Private Key: The complete RSA Private Key including headers
  2. Grant Consent (required one-time):
    1. Click the authorization link provided
    2. Sign in and grant consent to the application
  3. Save the connector configuration

Actions

The following actions are supported for the DocuSign connector:

Send Envelope for Signature

Sends an envelope containing documents for electronic signature. The Agent can leverage the skill (workflow), which has been designed to send documents for signature through DocuSign, once the user provides the document details and recipient information.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Email SubjectThe subject line of the email sent to recipients
Documents (JSON Array)Array of documents to be signed, including base64-encoded content
Recipients (JSON Object)Object containing recipient information including signers and carbon copies
Envelope StatusThe status of the envelope: "sent" (send immediately) or "created" (save as draft)

Optional

NameDescription
Email MessageOptional message body included in the email to recipients
Brand IDBrand identifier for customizing the envelope appearance

Here is a sample JSON input:

{
  "emailSubject": "Please sign this agreement",
  "emailBlurb": "Please review and sign the attached document at your earliest convenience.",
  "documents": [
    {
      "documentBase64": "JVBERi0xLjQKJeLjz9M...",
      "name": "Employment_Agreement.pdf",
      "fileExtension": "pdf",
      "documentId": "1"
    }
  ],
  "recipients": {
    "signers": [
      {
        "email": "[email protected]",
        "name": "John Doe",
        "recipientId": "1",
        "routingOrder": "1",
        "tabs": {
          "signHereTabs": [
            {
              "documentId": "1",
              "pageNumber": "1",
              "xPosition": "200",
              "yPosition": "400"
            }
          ],
          "dateSignedTabs": [
            {
              "documentId": "1",
              "pageNumber": "1",
              "xPosition": "200",
              "yPosition": "450"
            }
          ]
        }
      }
    ],
    "carbonCopies": [
      {
        "email": "[email protected]",
        "name": "HR Department",
        "recipientId": "2",
        "routingOrder": "2"
      }
    ]
  },
  "status": "sent"
}

Response

Upon successful creation, the action returns the envelope details including:

  • Envelope ID
  • Envelope URI
  • Status (sent, created)
  • Status date/time

Get Envelope Status

Retrieves the current status and details of a specific envelope. The Agent can leverage this skill to check the signing progress, view recipient status, and track document completion. Here are some common use cases:

  • Track Signing Progress: Check if recipients have signed
  • Monitor Completion: Verify when all signatures are collected
  • Audit Trail: Review envelope history and status changes
  • Reminder Triggers: Identify envelopes pending action

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Envelope IDThe unique identifier of the envelope to retrieve status for

Here is a sample JSON input:

{
  "envelopeId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Response

The action returns detailed envelope information including:

  • Envelope ID
  • Status (sent, delivered, completed, declined, voided)
  • Status changed date/time
  • Sender information
  • Recipients and their status
  • Documents included
  • Created and sent timestamps
  • Expiration date (if applicable)

List Envelopes

Retrieves a list of envelopes from your DocuSign account based on specified criteria. This action can be leveraged by Leena AI Orchestrator/Agent to list envelopes within a date range, filter by status, or paginate through results. Here are some common use cases:

  • Daily Reports: Get all envelopes sent today
  • Status Monitoring: Find all pending or completed envelopes
  • Compliance Audits: Retrieve envelopes within a specific period
  • Dashboard Data: Populate envelope statistics and metrics

Input Parameters

Here are the input parameters required to set up this action:

Optional

NameDescription
From DateStart date for filtering envelopes (Format: YYYY-MM-DD)
To DateEnd date for filtering envelopes (Format: YYYY-MM-DD)
Status FilterFilter by envelope status: sent, delivered, completed, declined, voided, created
CountNumber of records to return (default: 100)
Start PositionStarting position for pagination (default: 0)

Here is a sample JSON input:

{
  "fromDate": "2025-01-01",
  "toDate": "2025-01-31",
  "status": "completed",
  "count": "50",
  "startPosition": "0"
}

Response

The action returns a list of envelopes, each containing:

  • Envelope ID
  • Status
  • Email subject
  • Sender information
  • Sent date/time
  • Completed date/time (if applicable)
  • Recipient information summary
  • Total result set size
  • Next page URI (for pagination)