Quick summary
The Suki Dictation SDK supports three callbacks:
onSubmit, onCancel, and onDraft. These callbacks are called when the user commits, cancels, or drafts the dictation respectively. You can use these callbacks to handle the dictation result, cancel the session, or receive intermediate updates while the user is dictating.DictationClient.show(), or in React as props on <Dictation>.
Callback execution
It calls onSubmit after the user commits, and onCancel if they leave without committing. If you supply onDraft, the SDK may call it when the user does not submit and switches to another field (or otherwise moves on without committing). onDraft is not invoked on every live transcript change while dictation stays on one field. The SDK does not persist draft text to your systems; only your onDraft handler decides whether to store or send it to your partner backend.
Payload
Every callback receives the same argument: one object, { fieldId, text }. The fieldId value is whatever you passed into show() or <Dictation>. A common pattern is to set it to the same value as the target control’s id, so onSubmit can use document.getElementById(fieldId) and write text into that element.
Supported callbacks
Dictation SDK supports the following callbacks: Mode controls how dictation is shown. Set it toin-field when the UI is tied to a container on your page, or scratchpad for a standalone surface. Refer to In-field mode and Scratchpad mode guides for behavior and layout.
Callback contract payload shape
All callbacks receive a single argument: an object with these fields:Code examples
Use callbacks as properties on the object you pass to
await dictationClient.show({ ... }). They sit alongside mode, fieldId, rootElement, initialText, and other options from Configuration.The iframe resizes to the container you pass as rootElement when you use in-field mode.JavaScript
Calling
show() again replaces the active session; you do not need to call hide() between fields for that pattern. Wrap show() in try / catch if you want to log configuration or auth failures.Refer to the Error handling guide for more details.