PostMessage reference
warning
This specification is a reference for partners that are writing the integration code manually, if you are using the sdk instead reference the sdk api
Message Structure
Each message from the Melio web application to the host application or vice versa has a json stringified payload with the following structure:
{
"type": "<MessageType>",
"messageId": "<uuid>",
...type based payload
}
The additional payload is based on the message type, a list of different message types and their relevant additional payload can be found in the Resources section.
Messages
{
"type": "<MessageType>",
"messageId": "<uuid>",
...additional payload
}
| Type | Origin | Description | Additional payload params |
|---|---|---|---|
| NAVIGATED_TO_TARGET | Melio | Indicating that the application changed target | target |
| CONTENT_SIZE_CHANGE | Melio | Indicating that the content size of the iframe changed | height, width |
| SCROLL_TO | Melio | Indicating that user performed action requiring scroll | scrollX, scrollY, preventScroll |
| EXIT_REQUESTED | Melio | Indicating that the user requested to leave the Melio application | originator |
| AUTHENTICATION_ERROR | Melio | Sent when an error happens during initial authentication | reason message |
| SESSION_EXPIRED | Melio | Sent when the user's session has expired | |
| USER_ACTIVE_PING | Melio | Sent periodically while the user is still interacting with the application | |
| NAVIGATE_REQUEST | Host | Request from the host to the iframe to change target | target |
| USER_SCROLL | Host | Message should be sent when user scrolls the host application | relativeScrollX, relativeScrollY |
| DIMENSIONS_CHANGED | Host | Message should be sent when the window resizes, on load, and whenever the iframe element might change position or dimensions | windowHeight, windowWidth, elementDistanceFromTop, elementDistanceFromLeft |