await formFillingClient.start({ ... }) from your own code when the clinician is ready.
Use this approach if you are building with vanilla JavaScript, or another non-React framework, and want to control when and where Form filling appears in your interface.
Let’s get started!
Prerequisites
Before you start:- Install
@suki-sdk/jsand@suki-sdk/coreor update to the latest version. - Get your
partnerIdfrom Partner onboarding. Pass apartnerToken(JWT from your identity provider) with that Partner ID to sign in. - Decide which forms to fill: Suki defined form templates (ask Suki support for the template IDs), your own form
schema, or both. Refer to Dynamic Form filling. - Have an encounter ID ready to pass as
correlation_id. - Run the app in a browser over HTTPS, with microphone access, and a container with height for the Form filling UI.
Install the packages
Add both packages to the same project you load in the browser: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
Now create the Auth Manager. You need yourpartnerId from Partner onboarding and a partnerToken (JWT from your identity provider).
Create one auth manager for the page (or app shell).
Code example for creating auth manager
JavaScript
Step 3: Create Form filling client
After you have created the auth manager, you can create the Form filling client for your application. The Form filling Client is the object that will be used to start the Form filling session. Create one Form filling client and reuse it for everystart() call on that page.
Code example for creating Form filling client
JavaScript
Step 4: Call start() to open Form filling
Now you can start the Form filling session by calling thestart() method on the Form filling client.
Call await formFillingClient.start({ ... }) from a click handler (or similar) when the DOM is ready.
Pass rootElement, forms, onSubmit, and any optional fields you need. In forms, use Suki template IDs, your own schema, or both. Refer to Configuration for the full option list.
Code example for starting Form filling (static + dynamic)
JavaScript
onSubmit is required. It runs when structured JSON is ready after processing, not when the clinician taps submit in the hosted UI.start() does not throw errors. If something goes wrong, the SDK calls onError on FormFillingClient (or the form-filling:error event). Set that up when you create the client in Step 3.Callbacks
You can passonReady, onSubmit, and onCancel on start(), or listen with formFillingClient.on() for handlers that stay active across many sessions:
JavaScript
FormFillingResult shape and Events for every event and payload.
Starting another session
Callingstart() again replaces the active session. You do not need to call stop() manually just to open Form filling again:
JavaScript
Complete code example
Below is a complete code example in JavaScript for Form filling with a single container and button.JavaScript
onSubmit returns structured_data.
Best practices
Next steps
Configuration -forms, correlation_id, and callbacks.
Dynamic Form filling - XOR rules, schema shapes, and mixed sessions.
React integration - Integrate Form filling in a React application using the Suki Web SDK.