# DOCAPOSTESEND Workflow Application

## Overview

The **DOCAPOSTESEND** workflow application lets you send one or more documents to Docaposte for electronic signature.

## How it works

* The DOCAPOSTESEND application creates a single envelope and sends it to one or more signers.<br>
* You can specify one or more files per DOCAPOSTESEND action. To do this, use the `FILEx` parameter, where x is the file number (e.g.: `FILE1`). At least one file is required.<br>
* You can specify one or more signers. To do this, use the combination of `SIGNER_FIRSTNAME_LIST`, `SIGNER_LASTNAME_LIST`, and `SIGNER_EMAIL_LIST`. You can also use `SIGNER_FIRSTNAMEx`, `SIGNER_LASTNAMEx`, and `SIGNER_EMAILx`, where `x` is the number of the signer.<br>
* You can specify one type of signature per recipient. To do this, depending on the method you use to specify signers (with or without `_LIST`), you can use `SIGNATURE_TYPE_LIST` or `SIGNATURE_TYPEx`, where `x` is the signer number. Possible values: `OTP` (default), `PAD`, `TOKEN`, `CONSENT_PROOF` or `IDENTITY`.<br>
* Application logs are available. These can be specified by setting the value of the `DocaposteSendLogLevel` parameter in the `web.config` file to `0` to disable logging, `1` for error logs, `2` for information logs, or `3` for debug logs; The default value is `0`.

## 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_FIRSTNAME_LIST` | TEXT | IN        | First names of signers, separated by the value defined in the `DATA_SEPARATOR` parameter         |
| `SIGNER_LASTNAME_LIST`  | TEXT | IN        | Last names of signers, separated by the value defined in the `DATA_SEPARATOR` parameter          |
| `SIGNER_EMAIL_LIST`     | TEXT | IN        | Email addresses of the signers, separated by the value defined in the `DATA_SEPARATOR` parameter |
| `FILEx`                 | FILE | IN        | File(s) to send, where `x` is the file number; you can add one or more files                     |

### With signer numbers

| Parameter           | Type | Direction | Description                                                                                                 |
| ------------------- | ---- | --------- | ----------------------------------------------------------------------------------------------------------- |
| `SIGNER_FIRSTNAMEx` | TEXT | IN        | First name(s) of the signer(s), where `x` corresponds to the signer number; you can add one or more signers |
| `SIGNER_LASTNAMEx`  | TEXT | IN        | Last name(s) of the signer(s), where `x` corresponds to the signer number; you can add one or more signers  |
| `SIGNER_EMAILx`     | TEXT | IN        | Email address(es) of the signer(s), where `x` is the signer's number; you can add one or more signers       |
| `FILEx`             | FILE | IN        | File(s) to send, where `x` is the file number; you can add one or more files                                |

## Optional parameters

### Docaposte configuration

