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:

EventpostMessage System Event KeyOccurs when...Payload
User Login Embedded Applicationuser.embedded_loginA user has logged into the embedded app via an authentication token.{event_key}
Employee Submitted a Formemployee.form_submittedAn employee submits a form.{event_key, occured_at, data: {employee, submission}}
Employee I-9 Supplement B Updatedemployee.i9_submission.supplement_b.updatedAn administrator has updated the Form I-9 Supplement B.{event_key}
Employee I-9 Supplement B Updated Cancelledemployee.i9_submission.supplement_b.update_cancelledAn administrator has cancelled the update of the Form I-9 Supplement B.{event_key}
Employee Submitted W-4 Formemployee.w4_submission.submittedAn employee has submitted a W-4 Form.{event_key}
Submission Countersigned by Adminadmin.i9_submission.countersignAn admin has countersigned a submission.{event_key}
Admin Reviewed Document Verification Resultsadmin.i9_submission.document_verification.reviewedAn admin has marked document verification results as reviewed.{event_key}
Employee Submitted I-9 Formemployee.i9_submission.submittedAn employee has submitted a Form I-9.{event_key} {document_verification_results}
Page Loadedpage.loadedIndicates 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}