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

# Advanced Flow Features

## Flow Messages

Flows can send messages to your application using the `postMessage` API. Flows send two kinds of messages, the height of the iFrame and the status of the flow. To listen to these messages, you need to set up an event listener in your application.

```javascript theme={null}
window.addEventListener(
  "message",
  (event) => {
    if (!event.origin.startsWith("https://my.dots.dev")) return;

    console.log(event.data);
  },
  false
);
```

When the flow is loaded for the first time, the height of the iFrame is sent to the parent window. The format of the message is

```JSON theme={null}
{
    "height": number
}
```

When each step of the flow is completed, the status of the flow step is sent to the parent window. The format of the message is

```JSON theme={null}
    {
        "step": "background-check",
        "status": "completed"
    }
```

The status is `completed` for every step except for `manage-payouts` where it will be `completed-saved` in the case the user saves the settings without updating any settings.
