# AddAttachmentInbound Message

Click on the **'Messages' icon** to open the Messages page. Click **New**.

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MguWiRtu-TsC_zf1Gea%2F-Mguf1KtS8ZOyeOcgei3%2FIAPG%20-%20AddAttachmentInbound%20Message%201.png?alt=media\&token=309dad50-39f1-45a2-98d2-02e781a74177)

## New Message Modal

The fields to be configured for the AddAttachmentInbound New Message modal are as follows:

<table><thead><tr><th>Field</th><th width="306.1107775516443">Description</th><th width="219.86477356813663">Value</th></tr></thead><tbody><tr><td>Message name</td><td>The message name that is unique for this integration.</td><td>'AddAttachmentInbound'</td></tr><tr><td>Type</td><td>The primary purpose of the message.</td><td>'Update'</td></tr><tr><td>Direction</td><td>The direction(s) this message is configured to support.</td><td>'Inbound'</td></tr><tr><td>Description</td><td>The description for this message and the requirement it is meeting.</td><td>&#x3C;Your description></td></tr></tbody></table>

*Your AddAttachmentInbound New Message modal should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MguhKCFLKUJY_4C9KqN%2F-MguhWhDqBRPGHgXO0Sp%2FIAPG%20-%20AddAttachmentInbound%20Message%202.png?alt=media\&token=d72204e5-25e2-4cab-afbd-0ab60e6a21c0)

Click **Submit and view** to further configure the Message.

## Response Fields

Navigate to **Message > Response**.

The Response fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="303.3333333333333">Description</th><th>Value</th></tr></thead><tbody><tr><td>Response</td><td>The immediate synchronous response to this message.</td><td>lookup: 'Response'</td></tr><tr><td>Async*</td><td>Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asynchronous message pair.</td><td>&#x3C;false></td></tr></tbody></table>

*\*This field is automatically defaulted to true.*

*Your Response form should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MguhKCFLKUJY_4C9KqN%2F-Mgulo_oLB4KlkrWhQMP%2FIAPG%20-%20AddAttachmentInbound%20Message%203.png?alt=media\&token=31a4b76a-a75c-46a9-b7d0-a42a5385fea3)

Navigate to **Message > Bond**.

## Bond Fields

The Bond fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="356.3333333333333">Description</th><th>Value</th></tr></thead><tbody><tr><td>Bond ownership*</td><td>Determine if the sender should own the bond or not in order for this message to be processed? Use 'Ignore' to process regardless of the owner flag.  <em>(Choices: Ignore, Must own, Must not own.)</em></td><td>'Ignore'</td></tr><tr><td>Bond condition type*</td><td>The type of conditional check made on the bond. (<em>None:</em> no checks are made. <em>State:</em> checks against the state are made using the conditional checkboxes. <em>Scripted:</em> the 'Bond condition' script is used.)</td><td>'State'</td></tr><tr><td>Bond pending</td><td>Process this message when the bond state is Pending.</td><td>&#x3C;true></td></tr><tr><td>Bond open</td><td>Process this message when the bond state is Open.</td><td>&#x3C;true></td></tr></tbody></table>

*\*These fields are automatically populated.*

*Your Bond form should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MguhKCFLKUJY_4C9KqN%2F-MguohoGRJQyfvX96gSu%2FIAPG%20-%20AddAttachmentInbound%20Message%204.png?alt=media\&token=0586b6d7-30b0-46b3-9ed6-53ef604ba7a8)

Navigate to **Inbound > Settings**.

## Inbound Settings Fields

The Inbound Settings fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="366.0984792655293">Description</th><th>Value</th></tr></thead><tbody><tr><td>Bond reference method*</td><td>Method of searching for and validating an existing bond for incoming messages.</td><td>'Internal'</td></tr></tbody></table>

{% hint style="info" %}
*\*Bond reference method:*

*Internal -* lookup using the internal reference only.

*External -* lookup using the external reference only.

*Both -* lookup using both the internal and external references.
{% endhint %}

{% hint style="success" %}
We have chosen the 'Internal' method because, in the payload we built, we supplied the `correlation_id`.
{% endhint %}

*Your Inbound Settings form should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MguhKCFLKUJY_4C9KqN%2F-MgupeTzPZgek0r0nfV4%2FIAPG%20-%20AddAttachmentInbound%20Message%205.png?alt=media\&token=3a212371-b7aa-461f-8611-e6aa6f3a5969)

Navigate to **Advanced > Script Editor**.

## Script Editor Fields

Click on **View > Inbound**.

The Script Editor fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="150">Description</th><th>Value</th></tr></thead><tbody><tr><td>Payload to Stage (Inbound)</td><td>The script to run.</td><td>Replace the commented out instructions with the code below.</td></tr></tbody></table>

*The code in the 'Payload to Stage' script field should look like this:*

```javascript
(function processPayloadToStage(payload, stage, transaction, message) {

  // set either internal/external reference on stage depending on what is needed.
  // make sure to configure the Bond reference lookup on the Message to be Internal/External

    stage.internal_reference = payload.correlation_id;

})(payload, stage, transaction, message);
```

*Your Script Editor fields should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MguhKCFLKUJY_4C9KqN%2F-Mguqqv47_wFcg9fQxmH%2FIAPG%20-%20AddAttachmentInbound%20Message%206.png?alt=media\&token=f442700d-d770-454f-ae7a-c69b59ac92cf)

Click **Save**.

We can now move on to **Testing**.
