These events are deprecated and will be removed in a future version. They
are still dispatched for backward compatibility, but you should migrate to the
new event format as soon as possible.
Overview
The legacy event system uses the CORTI_EMBEDDED_EVENT wrapper format with camelCase event names. These events are still sent alongside the new dot-notation events, but support will be removed in a future release.
Legacy Event Structure
All legacy events follow this structure:
{
type: 'CORTI_EMBEDDED_EVENT', // Always this value for legacy events
event: string, // camelCase event name (e.g., 'recordingStarted')
deprecated: true, // Always true for legacy events
payload?: object // Optional event-specific data
}
New Event Structure
The new event format uses dot-notation event names and includes a confidential field:
{
type: 'CORTI_EMBEDDED_EVENT', // Same wrapper as legacy format
event: string, // Dot-notation event name (e.g., 'recording.started')
confidential: boolean, // Indicates if payload contains sensitive data
payload: object // Event-specific data with new structure
}
Migration Path
When migrating from legacy events to the new format:
- Update your event names from camelCase to dot-notation (e.g.,
recordingStarted → recording.started)
- Handle the new
confidential field in events
- Update payload structures to match the new format (see individual event pages)
- Remove checks for
deprecated: true field (not present in new events)
The CORTI_EMBEDDED_EVENT type wrapper remains the same in both legacy and
new formats. You still check for event.data?.type === 'CORTI_EMBEDDED_EVENT'
- only the event names and payload structures have changed.
You can use the deprecated: true field to programmatically detect and log
warnings for legacy events in your integration, helping you track migration
progress.
Legacy Events Reference
ready
Emitted when the embedded app is loaded and ready to receive messages.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'ready',
deprecated: true,
payload?: {}
}
Replacement: Use embedded.ready instead.
loaded
Emitted when navigation to a specific path has completed.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'loaded',
deprecated: true,
payload: {
path: string
}
}
Replacement: Use interaction.loaded instead.
recordingStarted
Emitted when recording has started.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'recordingStarted',
deprecated: true,
payload?: {}
}
Replacement: Use recording.started instead.
recordingStopped
Emitted when recording has stopped.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'recordingStopped',
deprecated: true,
payload?: {}
}
Replacement: Use recording.stopped instead.
documentGenerated
Emitted when a document has been generated.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'documentGenerated',
deprecated: true,
payload: {
document: {
id: string,
name: string,
templateRef: string,
// ... (see getStatus response for full document structure)
}
}
}
Replacement: Use document.generated instead.
documentUpdated
Emitted when a document has been updated.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'documentUpdated',
deprecated: true,
payload: {
document: {
id: string,
name: string,
templateRef: string,
// ... (see getStatus response for full document structure)
}
}
}
Replacement: Use document.updated instead.
documentSynced
Emitted when a document has been synced to EHR.
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'documentSynced',
deprecated: true,
payload: {
document: {
id: string,
name: string,
templateRef: string,
// ... (see getStatus response for full document structure)
}
}
}
Replacement: Use document.synced instead.
usage
Emitted when credits have been consumed because of either of these triggers:
- Ending/pausing a recording: credits consumed for transcription and fact extraction
- Ending dictation: credits consumed for transcription
- Generating a document: credits consumed for text generation
{
type: 'CORTI_EMBEDDED_EVENT',
event: 'usage',
payload: {
creditsConsumed: 0.13,
}
}
This value is not accumulative and only refers to the latest trigger.
Replacement: Use account.creditsConsumed instead.
Listening for Legacy Events
window.addEventListener("message", (event) => {
if (event.data?.type === "CORTI_EMBEDDED_EVENT") {
switch (event.data.event) {
case "ready":
console.log("Embedded app ready");
break;
case "loaded":
console.log("Navigation completed:", event.data.payload.path);
break;
case "documentGenerated":
console.log("Document generated:", event.data.payload.document);
break;
case "documentUpdated":
console.log("Document updated:", event.data.payload.document);
break;
case "documentSynced":
console.log("Document synced:", event.data.payload.document);
break;
case "recordingStarted":
console.log("Recording started");
break;
case "recordingStopped":
console.log("Recording stopped");
break;
default:
console.log("Unknown event:", event.data.event);
}
}
});
Timeline
- Current: Both legacy and new events are dispatched
- Future: Legacy events will be removed (date TBD)
- Action Required: Migrate to new event format before legacy support is removed