---
description: >-
  We will configure another inbound update type Message to process the
  attachment data returned from the poll and update our target record.
---

# AddAttachmentInbound Message

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

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MRVpauamU6P8A6RI_zH%2F-MRVq_U0BWFfOtHkWwoH%2FAddAttachmentInbound%201.png?alt=media\&token=e923da84-25c5-4a64-aca6-3d639482ab41)

## New Message Modal

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

|  #  | Field        | Description                                                         | Value                  |
| :-: | ------------ | ------------------------------------------------------------------- | ---------------------- |
|  1  | Message name | The message name that is unique for this integration.               | 'AddAttachmentInbound' |
|  2  | Type         | The primary purpose of the message.                                 | 'Update'               |
|  3  | Direction    | The direction(s) this message is configured to support.             | 'Inbound'              |
|  4  | Description  | The description for this message and the requirement it is meeting. | \<Your description>    |

_Your AddAttachmentInbound New Message modal should look like this:_

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MRVpauamU6P8A6RI_zH%2F-MRVqp11AMSNM7ZtFv_V%2FAddAttachmentInbound%202.png?alt=media\&token=8e086fa2-272e-45d1-b5fe-4b0eb6727523)

5\) Click **Submit and view** to further configure the Message.

## Response Fields

Navigate to **Message > Response**.

The Response fields to be configured are as follows:

|  #  | Field    | Description                                                                                                                              | Value                 |
| :-: | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|  6  | Response | The immediate synchronous response to this message.                                                                                      | \<lookup: 'Response'> |
| 7\* | Async    | Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asynchronous message pair. | \<false>              |

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

_Your Response form should look like this:_

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MRVpauamU6P8A6RI_zH%2F-MRVr3Aoqkm6-a74BxiA%2FAddAttachmentInbound%203.png?alt=media\&token=21c6594c-24ab-40f5-94b0-35068975635a)

8\) Navigate to **Message > Bond**.

## Bond Fields

The Bond fields to be configured are as follows:

|  #  | Field               | Description                                                                                                                                                                                                 | Value    |
| :-: | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|  \* | Bond ownership      | 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.  _(Choices: Ignore, Must own, Must not own.)_           | 'Ignore' |
|  \* | Bond condition type | The type of conditional check made on the bond. (_None:_ no checks are made. _State:_ checks against the state are made using the conditional checkboxes. _Scripted:_ the 'Bond condition' script is used.) | 'State'  |
|  9  | Bond pending        | Process this message when the bond state is Pending.                                                                                                                                                        | \<true>  |
|  10 | Bond open           | Process this message when the bond state is Open.                                                                                                                                                           | \<true>  |

_\*These fields are automatically populated._

_Your Bond form should look like this:_

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MRVpauamU6P8A6RI_zH%2F-MRVrHGquN0hBlNgUvwl%2FAddAttachmentInbound%204.png?alt=media\&token=20431ac8-483a-478b-ae3e-fbc438effce9)

11\) Navigate to **Inbound > Settings**.

## Inbound Settings Fields

The Inbound Settings fields to be configured are as follows:

|  #  | Field                   | Description                                                                    | Value      |
| :-: | ----------------------- | ------------------------------------------------------------------------------ | ---------- |
|  12 | Bond reference method\* | Method of searching for and validating an existing bond for incoming messages. | 'Internal' |

{% 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://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MRVpauamU6P8A6RI_zH%2F-MRVse9G40TZRPTrUEKP%2FAddAttachmentInbound%205.png?alt=media\&token=4a8d6156-79b9-4668-ab1e-51064935967c)

13\) Navigate to **Advanced > Script Editor**.

## Script Editor Fields

Click on **View > Inbound**.

The Script Editor fields to be configured are as follows:

|  #  | Field                      | Description        | Value                                                       |
| :-: | -------------------------- | ------------------ | ----------------------------------------------------------- |
|  14 | Payload to Stage (Inbound) | The script to run. | Replace the commented out instructions with the code below. |

_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://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MRVpauamU6P8A6RI_zH%2F-MRVt0d6NMnmEMUM3AlT%2FAddAttachmentInbound%206.png?alt=media\&token=6697db2c-0e4a-4691-aa8e-45cdbe87ad64)

15\) Click **Save**.

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