postMessage API Events
A postMessage API enables you to listen to certain events that happen within WorkBright between the embedded iframe and the parent window. When an event happens, a window.addEventListener can be used to register an event listener for a specific event type. In this case, when the iframe sends the message using postMessage, the parent window recieves it. The event listener listens for the message event, and when it happens, it logs the data from the message.
Configuration
When embedding WorkBright within an iframe, the PostMessage API enables your application to listen for real-time events emitted from the embedded experience. WorkBright sends these events using window.postMessage, and your application can capture them by registering a window.addEventListener('message', ...) listener in the parent window. Each message includes an event_key and optional data payload that you can use to trigger actions such as updating UI state, syncing with your backend, or tracking user progress. No configuration is required within WorkBright to enable this—developers would simply need to implement a message listener and handle events appropriately.
Events
The followingpostMessageAPI events are currently available:
| Event | postMessage System Event Key | Occurs when... | Payload |
|---|---|---|---|
| User Login Embedded Application | user.embedded_login | A user has logged into the embedded app via an authentication token. | {event_key} |
| Employee Submitted a Form | employee.form_submitted | An employee submits a form. | {event_key, occured_at, data: {employee, submission}} |
| Employee I-9 Supplement B Updated | employee.i9_submission.supplement_b.updated | An administrator has updated the Form I-9 Supplement B. | {event_key} |
| Employee I-9 Supplement B Updated Cancelled | employee.i9_submission.supplement_b.update_cancelled | An administrator has cancelled the update of the Form I-9 Supplement B. | {event_key} |
| Employee Submitted W-4 Form | employee.w4_submission.submitted | An employee has submitted a W-4 Form. | {event_key} |
| Submission Countersigned by Admin | admin.i9_submission.countersign | An admin has countersigned a submission. | {event_key} |
| Admin Reviewed Document Verification Results | admin.i9_submission.document_verification.reviewed | An admin has marked document verification results as reviewed. | {event_key} |
| Employee Submitted I-9 Form | employee.i9_submission.submitted | An employee has submitted a Form I-9. | {event_key} {document_verification_results} |
| Page Loaded | page.loaded | Indicates that a page has loaded within the I-Frame both in the Employee and Administrator view. Provides the event key and href of the page that has been loaded. | {event_key} {href} |
Updated 28 days ago
