---
schema_version: "1"
id: c4ac1700d36ad8d93c9f648b04524161fa70499c007f81826eebb74304b80aa0
title: DocuSign Connector 1.1 Examples
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/docusign-connector/latest/docusign-connector-examples.md
canonical_url: https://docs.mulesoft.com/docusign-connector/latest/docusign-connector-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 99f65b4a5cfa4896c1958aa852cf6be43537f8b6562d600ecf11afb30e710ec5
description: MuleSoft Documentation Site
release: "1.1"
latest: true
---
---
product: DocuSign Connector
version: 1.1
is-latest-version: true
---

# DocuSign Connector 1.1 Examples

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This example shows how to create a DocuSign envelope. The example contains two flows:

- The first flow provides a template for a user interface.

- The second flow creates the DocuSign envelope.

## Create the First Flow

The first flow provides a template for the user interface. To change the template used in the flow,
select the **Parse Template** component and go to the **Location** field to update the location with
the path of the desired template.

![DocuSign Connector First Flow in Studio](/mulesoft/current/en-us/docusign-connector/latest/_images/docusign-first-flow.png)

In this flow, you configure:

- An **HTTP Listener** component

- A **Parse Template** component

### Configure HTTP Listener

Configure **HTTP Listener** to initiate a Mule flow when a call is made to the `/` account path on
`localhost`, port `8081`.

This example uses variables for some field values. You can either:

- Replace the variables with their values in the code.

- Provide the values for each variable in a properties file and then refer to that file from the
  connector configuration.

If you don’t know how to use a properties file, see
[Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure).

To configure **HTTP Listener**:

1.  Create a new Mule project in Studio.

2.  In the **Mule Palette** view, search for `http` and select the **Listener** operation:

3.  Drag the **Listener** operation onto the canvas.

4.  In the **Listener** configuration, click the **Add** icon next to the **Connector
    configuration** field to add a global element.

5.  Click **OK** to accept the defaults.

6.  Set the **Path** field to `/`.

### Add the Parse Template Component

The **Parse Template** component creates a template for an HTML form (`form.html`), which is located
in the main resources folder. The example uses this form to convey information for creating an
envelope.

1.  From the **Mule Palette** view, search for `parse` and drag **Core> Parse Template** onto the
    canvas, next to **HTTP Listener**.

2.  Configure the following fields in the **Publish** properties window:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the component, such as <code>Parse Template</code>.</p></td></tr><tr><td><p>Location</p></td><td><p>Location of the file, such as <code>form.html</code>.</p></td></tr></tbody></table>

## Create the Second Flow

The second flow creates the DocuSign envelope. The `status`, `emailSubject`, `documents`, and
`recipients` (combined URI and recipient URI) parameters must be provided.

![DocuSign Connector Second Flow in Studio](/mulesoft/current/en-us/docusign-connector/latest/_images/docusign-second-flow.png)

In this flow, you configure:

- An **HTTP Listener** component

- **Logger** component

- **Envelopes Post Envelopes** operation

- **Transform Message** component

- A second **Logger** component

### Configure HTTP Listener

Configure **HTTP Listener** to initiate a Mule flow when a call is made to the `/` account path on
`localhost`, port `8081`.

This example uses variables for some field values. You can either:

- Replace the variables with their values in the code.

- Provide the values for each variable in a properties file and then refer to that file from the
  connector configuration.

If you don’t know how to use a properties file, see
[Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure).

To configure **HTTP Listener**:

1.  Create a new Mule project in Studio.

2.  In the **Mule Palette** view, search for `http` and select the **Listener** operation:

3.  Drag the **Listener** operation onto the canvas.

4.  In the **Listener** configuration, click the **Add** icon next to the **Connector
    configuration** field to add a global element.

5.  Click **OK** to accept the defaults.

6.  Set the **Path** field to `/create-envelope`.

### Add a Logger Component

Configure a **Logger** component to perform logging on the payload.

1.  In the **Mule Palette** view, search for `logger`.

2.  Drag the **Logger** component onto the canvas, next to **HTTP Listener**.

