SukiAuthManager and FormFillingClient once inside useMemo, wrap your tree with FormFillingProvider, and render FormFilling when the clinician opens Form filling.
Prerequisites
Before you start:- Install
@suki-sdk/form-filling-reactand@suki-sdk/core(Form filling SDK v0.1.0-beta.3 or later for dynamic forms). - 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 Medical form templates (ask Suki support for the template IDs), your own form
schema, or both. See Dynamic Form filling. - Have an encounter ID ready to pass as
correlation_id. - Run the app over HTTPS, with microphone access, and a container with height for the Form filling UI.
Integration pattern
Create auth and the client once per page insideuseMemo. Mount FormFilling only when the clinician is ready to open Form filling.
Suki Auth Manager
One
SukiAuthManager after the partner token is available.Form Filling Client
One
FormFillingClient in useMemo. Reuse it for every session on that page.FormFillingProvider
Wrap the part of your tree that renders
FormFilling.Conditional FormFilling
Mount
FormFilling only while Form filling should be open.Do not run
new FormFillingClient(...) on every render. Use useMemo with stable dependencies.Install the packages
Step 1: Style the container
React renders the hosted UI inside.suki-form-filling. Give that container explicit height, or the iframe looks blank.
CSS
Step 2: Create auth manager and client in useMemo
Create both objects once per page insideuseMemo. Optionally wire onError on the client for configuration and runtime errors.
React
Step 3: Wrap with FormFillingProvider
Pass theclient from Step 2 into FormFillingProvider. Every component that renders FormFilling must be a child of that provider.
React
FormFillingProvider at app root or only around the encounter screen that needs Form filling.
Step 4: Render FormFilling when the clinician opens Form filling
Use state (for exampleisFormOpen) so FormFilling mounts only while Form filling should be visible. When it unmounts, the SDK tears down the hosted UI.
Pass the same session fields you would pass to client.start(), except rootElement (React supplies the container):
formsorform_template_ids: Required At least one form after resolve. Preferformsfor Suki template IDs, your ownschema, or both.form_template_idsis deprecated, but still works whenformsis omitted.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.onBackgroundSubmit: Optional React only. Results for a superseded session while the iframe is still open.
React
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 props onFormFilling
Use this for logic tied to one session. Props mirror client.start() callbacks:
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 in useMemo:
React
form-filling:session-started, form-filling:background-submitted, 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, mountFormFilling again (for example set isFormOpen back to true). You do not need a new FormFillingClient. Mount only one FormFilling at a time per client.
useFormFilling hook
InsideFormFillingProvider, use useFormFilling() to read session state and errors in sibling components:
React
Complete code example
Below is a full page example: sign-in, client setup inuseMemo, provider wiring, and a button that opens Form filling.
React
onSubmit returns structured_data.
Best practices
Troubleshooting
Blank Form Filling Area
Blank Form Filling Area
Set CSS height on
.suki-form-filling. Add CSP frame-src for https://sdk.suki.ai (production) or https://sdk.suki-stage.com (staging). Refer to Configuration and Prerequisites.Session Resets or Flickers
Session Resets or Flickers
Do not create
FormFillingClient on every render. Keep one client in useMemo and pass the same instance to FormFillingProvider.Multiple Sessions Conflict
Multiple Sessions Conflict
Mount only one
FormFilling at a time per client. Unmount the previous session before starting another.SUKI_FF_001 Immediately
SUKI_FF_001 Immediately
No forms after resolve, invalid XOR entries, duplicate IDs, or no matching static IDs with no valid dynamic entries. Prefer
forms. Refer to Error handling and Dynamic Form filling.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.Late Results After Offline Submit
Late Results After Offline Submit
Handle
onBackgroundSubmit on FormFilling or listen for form-filling:background-submitted on the client.Log Errors During Development
Log Errors During Development
Wire
onError on the client, useFormFilling() error, or client.on("form-filling:error", ...):React
Refer to Error handling for the full error code table.
Next steps
Basic usage example - A fuller sample withuseFormFilling.
Session workflow - Single-form vs multi-form behavior.
Configuration - All FormFilling props.
Javascript integration - Plain JavaScript.