| Parameters                           | Type | Direction | Description                                                                                                                                                                              |
| ------------------------------------ | ---- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DOCAPOSTE_USERNAME`                 | TEXT | IN        | <p>Docaposte username<br><br>By default, this value comes from the <code>DocaposteUsername</code> parameter in the <code>web.config</code> file.</p>                                     |
| `DOCAPOSTE_PASSWORD`                 | TEXT | IN        | <p>Docaposte password<br><br>By default, this value comes from the <code>DocapostePassword</code> parameter in the <code>web.config</code> file.</p>                                     |
| `DOCAPOSTE_HOST_SERVER`              | TEXT | IN        | <p>Docaposte host server</p><p></p><p>By default, this value comes from the <code>DocaposteHostServer</code> parameter in the <code>web.config</code> file.</p>                          |
| `DOCAPOSTE_OFFER_CODE`               | TEXT | IN        | <p>Docaposte offer code<br></p><p>By default, this value comes from the <code>DocaposteOfferCode</code> parameter in the <code>web.config</code> file.</p>                               |
| `DOCAPOSTE_ORGANIZATIONAL_UNIT_CODE` | TEXT | IN        | <p>Docaposte organizational unit code</p><p></p><p>By default, this value comes from the <code>DocaposteOrganizationalUnitCode</code> parameter in the <code>web.config</code> file.</p> |

### General

| Parameters         | Type | Direction | Description                                                                                                                                                                                                                                                                                                                                |
| ------------------ | ---- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DATA_SEPARATOR`   | TEXT | IN        | <p>Separator used to separate the contents of <code>SIGNERS\_FIRSTNAME\_LIST</code>,<code>SIGNERS\_LASTNAME\_LIST</code>, <code>SIGNERS\_EMAIL\_LIST</code>, and <code>SIGNER\_TYPE\_LIST</code><br><strong>Default :</strong> <code>,</code> (comma)</p>                                                                                  |
| `SIGNER_TYPE_LIST` | TEXT | IN        | <p>Signature type of signers, separated by the value defined in the <code>DATA\_SEPARATOR</code> parameter<br><br><strong>Possible values:</strong></p><ul><li><code>OTP</code>(default)</li><li><code>PAD</code></li><li><code>TOKEN</code></li><li><code>CONSENT\_PROOF</code></li><li><code>IDENTITY</code></li></ul>                   |
| `SIGNER_TYPEX`     | TEXT | IN        | <p>Signature type of signer(s), where <code>x</code> corresponds to the signer number; you can add one or more signers</p><p></p><p><strong>Possible values:</strong></p><ul><li><code>OTP</code>(default)</li><li><code>PAD</code></li><li><code>TOKEN</code></li><li><code>CONSENT\_PROOF</code></li><li><code>IDENTITY</code></li></ul> |
| `CUSTOM_REFERENCE` | TEXT | IN        | <p>Provider reference</p><p></p><p>The content of this parameter can allow the provider to identify the transaction on its end with; for example, a value specific to its business domain (e.g. customer file number).<br><strong>Default:</strong><code>WorkflowGen</code></p>                                                            |
| `TEST_MODE`        | TEXT | IN        | <p>Indicates whether the transaction is a TEST transaction (<code>Y</code> or <code>N</code>)</p><p><strong>Default:</strong> <code>N</code></p>                                                                                                                                                                                           |
| `EMAIL_SUBJECT`    | TEXT | IN        | <p>Subject of the email that will be sent to signers</p><p><strong>Default:</strong> <code>Please sign the document sent from WorkflowGen</code></p>                                                                                                                                                                                       |
| `EMAIL_FROM`       | TEXT | IN        | <p>Domain name of the email address that will be used to send the email to signers</p><p><strong>Default :</strong> <code>do-not-reply</code></p>                                                                                                                                                                                          |
| `EMAIL_BODY`       | FILE | IN        | Content of the email to send to signers (see the [Customizing the body of the email](#customizing-the-body-of-the-email) section)                                                                                                                                                                                                          |

### Return parameters

| Parameter                    | Type | Direction | Description                                                                                                                                                                                              |
| ---------------------------- | ---- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DOCAPOSTE_TRANSACTION_ID`\` | TEXT | OUT       | Contains the Docaposte transaction ID; you can use this ID in the [DOCAPOSTCHECK](https://docs.workflowgen.com/admin/8.0/docapostecheck-workflow-application) workflow application                       |
| `DOCAPOSTE_DOCUMENT_NAMES`   | TEXT | OUT       | Contains the names of the documents sent to Docaposte; you can use these values in the [DOCAPOSTECHECK](https://docs.workflowgen.com/admin/8.0/docapostecheck-workflow-application) workflow application |

### Customizing the body of the email

You can customize the content of the body of the email to be sent to the signer. The template must contain the `<DOCAPOSTE_SIGN_URL>` tag, which will be replaced by the link allowing the signer to add their signature.

**Default value:**

```markup
<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
</head>
<body>
    <p>Hello {firstname} {lastname},</p>
    <p>
        Please sign the document sent from WorkflowGen.
        <br />
        <a href=""<DOCAPOSTE_SIGN_URL>"">Click here to sign on Docaposte</a>
    </p>
    <p>Regards,</p>
    <p>WorkflowGen</p>
</body>
</html>
```

## Examples

### With a list of signers

| Parameter                  | Type | Direction | Value                                           |
| -------------------------- | ---- | --------- | ----------------------------------------------- |
| `SIGNER_FIRSTNAME_LIST`    | TEXT | IN        | `John,Bernard`                                  |
| `SIGNER_LASTNAME_LIST`     | TEXT | IN        | `Smith,Martin`                                  |
| `SIGNER_EMAIL_LIST`        | TEXT | IN        | `john.smith@email.com,bernard.martin@email.com` |
| `SIGNER_TYPE_LIST`         | TEXT | IN        | `PAD,OTP`                                       |
| `FILE1`                    | FILE | IN        | `contract.pdf`                                  |
| `DOCAPOSTE_TRANSACTION_ID` | TEXT | OUT       | `xxxxx-xxxxx-xxxxx-xxxxx`                       |
| `DOCAPOSTE_DOCUMENT_NAMES` | TEXT | OUT       | `contract.pdf`                                  |

### With signer numbers

| Parameter                  | Type | Direction | Value                      |
| -------------------------- | ---- | --------- | -------------------------- |
| `SIGNER_LASTNAME1`         | TEXT | IN        | `Smith`                    |
| `SIGNER_LASTNAME2`         | TEXT | IN        | `Martin`                   |
| `SIGNER_FIRSTNAME1`        | TEXT | IN        | `John`                     |
| `SIGNER_FIRSTNAME1`        | TEXT | IN        | `Bernard`                  |
| `SIGNER_EMAIL1`            | TEXT | IN        | `john.smith@email.com`     |
| `SIGNER_EMAIL2`            | TEXT | IN        | `bernard.martin@email.com` |
| `SIGNER_TYPE1`             | TEXT | IN        | `PAD`                      |
| `SIGNER_TYPE2`             | TEXT | IN        | `TOKEN`                    |
| `FILE1`                    | FILE | IN        | `contract.pdf`             |
| `DOCAPOSTE_TRANSACTION_ID` | TEXT | OUT       | `xxxxx-xxxxx-xxxxx-xxxxx`  |
| `DOCAPOSTE_DOCUMENT_NAMES` | TEXT | OUT       | `contract.pdf`             |
