WebCall instance controls one widget and one call at a time. With the script tag, the instance is window.Callers.widget; in code, it is the object you create with new WebCall(config).
Call control
call()
onCallStarted for the moment it connects. Errors are reported through onError and in the call window, not by rejecting.
- Call it from a user gesture (a click handler) so the browser allows the microphone and audio.
- Pass
captchaTokenonly when you solve Cloudflare Turnstile yourself. See Bot protection. - Calling it while a call is already connecting does nothing.
hangup()
disconnect()
call() again to start over.
destroy()
Microphone and speaker
These do nothing when there is no active call, or when the state already matches.
Text input
sendInput()
- To answer an in-call form, pass the form message’s
idaswidgetMessageIdand the answer ascontent(the built-in UI sends a JSON string of the field values). - Throws
sendInput requires an active callwhen no call is connected. To start a text conversation, see Text and voice. - Rejects with
Failed to send input: ...if the API refuses the message.
Widget visibility
Theme
setTheme()
Transcript
getTranscriptMessages()
onCallEnded with onTranscriptChanged if you need to keep the final transcript.
connectTranscriptStream() / disconnectTranscriptStream()
connectTranscriptStream() throws connectTranscriptStream requires an active call without a connected call.
Other
Exports
TheCallersWebSdk global (and the package) export:
Related
Events and transcript
Callbacks and message shapes.
Try methods in the playground
Open Developer > SDK methods to call each method on a live widget.