# ADOBESIGNSEND Workflow Application

## Overview

The **ADOBESIGNSEND** workflow application lets you send one or multiple documents to Adobe Sign for electronic signature.

## How it works

* The ADOBESIGNSEND creates a single envelope and sends it to one or multiple signers.<br>
* You can specify one or multiple files per ADOBESIGNSEND action. To do this, use the `FILEx` parameter, where `x` corresponds to the file number (e.g. `FILE1`). At least one file is required.<br>
* You can specify one or multiple signers. To do this, use the combination of `SIGNER_NAME_LIST` and `SIGNER_EMAIL_LIST`. You can also use `SIGNER_NAMEx` and `SIGNER_EMAILx`, where `x` corresponds to the signer number.<br>
* You can specify one role per recipient. To do this, based on the method that you use to specify signers (with or without `_LIST`), you can use `SIGNER_ROLE_LIST` or `SIGNER_ROLEx`, where `x` corresponds to the signer number. Possible values: `SIGNER` (default), `APPROVER`, `ACCEPTOR`, `CERTIFIED_RECIPIENT`, `FORM_FILLER` or `DELEGATE_TO_SIGNER`, `DELEGATE_TO_APPROVER`, `DELEGATE_TO_ACCEPTOR`, `DELEGATE_TO_CERTIFIED_RECIPIENT`, `DELEGATE_TO_FORM_FILLER`, or `SHARE`.<br>
* Application logs are available. These can be specified by setting the value of the `AdobeSignSendLogLevel` parameter in the `web.config` file to `0` to deactivate logs, `1` for error logs, `2` for information logs, or `3` for debug logs; the default value is `0`.

## Configuring the Adobe Sign API

### Creating an Adobe Sign API application

1. In the Adobe Sign administration interface, add a new `API Application`, then click **Configure OAuth for application**.<br>
2. Activate the following scopes and select `account` under **Modifier**:
   * `agreement_write`
   * `agreement_read` <br>
3. You can retrieve the `Client ID` and `Client Secret` directly from the configuration tab.<br>
4. Insert a valid address in the **Redirect URI** field; it will be useful in the next step.

<figure><img src="https://3810463125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LQ0OuyalhD4eRB31PgV-2115695630%2Fuploads%2FHEIsb9jipK82Wi019bhi%2FOAuth%20configuration.png?alt=media&#x26;token=6570e17e-45db-480b-afb1-5cf5fbbe1a07" alt=""><figcaption><p>Application OAuth configuration</p></figcaption></figure>

### Obtaining the refresh token

Since Adobe Sign doesn't support `client_credentials` authentication, it's necessary to use a refresh token in order to retrieve a valid `access_token`. The refresh token is valid for 60 days. These 60 days are renewed upon each API call, which means that when you run ADOBESIGNSEND or ADOBESIGNCHECK, the token's validity is extended by 60 days.

#### Consent and obtaining a one-time code

In order to be able to use your new Adobe Sign application, you need to authorize it to access the defined `scopes`. Execute the following URL in your browser:

```
<HOST_SERVER>/public/oauth?redirect_uri=<REDIRECT_URI>&client_id=<CLIENT_ID>&response_type=code&scope=agreement_read:account+agreement_write:account
```

Replace the following information with your own values:

* `<HOST_SERVER>` : Your Adobe Sign account's host server. Usually, the URL is composed like this: `https://api.naX.adobesign.com`, where`X` is the server ID.<br>
* `<REDIRECT_URI>` : The URL that you defined in your Adobe Sign application.<br>
* `<CLIENT_ID>` : Your Adobe Sign application's client ID.

After granting consent to your application, you'll be redirected to your `REDIRECT_URI` with a `CODE` parameter in the URL.

The code returned by Adobe Sign is for one-time use and will be used to obtain the refresh token.

#### Retrieving the refresh token

In order to obtain the refresh token, execute the following request, specifying your values:

```
curl --location --request POST '<HOST_SERVER>/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'code=<CONSENT_CODE>' \
--data-urlencode 'client_id=<CLIENT_ID>' \
--data-urlencode 'client_secret=<CLIENT_SECRET>' \
--data-urlencode 'redirect_uri=<REDIRECT_URI>' \
--data-urlencode 'grant_type=authorization_code'
```

