Skip to main content
This guide walks you through integrating the Form filling SDK in a JavaScript application. You create 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-filling and @suki-sdk/core
  • Partner credentials: partnerId and partnerToken from Partner onboarding
  • Template IDs: template_id UUIDs from your Suki support team for form_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
Refer to Prerequisites for webhooks and CSP.

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 as rootElement. That node must have real height, or the iframe looks blank.
HTML
Refer to Configuration for recommended CSS.

Step 2: Create auth manager

Create one SukiAuthManager to sign in to Suki. Use the following example code:
JavaScript
Refer to Authentication for provider fields and other sign-in options.

Step 3: Create Form filling client

Create one FormFillingClient 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, call await 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: Required template_id UUIDs 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 a FormFillingResult.
  • 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 on start() 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
Common events include 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, call start() 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
Your integration works when the Form filling UI appears, the microphone is active, and onSubmit returns structured_data.

Best practices

  • Reuse one client and one auth manager for the page. Do not create a new FormFillingClient on every click.
  • Pass onSubmit. It is required. Map structured_data.generated_values to your EHR or backend.
  • Pass correlation_id. Use your encounter ID so callbacks and webhooks match the correct record.
  • Register a partner webhook for production saves on your server, not browser onSubmit alone.
  • Give the container height before start(). Zero height is the most common cause of a blank UI.
  • Use template IDs from Suki support. The SDK validates IDs at start() and drops unsupported values.

Troubleshooting

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.
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.
The iframe did not complete the ready handshake within 10 seconds. Check network, ad blockers, and CSP. Confirm the page uses HTTPS.
Auth failed or the wrong environment (staging vs production) while loading the template list. Retry and confirm partnerId, partnerToken, and environment.
Microphone permission denied, session start/submit failed, or form generation failed. Read err.message, show a retry option, and confirm network access.
Sign-in failed before the hosted UI loads. Verify partnerId and partnerToken for your environment. Refer to Authentication.
The clinician closed the processing screen early, or the tab closed before processing finished. Register a partner webhook for server-side delivery.
Pass your encounter ID as correlation_id at session start so callbacks and webhooks match the correct record.
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 all start() options React integration if you use React
Last modified on July 23, 2026