> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostMessage Events

A postMessage is an event-based protocol that allows partners to take action in their own codebase in response to events triggered within a widget’s user interface. They are intended specifically to allow a partner’s code and a widget user interface to work in concert, not to give a full picture of events happening on MX servers. PostMessage events should not be used for keeping data in sync between platforms.

Events from MX will have the properties `mx`, `type`, and `metadata`.

The `mx` field is provided as an easy way for partners to filter out postMessage events coming from MX.

The `type` field identifies what the event represents at a high level. This field is a string with the format `mx/microdeposits/<event>`.

The `metadata` field is an object that has information related to the `type` that may be important, such as the, `microdeposit_guid`, `user_guid` etc.

## Account Details Submitted

Triggered when a user submits account details for a given institution for the first time and a microdeposit object is created on the MX platform.

```
{
  "type": "mx/connect/microdeposits/detailsSubmitted",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123",
    "microdeposit_guid": "MIC-123"
  }
}
```

## Blocked Routing Number

Triggered when the end user submits a blocked routing number on the ender details step.

| Reason           | Definition                                                                                                                                                     |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BLOCKED`        | MX has blocked this routing number. Neither microdeposit verification nor IAV can proceed.                                                                     |
| `CLIENT_BLOCKED` | An MX client has requested that this routing number be blocked. Neither microdeposit verification nor IAV can proceed.                                         |
| `IAV_PREFERRED`  | The institution associated with the routing number wishes to only support IAV and not microdeposits. The end user will be automatically taken to the IAV flow. |

```
{
  "type": "mx/connect/microdeposits/blockedRoutingNumber",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123",
    "routing_number": "123456789", # This is the user-entered routing number
    "reason": "BLOCKED",
  }
}
```

## Microdeposit Come Back, Primary Action Selected

Triggered when user selects the primary button on the come back step.

```
{
  "type": "mx/connect/microdeposits/comeBack/primaryAction",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123"
  }
}
```

## Microdeposit Error, Primary Action Selected

Triggered when user selects the primary button on the microdeposit errors step for a PREVENTED status.

```
{
  "type": "mx/connect/microdeposits/error/primaryAction",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123",
    "microdeposit_guid": "MIC-123",
    "microdeposit_status": "PREVENTED"
  }
}
```

## Microdeposit Flow Loaded

Triggered when the microdeposit flow is loaded in Connect.

```
{
  "type": "mx/connect/microdeposits/loaded",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123",
    "initial_step": "enterDetails"
  }
}
```

## Microdeposit Verified

Triggered when a user successfully verifies the microdeposit amounts.

```
{
  "type": "mx/connect/microdeposits/verified",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123",
    "microdeposit_guid": "MIC-123"
  }
}
```

## Microdeposit Verified, Primary Action Selected

Triggered when user selects the primary button on verified step.

```
{
  "type": "mx/connect/microdeposits/verified/primaryAction",
  "mx": true,
  "metadata": {
    "user_guid": "USR-123",
    "session_guid": "ANS-123"
  }
}
```