* `HOST_SERVER` : Your Adobe Sign account's host server. Usually, the URL is composed like this: `https://api.naX.adobesign.com` , where `X` is the server ID.<br>
* `<CONSENT_CODE>` : One-time use code obtained in the previous step ([Consent and obtaining a one-time code](#consent-and-obtaining-a-one-time-code)).<br>
* `<CLIENT_ID>` : Client ID of your Adobe Sign application.<br>
* `<CLIENT_SECRET>` : Your Adobe Sign application's client secret.<br>
* `<REDIRECT_URI>` : The URL that you defined in your Adobe Sign application.

After executing the request, you'll obtain a value for the refresh token, contained in the `refresh_token` data.

{% hint style="info" %}
If your refresh token has expired, you'll need to perform the preceding operations again.
{% endhint %}

## Required parameters

You can use one of the following two configurations: with a list of signers or with signer numbers.

### With a list of signers

| Parameter           | Type | Direction | Description                                                                                   |
| ------------------- | ---- | --------- | --------------------------------------------------------------------------------------------- |
| `SIGNER_NAME_LIST`  | TEXT | IN        | Names of signers, separated by the value defined in the `DATA_SEPARATOR` parameter            |
| `SIGNER_EMAIL_LIST` | TEXT | IN        | Email addresses of signers, separated by the value defined in the `DATA_SEPARATOR` parameter. |
| `FILEx`             | FILE | IN        | File(s) to send, where `x` corresponds to the file number; you can add one or multiple files  |

### With signer numbers

| Parameter       | Type | Direction | Description                                                                                                         |
| --------------- | ---- | --------- | ------------------------------------------------------------------------------------------------------------------- |
| `SIGNER_NAMEx`  | TEXT | IN        | Name(s) of the signer(s), where `x` corresponds to the signer number; you can add one or multiple signers           |
| `SIGNER_EMAILx` | TEXT | IN        | Email address(es) of the signer(s), where `x` corresponds to the signer number; you can add one or multiple signers |
| `FILEx`         | FILE | IN        | File(s) to send, where `x` corresponds to the file number; you can add one or multiple files                        |

## Optional parameters

### Adobe Sign configuration

| Parameters                | Type | Direction | Description                                                                                                                                                                                                                                                                                   |
| ------------------------- | ---- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ADOBESIGN_CLIENT_ID`     | TEXT | IN        | <p>Adobe Sign client ID client Adobe Sign<br><br>By default, this value comes from the <code>AdobeSignClientId</code> parameter in the <code>web.config</code> file.</p>                                                                                                                      |
| `ADOBESIGN_CLIENT_SECRET` | TEXT | IN        | <p>Adobe Sign client secret</p><p><br>By default, this value comes from the <code>AdobeSignClientSecret</code> parameter in the <code>web.config</code> file.</p>                                                                                                                             |
| `ADOBESIGN_REFRESH_TOKEN` | TEXT | IN        | <p>Authentication refresh token</p><p><br>By default, this value comes from the <code>AdobeSignAuthServer</code> parameter in the <code>web.config</code> file. </p><p></p><p>To obtain it, see the <a href="#configuring-the-adobe-sign-api">Configuring the Adobe Sign API</a> section.</p> |
| `ADOBESIGN_HOST_SERVER`   | TEXT | IN        | <p>Adobe Sign host server (e.g. <code><https://api.naX.adobesign.com></code>, where <code>X</code> is the server ID)</p><p></p><p>By default, this value comes from the <code>AdobeSignHostServer</code> parameter in the <code>web.config</code> file.</p>                                   |

### General

| Parameters         | Type | Direction | Description                                                                                                                                                                                                        |
| ------------------ | ---- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DATA_SEPARATOR`   | TEXT | IN        | <p>Separator used to the separate the contents of <code>SIGNERS\_NAME\_LIST</code>, <code>SIGNERS\_EMAIL\_LIST</code>, and <code>SIGNER\_ROLE\_LIST</code><br><strong>Default:</strong> <code>,</code> (comma)</p> |
| `SIGNER_ROLE_LIST` | TEXT | IN        | Roles of the signers, separated by the value defined in the `DATA_SEPARATOR` parameter                                                                                                                             |
| `SIGNER_ROLEX`     | TEXT | IN        | Role(s) of the signer(s), where `x` corresponds to the signer number; you can add one or multiple signers                                                                                                          |
| `AGREEMENT_NAME`   | TEXT | IN        | <p>Name of the agreement, which will be displayed in the email sent to the user<br><strong>Default:</strong> <code>WorkflowGen</code></p>                                                                          |

### **Return parameter**

| Parameter                | Type | Direction | Description                                                                                                                                                                        |
| ------------------------ | ---- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ADOBESIGN_AGREEMENT_ID` | TEXT | OUT       | Contains the Adobe Sign agreement ID; you can use this ID in the [ADOBESIGNCHECK](https://docs.workflowgen.com/admin/8.0/adobesigncheck-workflow-application) workflow application |

## Examples

### With a list of signers

| Parameter                | Type | Direction | Value                                           |
| ------------------------ | ---- | --------- | ----------------------------------------------- |
| `SIGNER_NAME_LIST`       | TEXT | IN        | `John Smith,Bernard Martin`                     |
| `SIGNER_EMAIL_LIST`      | TEXT | IN        | `john.smith@email.com,bernard.martin@email.com` |
| `SIGNER_ROLE_LIST`       | TEXT | IN        | `APPROVER,SIGNER`                               |
| `FILE1`                  | FILE | IN        | `contract.pdf`                                  |
| `ADOBESIGN_AGREEMENT_ID` | TEXT | OUT       | `xxxxx-xxxxx-xxxxx-xxxxx`                       |

### With signer numbers

| Parameter                | Type | Direction | Value                      |
| ------------------------ | ---- | --------- | -------------------------- |
| `SIGNER_NAME1`           | TEXT | IN        | `John Smith`               |
| `SIGNER_NAME2`           | TEXT | IN        | `Bernard Martin`           |
| `SIGNER_EMAIL1`          | TEXT | IN        | `john.smith@email.com`     |
| `SIGNER_EMAIL2`          | TEXT | IN        | `bernard.martin@email.com` |
| `SIGNER_ROLE1`           | TEXT | IN        | `APPROVER`                 |
| `SIGNER_ROLE2`           | TEXT | IN        | `SIGNER`                   |
| `FILE1`                  | FILE | IN        | `contract.pdf`             |
| `ADOBESIGN_AGREEMENT_ID` | TEXT | OUT       | `xxxxx-xxxxx-xxxxx-xxxxx`  |
