Message Event

General Concept

These events are fired by the iframe to help maintain synchronization between the iframe and the embedding frame.

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://uat.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://uat.empego.ca") {
        // Handle the message
        console.log(event.data);
    }
});

Export Event

Triggered when an export operation occurs, this event returns the PDF summary and textual summary for the consultation or follow-up.

Data

The data property of the Message includes this information :

Consultation - Export:

Field Value(s)
id Unique identifier of the Consultation
createdAt UTC Timestamp
eventType consultation
operation [exportInProgress, exportReady]
tenantKey UUID

Follow up - Export :

Field Value(s)
id Unique identifier of the Follow-up
createdAt UTC Timestamp
data Export in progress \ Export ready
eventType followup
operation [exportInProgress, exportReady]
tenantKey UUID

Examples :

Data processing

{
  "eventType": "consultation",
  "id": "xxx-xx-xx-xx-xxxxxxxxx",
  "operation": "exportInProgress",
  "tenantKey": "xxxxxxxx-xx-xx-xx-xxxxxxx",
  "createdAt": 1779214387288
}

Data ready

{
  "data": {
    "pdfSummary": {
      "fileURL": "https://artifacts.empego-dev-staging.name/xxxxxxxxx",
      "fileURLExpiry": 1779214478522,
      "status": "SUCCESS"
    },
    "textualSummary": {
      "content": "example",
      "status": "SUCCESS"
    }
  },
  "eventType": "consultation",
  "id": "xxx-xx-xx-xx-xxxxxxxxx",
  "operation": "exportReady",
  "tenantKey": "xxxxxxxx-xx-xx-xx-xxxxxxx",
  "createdAt": 1779214387288
}

Data Failed to fetch

{
  "data": {
    "pdfSummary": {
      "status": "FAILURE"
    },
    "textualSummary": {
      "content": "example",
      "status": "SUCCESS"
    }
  },
  "eventType": "consultation",
  "id": "xxx-xx-xx-xx-xxxxxxxxx",
  "operation": "exportReady",
  "tenantKey": "xxxxxxxx-xx-xx-xx-xxxxxxx",
  "createdAt": 1779214387288
}

Dashboard Polling Event

Returns the number of items in each swimlane after every dashboard polling cycle, which occurs every 30 seconds or whenever a swimlane update is detected.

Data

The data property of the Message includes this information :

Consultation - Polling:

Field Value(s)
createdAt UTC Timestamp
data Dashboard polling
eventType consultation
operation dashboardPolling
tenantKey UUID

Follow up - Polling :

Field Value(s)
createdAt UTC Timestamp
data Dashboard polling
eventType followup
operation dashboardPolling
tenantKey UUID

Example :

Polling Data

{
  "data": {
    "toBeAnalyzedCount": 23,
    "inProgressCount": 12,
    "doneCount": 0
  },
  "eventType": "consultation",
  "operation": "dashboardPolling",
  "tenantKey": "xxxxxxxx-xx-xx-xx-xxxxxxx",
  "createdAt": 1779214387290
}