Skip to main content
Blog
Home/

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

Author Mohamed Ali
Mohamed Ali
Summary7 min read

Your step-by-step guide to setting up Docusign with Microsoft Power Automate, to streamline those critical business processes you use every day even more.

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

                  Table of contents

                  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. You’ll find this super 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 an Integration Key, a special key that enables the API-level authentication:

                    • Go to Integrations > API and Keys, and note down the “Account’s Base URI”. We will refer to this as the Base URL.

                    • then “Add App / Integration Key”, note down the Integration Key

                    • Select “Authorization Code Grant” radio button, then click “Add Secret Key”, and note down the Secret Key

                    • Click “Add URI”, and add the following: https://global.consent.azure-apim.net/redirect (this may change as its generated by Power automate, but this initial value will work for now). Please note down this value of the Redirect URI for now.

                  3. 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:

                      • Name: Signature

                      • Type: Sign Here

                      • Shared: Tick (yes)

                      • 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. 

                  Step 2

                  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:

                  Step 3

                  Let’s go through each step now.

                  Create a Custom Connector

                  In the diagram above, this is the final step “Send Document to Sign”. This needs to be setup before the Flow is created.

                  Go to Power Automate, select Data > Custom connectors.

                  From the top right menu, select New custom connector > Create from blank.

                  Custom Connector

                  Give it a useful name, as this will be reused whenever you want to call this Docusign step in your flow.

                  Connector name

                  General

                  Input these details below:

                  • Host: Base URL [captured earlier]

                  • Base URL: /restapi/v2.1

                  Upload connector

                  Security

                  On the next screen, enter the details below 

                  DEMO:

                  PROD:

                  Security

                  Click “Create Connector”. Double check the newly generated Redirect URL and ensure it matches the Redirect URI from the Integration Key created in Docusign

                  Create connector

                  Definition

                  Create a new Action, give it a useful name, and unique Operation ID. 

                  Send document to sign

                  Under Request, select “Import from sample”

                  Enter these values:

                  Verb: POST

                  URL: https://demo.docusign.net/restapi/v2.1/accounts/\[your Account ID]/envelopes

                  Headers: Content-Type application/json

                  Body: 

                  {
                  "documents": [
                  {
                  "documentBase64": "[variable]",
                  "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"
                  }
                  
                  Send document to sign 2

                  Select “Import” to complete this section.

                  Import

                  Test

                  Now let’s test our connection.

                  On the next section, select “Update connector”. Now click “New connection” and login with your Docusign credentials

                  Test connection

                  Click Accept to give permission to Power Automate. Once it is completed a new entry will be available from the drop down list confirming it has worked. 

                  The custom connector is now completed, next is to create each step of the Flow. 

                  Create steps in flow

                  This is a basic “trigger” step, and could be whatever trigger you had a business requirement. In this example, I am listening to the “/DS Folder/FlowTest” folder, once a new file is created, it kicks off this workflow.

                  Inputs:

                  • Site Address: - Sharepoint site

                  • Folder id: Folder path

                  Next step in flow

                  Get file content

                  This step is required to capture the file content based on the ‘trigger’, so 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.

                  Compose

                  Connector name

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

                  Input

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

                  Add Custom connector

                  Add a new step, select Custom > Send Envelope (or whatever you called it).

                  Add custom connector

                  Select the Action we created.

                  Connector name

                  From here complete the fields as below. 

                  The “documents” field will be a variable (the one we created earlier in the Compose Step). Select add dynamic content > Outputs. 

                  Now add the following values:

                  • documentId: 1

                  • fileExtension: txt

                  • name: Doc1

                  • order: 1  

                  • emailSubject: Send document for signature

                  • email: [enter signer email address]

                  • name: [enter signer name]

                  • recipientId: 1

                  • roleName: Signer 1

                  • routingOrder: 1

                  • status: sent

                  Send document to sign

                  Note - For these fields:

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

                  The name and email address of the recipient (signer). Note: You can make this dynamic by collecting the signers name and email from Sharepoint in a previous step, and then use it as input here.

                  Now save and run it!

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

                  Author Mohamed Ali
                  Mohamed Ali
                  More posts from this author

                  Related posts

                  • ATB Financial Builds Relationships Through Automation with eSignature
                    API Success

                    ATB Financial Builds Relationships Through Automation with eSignature

                    Author Jodi Schechter
                    Jodi Schechter
                  ATB Financial Builds Relationships Through Automation with eSignature

                  ATB Financial Builds Relationships Through Automation with eSignature

                  Author Jodi Schechter
                  Jodi Schechter

                  Discover what's new with Docusign IAM or start with eSignature for free

                  Explore Docusign IAMTry eSignature for Free
                  Two people working together on a laptop at a desk