Installation
This SDK is a vanilla JavaScript library that renders the MeetingDoctors web client on your page. To integrate it, you need:
- Add the SDK script.
- Create a container element in your HTML.
Methods
Initialization
Call the global window.MeetingDoctors.init(config)
method once your page is ready:
Initialization
window.MeetingDoctors.init({
widgetId: "<WIDGET_ID>",
companySlug: "<COMPANY_SLUG>",
companyId: "<COMPANY_ID>",
lang: "en",
displayMode: "embed",
containerId: "root",
authType: "sso",
token: "<SSO_TOKEN>", // required if authType is `sso`
// Optional SSO-only parameters:
isolatedView: {
type: "chat", // enum: "chat" | "video_call" | "medical_history"
data: {
specialtyId: 1, // integer ID of a specialty required by type "chat"
// or
specialtyCode: "general" // string code of a specialty required by type "video_call"
}
}
});
Logout
To log the user out and clear the session, call:
Logout
window.MeetingDoctors.logout();
On
To listen for SDK events, use the on
method:
Event Listener
window.MeetingDoctors.on("meeting_doctors_ready", (data) => {
// The SDK is fully loaded and ready
});
Off
To stop listening to an event, use the off
method:
Remove Event Listener
window.MeetingDoctors.off("meeting_doctors_ready");
Example Implementation
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body style="width:100%;height:100vh;margin:0;padding:0;display:grid;place-items:center;background-color:#f0f0f0;">
<!-- Container -->
<div id="root"
style="height:667px;width:375px;box-shadow:0 0 10px rgba(0,0,0,0.5);border-radius:8px;overflow:hidden;background-color:#fff;">
</div>
<!-- MeetingDoctors SDK -->
<script type="module" src="https://widget.staging.meetingdoctors.com/sdk/latest/static/js/index.js"></script>
<!-- SDK Initialization -->
<script>
document.addEventListener("DOMContentLoaded", function () {
window.MeetingDoctors.init({
widgetId: "<WIDGET_ID>",
companySlug: "<COMPANY_SLUG>",
companyId: "<COMPANY_ID>",
lang: "<LANGUAGE>",
displayMode: "embed",
containerId: "root",
authType: "sso",
token: "<SSO_TOKEN>"
// Optional SSO-only parameters:
isolatedView: {
type: "chat",
data: {
specialtyId: 1
}
}
});
});
</script>
</body>
</html>
note
Replace <SSO_TOKEN>
with the SSO authentication token retrieved from MeetingDoctors API. e.g: bearer eyJ0eX...
(it should contain the authentication type, e.g., bearer
).
Configuration Parameters
Key | Required | Type | Description | Provided by MeetingDoctors |
---|---|---|---|---|
widgetId | Yes | string | Widget identifier | Yes |
companySlug | Yes | string | URL-friendly company slug | Yes |
companyId | Yes | string | Unique company ID | Yes |
lang | Yes | string | Language code (e.g., en , es , etc.) | No |
displayMode | Yes | enum(embed ) | Presentation mode of the SDK | No |
authType | Yes | enum(sso , email , phone ) | Authentication method | No |
token | Conditionally (if authType is sso ) | string | SSO authentication token | No |
containerId | Conditionally (when displayMode: embed ) | string | DOM element ID where the SDK will be rendered | No |
Optional Parameters (SSO only)
Key | Type | Description |
---|---|---|
isolatedView | object | Configure an isolated view: must include type and optional data . |
isolatedView.type | enum(chat , video_call , medical_history ) | Type of isolated view. |
isolatedView.data.specialtyId | integer | Required by type chat . References a specialty ID in MeetingDoctors. |
isolatedView.data.specialtyCode | string | Required by type video_call . References a specialty code in MeetingDoctors. |