Get into the flow of sending DocuSign Envelopes with Microsoft Power Automate

If you’re a power user of Microsoft tools, then you’ll want to know about DocuSign’s integration with Microsoft Power Automate. As we explore below, it’s easy for you to use DocuSign’s core eSignature capabilities within Microsoft, saving you time and hassle when getting those important business contracts signed.

Already, fans of Microsoft Power Automate (previously called Flow) will know that it’s a great tool for streamlining repetitive tasks and making processes paperless. It’s why the tool is such a great fit with DocuSign – we’re all about going paperless and automating key tasks, too. 

Let’s take a look at how it works. 

Our example: Creating a workflow when a new file is created in SharePoint

The example we’re using in this article is triggered when a new file is created in a specific folder in SharePoint. Note that the same workflow can be easily configured for a different trigger to meet your specific business needs, for example:

  • In procurement, a trigger could occur when a tender/project status is changed in a SharePoint list to automatically send an approved contract for execution 
  • In HR onboarding, when a new employee is added, the onboarding pack (personal profile, payroll data collection, NDA, etc) is automatically sent through an approval and signature workflow 

This is an example of a custom Flow built using Docusign API. Note that you can also access a great range of DocuSign pre-built connectors within Power Automate that require zero code. They do, however, require a Power Automate premium subscription. This example doesn’t need a premium subscription. You’d also find this useful in more advanced scenarios where access to the full API provides more options than the pre-built connectors.

As you’ll see below, the whole process is completed in three steps – first, you need to set up DocuSign, then make some quick changes to the actual document for signing, and then set up Microsoft Power Automate. Since it uses the DocuSign API, the process follows the standard ‘Go-Live’ process, which means you need to use your DocuSign developer account (which you can create here). Once complete, you can promote to production using that same Go-Live link.

Step 1: DocuSign Setup

  1. Login to DocuSign Admin and make a note of your Account ID (see top left)
  2. Create a new “integration user” (if you haven’t already set one up) to use for authenticating the integration: 

-   Go to Users > Add User

- Follow the steps to create the new user (add email, name, etc)

-   Click on the activation email to activate the profile and set up a password

- Note the Username (email) & Password

  1. Create an Integration Key, a special key that enables the API-level authentication:

- Go to Integrations > API and Keys, then “Add App / Integration Key” - Note down the Integration Key

  1. Create Custom Fields

- Go to Signing and Sending > Document Custom Fields, click “Add Field”

- Choose which fields you’d like to add (e.g. signature, name, signing date) and follow the prompts. For example, if you want to add a Signature field, the recommended values are:

a.  Name: Signature

b.  Type: Sign Here

c.  Shared: Tick (yes)

d.  AutoPlace Text: \s{r}\

Step 2: Signing Document Setup

You only need to make minor changes to the document you want signed – to flag where the DocuSign tags/fields should appear (see “Custom Fields” above). Simply enter the special “AutoPlace text” you created when setting up Custom Fields anywhere in the document that you want those fields to appear. 

For example, the image below shows a Word document that needed two signers: “\s1\” for the first signer, “\n1\” for the full name of the signer, and “\d1\” for the date of signing. And “\x2\” for all the details of the second signer. 

Signer

Just remember, in your final version, make the AutoPlace text white in colour (so it’s hidden from view)!

Step 3: Microsoft Power Automate Setup

The final Microsoft Power Automate configuration should look like the following:

MS integration 2

 

  1. When a file is created in a folder
MS integration 3

This is a basic ‘trigger’ step. In this example, it’s the “/DS Folder/FlowTest” folder. Once a new file is created, it kicks off the workflow. Inputs:

-   Site Address: SharePoint site

-   Folder id: Folder path

  1. Get file content
MS integration 4

This step captures the file content based on the ‘trigger’. In this example, it’s the content of the new file that was created in that folder. Inputs:

-   Site Address: SharePoint site

-   File identifier: This is the output from the previous step. Simply select “File identifier” under “dynamics content” on the right pane. See above screenshot.

  1. Compose
MS integration 5

In this step, we take the ‘file content’ captured in the previous step and convert it to base64 format. This is required by DocuSign to send using the REST API (the final step below). Inputs: 

-   “base64(…)” – within the brackets, go to “dynamic content” and select the “Get file content”. The final function should read: base64(body('Get_file_content'))

MS integration 6

 

  1. Initialise variable (optional step)

This stores the authentication inputs in variables, to make it easy to change if needed.

MS integration 7

 

  1. HTTP (REST API)
MS integration 8

This is the custom code that can be copy/pasted. The Power Automate step is “HTTP”, with the following inputs:

-   Method: “POST”

-   URI: two options:

o   For DocuSign Demo: https://demo.docusign.net/restapi/v2.1/accounts/@{variables('Account')}/envelopes

 

o   For DocuSign Prod (once the ‘Go-Live’ process is complete):

https://www.docusign.net/restapi/v2.1/accounts/@{variables('Account')}/envelopes

 

-   Headers:

 

{

  "X-DocuSign-Authentication": "{\"Username\":\"@{variables('Username')}\",\"Password\":\"@{variables('Password')}\",\"IntegratorKey\": \"@{variables('IntegratorKey')}\"}",

  "Content-Type": "application/json"

}

 

Note: You may need to switch to “Text mode” to paste the code in (button on the right side of “Header” input)

 

-   Body:

 

{

  "documents": [

{

   "documentBase64": "@{outputs('Compose')}",

   "documentId": "1",

   "fileExtension": "txt",

   "name": "Doc1",

   "order": "1"

}

  ],

  "emailSubject": "Test Envelope 1",

  "recipients": {

"signers": [

   {

     "email": "[enter signer email address]",

     "name": "[enter signer name]",

     "recipientId": "1",

     "roleName": "Signer 1",

     "routingOrder": "1"

   }

]

  },

  "status": "sent"

}

 

Things to note

Use the base64 value from the “Compose” step for this line of code:

"documentBase64": "@{outputs('Compose')}"

 

Use the name and email address of the recipient (signer) for these lines of code:

"email": "[enter signer email address]"

"name": "[enter signer name]"

Note: You can make this dynamic by collecting the signer’s name and email from SharePoint in a previous step, and then use it as input here.

Then, you’re all done and it’s time to save and run your work!

To learn more about integrating DocuSign technologies into your app or website, visit our APIs page. 

 

Author
DocuSign
Published
Related Topics