# SendMessage

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Unknown

Source code: <https://github.com/FrendsPlatform/Frends.As2/tree/main/Frends.As2.SendMessage>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                           | Description                                                                                                                                                                       |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SenderAs2Id : `String`         | <p>Id of the company that will send the message.</p><p><br>Default: <code>-</code><br>Example: <code>MyCompany</code></p>                                                         |
| ReceiverAs2Id : `String`       | <p>Id of the company that will receive the message.</p><p><br>Default: <code>-</code><br>Example: <code>YourCompany</code></p>                                                    |
| Subject : `String`             | <p>Subject of the AS2 message.</p><p><br>Default: <code>-</code><br>Example: <code>Subject of the message</code></p>                                                              |
| MessageFilePath : `String`     | <p>Path to the file that will be sent in the message.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Document\message.txt</code></p>                                      |
| AdditionalHeaders : `Header[]` | <p>Optional additional HTTP headers to send with the AS2 message.</p><p><br>Default: <code>-</code><br>Example: <code>\[{ "Name": "X-ApiKey", "Value": "my-api-key" }]</code></p> |
| {% endtab %}                   |                                                                                                                                                                                   |

{% tab title="Parameter: Connection" %}

| Name                                   | Description                                                                                                                                                                  |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| As2EndpointUrl : `String`              | <p>Connection string to AS2 server</p><p><br>Default: <code>-</code><br>Example: <code><https://as2.example.com/as2></code></p>                                              |
| SignMessage : `Boolean`                | <p>Defines whether to sign the message.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                              |
| EncryptMessage : `Boolean`             | <p>Defines whether to encrypt the message.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                           |
| 🗝SenderCertificatePassword : `String` | <p>Password for the sender certificate.</p><p><br>Default: <code>-</code><br>Example: <code>mySecurePassword123</code></p>                                                   |
| SenderCertificatePath : `String`       | <p>Path to the sender certificate file in .pfx format.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Document\sender\_cert.pfx</code></p>                           |
| ReceiverCertificatePath : `String`     | <p>Path to the receiver certificate file in .pfx format.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Document\receiver\_cert.pfx</code></p>                       |
| MdnReceiver : `String`                 | <p>URL or email where to send the MDN (Message Disposition Notification).</p><p><br>Default: <code>-</code><br>Example: <code><user@example.com></code></p>                  |
| ContentTypeHeader : `String`           | <p>Specify content type header for the message if it's neither encrypted nor signed.</p><p><br>Default: <code>text/plain</code><br>Example: <code>application/zip</code></p> |
| {% endtab %}                           |                                                                                                                                                                              |

{% tab title="Parameter: Options" %}

| Name                             | Description                                                                                                                                                                                                                                                                                                                                                               |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MdnMode : `MdnMode`              | <p>Specifies whether to request synchronous or asynchronous MDN</p><p>Possible values:</p><ul><li><code>Sync</code>:</li></ul><p>Specifies whether to request synchronous or asynchronous MDN</p><ul><li><code>Async</code>:</li></ul><p>Specifies whether to request synchronous or asynchronous MDN</p><p><br>Default: <code>0</code><br>Example: <code>Sync</code></p> |
| AsyncMdnUrl : `String`           | <p>URL where async MDN should be sent (required when MdnMode is Async)</p><p><br>Default: <code>-</code><br>Example: <code><https://mycompany.com/api/as2/mdn-receiver></code></p>                                                                                                                                                                                        |
| ThrowErrorOnFailure : `Boolean`  | <p>Whether to throw an error on failure.</p><p><br>Default: <code>True</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                          |
| ErrorMessageOnFailure : `String` | <p>Overrides the error message on failure.</p><p><br>Default: <code>-</code><br>Example: <code>Custom error message</code></p>                                                                                                                                                                                                                                            |
| {% endtab %}                     |                                                                                                                                                                                                                                                                                                                                                                           |

{% tab title="Result: Result" %}

| Name                         | Description                                                                                                                                                                                                          |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean`          | <p>Indicates if the task completed successfully.<br>Example: <code>true</code></p>                                                                                                                                   |
| PartnerResponse : `String`   | <p>The transport/MDN response from the AS2 partner: - Sync mode: full multipart/signed MDN content - Async mode: the immediate response from the POST (e.g., "200 OK")<br>Example: <code>200 OK</code></p>           |
| MessageId : `String`         | <p>ID of a sent message.<br>Example: <code>123</code></p>                                                                                                                                                            |
| MdnStatus : `String`         | <p>Status of the MDN response.<br>Example: <code>ReceivedValid</code></p>                                                                                                                                            |
| MdnMessage : `String`        | <p>Human-readable message included in the MDN.<br>Example: <code>The message was successfully received and processed.</code></p>                                                                                     |
| MdnIntegrityCheck : `String` | <p>Message Integrity Check (MIC) value reported in the MDN.<br>Example: <code>"7v7F+fQbH4lD8bKGJTbXzWWcUlI=, sha1"</code></p>                                                                                        |
| IsMdnPending : `Boolean`     | <p>Indicates whether the MDN delivery is pending (true for async MDN mode, false for sync MDN mode). When true, the MDN will be delivered separately to the AsyncMdnUrl endpoint.<br>Example: <code>false</code></p> |
| Error : `Error`              | <p>Error that occurred during task execution.<br>Example: <code>object { string Message, object { Exception Exception } AdditionalInfo }</code></p>                                                                  |
| {% endtab %}                 |                                                                                                                                                                                                                      |

{% tab title="Changelog" %}

## Changelog

### \[1.0.0] - 2025-09-11

#### Changed

* Initial implementation
  {% endtab %}
  {% endtabs %}
