Skip to main content
Complete reference for the SynapseSDK class and the public exports of @eka-care/medassist-core.

SynapseSDK methods

startSession

Creates a new session — or validates and refreshes an existing one — and sets up the connection. Returns a SessionResponse.

sendMessage

Sends a message, files, audio, or a tool result. Options:
FieldTypePurpose
messagestringText content.
messageIdstringOptional message identifier.
filesFile[]File attachments.
audioAudioMetaDataA recorded audio clip.
toolCalledbooleanMarks an elicitation-component response.
tool_declinedbooleanThe user declined a suggested tool.
tool_idstringThe tool this message relates to.
tool_resultRecord<string, unknown>Result from a tool / elicitation.
initial_promptsTInitalPrompt[]Initial conversation prompts.
hiddenbooleanSend without showing the message to the user.

callTool

Executes a tool with parameters. The result returns as a TOOL_CALL event.

sendFeedback

Sends like/dislike feedback on a message.

on / off

Register and remove event listeners. See Events. off needs the same function reference passed to on.

startRecording / endRecording

Start and stop audio recording. See Voice & audio.

getSessionConfig

Returns the current session config. Throws if no session is initialized.

getAgentConfig

Fetches the agent’s configuration — theme, connectivity, initial message, watermark.

isConnected

Whether the SDK is currently connected.

voice

Returns a VoiceAgent for voice-mode conversations.

endSession

Closes the connection and cleans up resources.

Types

SessionResponse

TContext

Environment

SynapseSDKCallbacks

TSynapseError

ToolCallData

Enums

SYNAPSE_REALTIME_EVENTS

CONNECTED, DISCONNECTED, PROGRESS_MESSAGE, MESSAGE_CHUNK, TIPS_MESSAGE, END_OF_STREAM, ERROR, TOOL_CALL, AUDIO_TRANSCRIPT, TOOL_START, TOOL_END. See Events.

SYNAPSE_COMPONENTS

MOBILE (mobile_number), OTP (otp), EMAIL (email_address), PILL (pills), MULTI (multi), DOCTOR_CARD (doctor_card), CARD (card), MEDIA_CARD (media_card).

SYNAPSE_EICITATION_STATUS

PROGRESS (progress), SUCCESS (success), FAILURE (failure).

USER_FEEDBACK

LIKE, DISLIKE, NONE.

SYNAPSE_REALTIME_ERROR_CODES

ConstantValue
SESSION_INACTIVEsession_not_found
SESSION_EXPIREDsession_expired
INVALID_EVENTinvalid_event
INVALID_CONTENT_TYPEinvalid_content
PARSING_ERRORparsing
FILE_UPLOAD_INPROGRESSfile_upload_inprogress
TIMEOUTtimeout
SERVER_ERRORserver_error
SESSION_TOKEN_MISMATCHsession_token_mismatch
PROMPT_FETCH_ERRORprompt_fetch_error
INVALID_FILE_REQUESTinvalid_file_request

DisconnectionReason

CLIENT_CLOSED, SERVER_CLOSED, CONNECTION_ERROR, AUTHENTICATION_ERROR, MAX_RECONNECT_ATTEMPTS, TIMEOUT, NETWORK_ERROR.
Always import enum values from @eka-care/medassist-core rather than hardcoding their string values — the strings are an implementation detail and the enums are the stable contract.