SukiAuthManager and FormFillingClient once, then call client.start() when the clinician opens Form filling.
Prerequisites
Before you begin, confirm you have:- Packages:
@suki-sdk/form-fillingand@suki-sdk/core - Partner credentials:
partnerIdandpartnerTokenfrom Partner onboarding - Template IDs:
template_idUUIDs from your Suki support team forform_template_ids. - Encounter ID: pass your encounter ID as
correlation_id, refer to Configuration for more details. - Browser and layout: HTTPS, microphone access, and a DOM container with explicit height
Integration pattern
Create auth and the client once per page. Open Form filling only when the clinician taps your button.Suki Auth Manager
One
SukiAuthManager after the partner token is available.Form Filling Client
One
FormFillingClient. Reuse it for every start() call on that page.Install the packages
Step 1: Add container HTML
The hosted Form filling UI mounts inside the element you pass asrootElement. That node must have real height, or the iframe looks blank.
HTML
Step 2: Create auth manager
Create oneSukiAuthManager to sign in to Suki. Use the following example code:
JavaScript
Step 3: Create Form filling client
Create oneFormFillingClient and pass the auth manager. Optionally wire onError for configuration and runtime errors.
JavaScript
Step 4: Start a session on user action
When the clinician taps your button, callawait client.start({ ... }) from a click handler after the DOM is ready.
Pass these options to start():
rootElement: Required The container from Step 1.form_template_ids: Requiredtemplate_idUUIDs from your Suki support team.correlation_id: Optional Your encounter or appointment ID. Strongly recommended so results map to the correct record.onSubmit: Required Called when structured JSON is ready after processing, not when the clinician taps submit. Receives aFormFillingResult.onReady,onCancel: Optional
JavaScript
Callbacks and events
Your app needs to know when Form filling is ready, when structured results arrive, and when the clinician cancels. You can handle that in two ways. Option 1: Pass callbacks onstart()
Use this for logic tied to one session. Pass functions on the same object as rootElement and form_template_ids:
Option 2: Listen with
client.on()
Use this for handlers that stay active across many sessions, such as logging, analytics, or a shared error handler. Register once when you create the client:
JavaScript
form-filling:session-started, form-filling:background-submitted (results for a superseded session), and form-filling:error.
Refer to Callbacks for FormFillingResult shape and Events for every event and payload.
Starting another session
When the clinician opens Form filling again, callstart() a second time. The SDK closes the previous session and opens a new one. You do not need stop() first.
Complete code example
Below is a full page example: sign-in, client setup, and a button that opens Form filling.JavaScript
onSubmit returns structured_data.
Best practices
Troubleshooting
Blank UI After `start()`
Blank UI After `start()`
Set height on
#suki-form-container before start(). Add CSP frame-src for https://sdk.suki.ai (production) or https://sdk.suki-stage.com (staging). Refer to Configuration and Prerequisites.`SUKI_FF_001` Immediately
`SUKI_FF_001` Immediately
form_template_ids is empty, or no IDs match your partner account. Pass at least one template_id UUID from Suki support. Refer to Form filling templates.`SUKI_FF_002` Handshake Timeout
`SUKI_FF_002` Handshake Timeout
The iframe did not complete the ready handshake within 10 seconds. Check network, ad blockers, and CSP. Confirm the page uses HTTPS.
`SUKI_FF_003` Fetch Templates Failed
`SUKI_FF_003` Fetch Templates Failed
Auth failed or the wrong environment (staging vs production) while loading the template list. Retry and confirm
partnerId, partnerToken, and environment.`SUKI_FF_004` Iframe Runtime Error
`SUKI_FF_004` Iframe Runtime Error
Microphone permission denied, session start/submit failed, or form generation failed. Read
err.message, show a retry option, and confirm network access.UI Never Opens
UI Never Opens
Sign-in failed before the hosted UI loads. Verify
partnerId and partnerToken for your environment. Refer to Authentication.No `onSubmit` Callback
No `onSubmit` Callback
The clinician closed the processing screen early, or the tab closed before processing finished. Register a partner webhook for server-side delivery.
`onSubmit` Never Maps to Your Encounter
`onSubmit` Never Maps to Your Encounter
Pass your encounter ID as
correlation_id at session start so callbacks and webhooks match the correct record.Log Errors During Development
Log Errors During Development
Wire
onError or client.on("form-filling:error", ...) so errors are visible in the console:JavaScript
Refer to Error handling for the full error code table.
Next steps
Session workflow for single-form vs multi-form behavior Configuration for allstart() options
React integration if you use React