cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating Microsoft flow with DocuSign Rest API

Integrating Microsoft flow with DocuSign Rest API

Creating a DocuSign Envelope with document uploaded to document library is not straight process, we need to under go many steps. DocuSign connectors has lot of limitations. In this article I will show you how to create and send DocuSign Envelope with Document uploaded to Document Library &  dynamic content in Microsoft Flow.

1.png

Step 1:

Here I am using Item Created or Modified trigger on Document Library, Yes List trigger on Document library. (If You don’t find the document library just paste the document library name in the list name field)

 2.png

Step 2:

Now add “Get file content” SharePoint Action

  3.png

Dynamic content: File name with extension from when item created

Step 3:

Create a file in One drive in root folder with the file content from above step 2

 4.png

 

Dynamic content:

  1. File name with extension from when item created.
  2. File content from Get file Action.

 

Step 4:

5.png

Dynamic content:

  1. ID from create file one drive
  2. Target type: “PDF”

You can skip step 3 & 4 if you have PDF conversion connector license. But in our case word document is uploaded in to document library and in some cases, they are using content types to create word documents in the document library.

 

Step 5:

Now PDF document is created at OneDrive in previous step, copy that file back to temp Folder in the same document library or different one.

6.png

Dynamic content:

  1. Name (When item is created or modified)
  2. File content (convert file)

 

Step 6:

Now PDF file is copied to Temp Location in SharePoint. Get that file content using get file content using path action

7.png

Dynamic content:

  1. Name (When item is created or modified) (.pdf is added manually)

Step 7:

Most Important step in this entire process, add compose action to convert File content Binary into Base64

8A.png

8B.png

Dynamic content:

  1. File content from Get file content using path in step 6

Step 8:

Now its time to push this document in to DocuSign using Rest API, Add Http action like this

Note: Here I am Using Dev Environment.

9A.png9B.png

  1. Name (When item is created or modified)
  2. Output (Compose Action Output) Bytes in Base64
  3. Email & Name (I am using Item created by Name & Email)

Body

 

Here i am mapping all the dynamic content from Flow and Sharepoint into JSON Body, This will directly send the email to the recipients. if you want to change it like save it in drafts just change the status to "Created" instead of Sent

Tabs:

Here i am Placing Signature & Date Tabs in Page 2 Right corner mage changes acording to that 

Please refer 

Adding Tabs to Envelopes

 

{
  "emailSubject": "Docusign REST API Integration with Flow",
  "emailBlurb": "Docusign REST API Integration with Flow",
  "status": "sent",
  "documents": [
    {
      "documentId": "1",
      "name": "yourfilename.pdf",
      "documentBase64": "Replace_compose_output_here"
    }
  ],
  "recipients": {
    "signers": [
      {
        "email": "Replace_dynamic_email",
        "name": "Replace_Dynamic_Name",
        "recipientId": "1",
        "tabs": {
          "signHereTabs": [
            {
              "xPosition": "490",
              "yPosition": "706",
              "documentId": "1",
              "required": "true",
              "pageNumber": "2"
            }
          ],
          "dateSignedTabs": [
            {
              "tabLabel": "todaysDate",
              "xPosition": "483",
              "yPosition": "765",
              "documentId": "1",
              "pageNumber": "2"
            }
          ]
        }
      }
    ]
  }
}

Some Ideas !!

 

  • You can Make use of content type based Documents and Populate Tabs on the doucment when it is saved 
  • Use AutoPlace Feature to replace your text fields with Docusign Tabs.
  • Using the auto-place feature (also called anchor-tagging) you can specify the location of your tabs based on content or "markers" contained within your documents.
  • "tabs": {
        "signHereTabs": [{
            "anchorString": "Please Sign Here:",
            "anchorXOffset": "1",
            "anchorYOffset": "0",
            "anchorIgnoreIfNotPresent": "false",
            "anchorUnits": "inches"
        }]
    }
  • After Creating Envelope in Drafts, we can parse response and get the Envelope ID and based on our custom logic we can add recipients dynamically from REST API.

 

Status: New
Comments
Level: Powered On

Thank You, Sarat! I'm looking for a very same scenario to implement. 

Level: Power Up

Can you please elaborate what should be placed in REST API request before /envelopes and what is Integrator Key?

Level: Powered On

To generate an Integration key:

  1. Log in to your DocuSign admin account
  2. Under Integrations, select API and Keys
  3. Under My Apps / Integration Keys, select Add App / Integration Key, then give it a name

https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant

Level: Power Up

Hi,

Upon using URI "https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes", I am getting error:

The request contained at least one invalid parameter. Query parameter 'from_date' must be set to a valid DateTime, or 'envelope_ids' or 'transaction_ids' must be specified.

 

I added parameter "from_date" and changed URI to "https://demo.docusign.net/restapi/v2/accounts/AC_ID/envelopes/status?from_date=dd/mm/yyyy

" and flow is running successfully. But, no envelope is generating neither email is sent. Any workaround for this?

 

Also, I wanted to know what should I place in documentId and recepientId?

Level: Powered On

Dont change URI, please check Docusign API reference,

 

https://developers.docusign.com/esign-rest-api/reference

 

in Our case we are using pre defined envelope, i.e we already have an envelope that is created in Docusign we are triggering that using rest API. 

you can find Enevelope ID in URL when you open the envelope in Docusign.