3.  Configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Payload Passed To The Operation Logger</code>.</p></td></tr><tr><td><p>Message</p></td><td><p>Enter <code>#[payload]</code>.</p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default).</p></td></tr></tbody></table>

### Add the Envelopes Post Envelopes Operation

The **Envelopes Post Envelopes** operation creates an envelope from the template.

1.  Drag the **Envelopes Post Envelopes** operation onto the canvas, next to **Logger**.

2.  In the **Envelopes Post Envelopes** configuration, click the **Connector configuration**
    dropdown and select **Docusign\_Connector\_Config**.

3.  Configure the following fields in the **Envelopes Post Envelopes** properties window:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Account Id</p></td><td><p><code>${account.id}</code>.</p></td></tr><tr><td><p>Body</p></td><td><p><code>payload</code>.</p></td></tr></tbody></table>

### Add the Transform Message Component

The **Transform Message** component converts the input data from the template.

1.  In the **Mule Palette** view, search for `transform message`.

2.  Drag the **Transform Message** component onto the canvas, next to **Envelopes Post Envelopes**.

3.  In the **Transform Message** configuration, overlay the brackets in the **Output** section with
    this XML:

    ```xml
    %dw 2.0
    output application/json
    ---
    payload
    ```

### Add the Second Logger Component

Configure a second **Logger** component to perform logging on the output of the **Transform
Message** component.

1.  In the **Mule Palette** view, search for `logger`.

2.  Drag the **Logger** component onto the canvas, next to **Transform Message**.

3.  Configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Logger</code>.</p></td></tr><tr><td><p>Message</p></td><td><p>Enter <code>#[payload]</code>.</p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default).</p></td></tr></tbody></table>

## XML for This Example

Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:docusign="http://www.mulesoft.org/schema/mule/docusign"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/docusign http://www.mulesoft.org/schema/mule/docusign/current/mule-docusign.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="13c7085f-6573-41dc-aafd-d138f8a3e810" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<docusign:config name="Docusign_Connector_Config" doc:name="Docusign Connector Config" doc:id="753c4be0-d78e-49f0-9018-9fca64fb7a97" >
		<docusign:authorization-connection authorization="${authorization.api.key}" baseUri="https://demo.docusign.net/restapi"/>
	</docusign:config>
	<configuration-properties doc:name="Configuration properties" doc:id="b7c89d0f-30d4-4bfc-883a-de464b792f30" file="application.properties" />
	<flow name="mule-docusign-template-flow" doc:id="1f8e9187-ea3d-4ddc-9451-70882461fa63" >
		<http:listener doc:name="Listener" doc:id="79babbba-a26a-42d6-b853-4806daa23def" config-ref="HTTP_Listener_config" path="/demo"/>
		<parse-template doc:name="Parse Template" doc:id="e7ff6b4d-7cbc-4c20-9983-8fd7ac4e01f2" location="form.html"/>
	</flow>
	<flow name="create-envelope-flow" doc:id="68aaae35-5c5d-4f05-beb8-b06dd3500e19" >
		<http:listener doc:name="Listener" doc:id="f5584ab0-a5fa-4246-a074-75a8bbfa45f6" config-ref="HTTP_Listener_config" path="/create-envelope"/>
		<logger level="INFO" doc:name="Payload Passed To The Operation Logger" doc:id="dcb42d11-f8fa-4fe3-a1dc-10d7ae877c8b" message="#[payload]"/>
		<docusign:create-v21-accounts-envelopes-by-account-id doc:name="Envelopes Post Envelopes" doc:id="a000887e-7276-4d43-a741-ecbed4b65e39" config-ref="Docusign_Connector_Config" accountId="${account.id}"/>
		<ee:transform doc:name="Transform Message" doc:id="6778ad8b-200f-4873-b60c-4b0068b39e1f" >
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<logger level="INFO" doc:name="Logger" doc:id="16de0607-ee97-45fb-8b18-139a8698bab4" message="&gt;&gt;&gt; #[payload]"/>
	</flow>
</mule>
```

## See Also

- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)

- [Salesforce Help](https://help.salesforce.com)
