Partner Widget
Embed Scribeberry in your product via iframe and postMessage.
Embed the Scribeberry app in an iframe. Each clinician uses their own Scribeberry account and subscription — they can create or link an account the first time they open the widget from your product.
Contact partnerships@scribeberry.com for a partner key and to register your allowed domains.
1. Mint a token
Server-side only. Never expose your partner key to the browser.
Response: { "success": true, "data": { "token": "...", "expiresAt": "..." } }
| Field | Required | Description |
|---|---|---|
userEmail | Yes | Clinician email for account create/link |
emrUserId | Yes | Your stable user id |
emrSessionId | Yes | Your session/encounter id — opens the same scribe on relaunch; omit only if you want clinicians to pick scribes manually |
2. Embed the iframe
Tokens expire after 24 hours by default. First-time users complete signup inside the iframe; returning users are signed in via userEmail + emrUserId.
3. postMessage handler
Always check event.origin === 'https://app.scribeberry.com'.
Send PATIENT_CONTEXT again when the patient or chart changes. Clinicians can exclude individual context items in the widget UI before generating a note.
noteConfig
Add to PATIENT_CONTEXT to define note shape via ordered section labels. Scribeberry resolves an internal template from those labels and returns structured fields in PUSH_NOTE.sections.
| Field | Required | Description |
|---|---|---|
sections | Yes | Ordered note sections. key values are returned on PUSH_NOTE.sections; label values drive generation headings and template resolution. |
Do not send template UUIDs. Same ordered labels reuse the same resolved template. Classic SOAP labels (Subjective / Objective / Assessment / Plan) resolve to Scribeberry’s curated SOAP note. Other shapes get a synthetic heading-based template. If noteConfig is omitted, SOAP is used.
Template selection is locked when noteConfig is set.
Patient object
Send on PATIENT_CONTEXT.patient. id and name are required. If validation fails, the widget posts WIDGET_ERROR with code INVALID_PATIENT_DATA and field-level details.
| Field | Required | Description |
|---|---|---|
id | Yes | Your stable patient identifier. Returned on PUSH_NOTE.patientId. |
name | Yes | Patient full name |
dob | No | YYYY-MM-DD |
gender | No | male, female, other, or unknown (case-insensitive) |
firstName, lastName, healthCardNumber, email, phone | No | Optional demographics |
See Widget API Reference for complete schemas, types, enum values, and all postMessage payloads.
SET_CONTEXT
Append or overwrite free-text context:
Token refresh
On TOKEN_EXPIRING or REQUEST_TOKEN_REFRESH, mint a new token server-side and send TOKEN_REFRESH. On TOKEN_EXPIRED, reload the iframe with a new token.
Messages
You → Scribeberry
| Message | When |
|---|---|
PATIENT_CONTEXT | Chart open or patient change |
SET_CONTEXT | Extra text context |
TOKEN_REFRESH | New token after refresh |
CLOSE_WIDGET | User leaves chart |
Scribeberry → you
| Message | When |
|---|---|
WIDGET_READY | Ready for PATIENT_CONTEXT |
SESSION_STARTED | Scribe opened (when emrSessionId used) |
PUSH_NOTE | Clinician sent note |
PUSH_DOCUMENT | Clinician sent document |
TOKEN_EXPIRING | Refresh soon |
TOKEN_EXPIRED | Reload iframe |
REQUEST_PATIENT_CONTEXT | Widget needs patient data |
WIDGET_ERROR | Invalid PATIENT_CONTEXT (see code + message) |