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 dataproperty of the Message includes this information :

Consultation :

Field Value(s)  
eventType consultation  
operation create ` ` update
status Consultation Status  
id Unique identifier of the Consultation  

Follow up:

Field Value(s)  
eventType followUp  
operation create ` ` update
status Follow-up Status  
id Unique identifier of the Follow-up  

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
....