Message Event
General Concept
The message event is triggered during a state transition of the Empego’s entities. This event is fired from the iframe to inform the embedding frame of the new state.
Usage
Using either addEventListener()
or the onmessage
method, the parent frame can handle these events accordingly. Since postMessage()
enables cross-orgin communication, it is recommended to filter messages that have https://app.empego.ca
in the origin
property of the Message
. ( Refer to the official security documentation for more details).
Example:
window.addEventListener("message", function (event) {
if (event.origin === "https://app.empego.ca") {
// Handle the message
console.log(event.data);
}
});
Data
The data
property of the Message includes this information :
Consultation :
Field | Value(s) |
---|---|
id | Unique identifier of the Consultation |
createdAt | UTC Timestamp |
data | Consultation data |
eventType | consultation |
operation | [create, update, sync] |
status | Consultation Status |
tenantKey | UUID |
Follow up:
Field | Value(s) |
---|---|
id | Unique identifier of the Follow-up |
createdAt | UTC Timestamp |
data | Follow-up data |
eventType | followup |
status | Follow-up Status |
operation | [create, update, sync] |
tenantKey | UUID |
Example :
{
"origin": "https://app.empego.ca",
"data": {
"evenType": "consultation",
"operation": "update",
"status": "TO_BE_ANALYZED",
"id": "8c4abd06-6b12-4574-9b94-972d63294ddf"
},
"type": "message",
"timestamp": 19958.90000000596
}