> ## Documentation Index
> Fetch the complete documentation index at: https://docs.callers.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Methods

> Reference for every public WebCall method: start and end calls, mute, send text, change the theme and read the transcript.

A `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)`.

```javascript theme={"dark"}
const webCall = new CallersWebSdk.WebCall({ token });
await webCall.call();
webCall.mute();
webCall.hangup();
```

## Call control

### `call()`

```ts theme={"dark"}
call(captchaToken?: string): Promise<void>
```

Starts a **voice** call and opens the call window. Resolves once the call is dialing; listen to `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 `captchaToken` only when you solve Cloudflare Turnstile yourself. See [Bot protection](https://docs.callers.ai/sdk/bot-protection.md#bring-your-own-token).
* Calling it while a call is already connecting does nothing.

```javascript theme={"dark"}
document.querySelector('#talk').addEventListener('click', () => webCall.call());
```

### `hangup()`

```ts theme={"dark"}
hangup(): void
```

Ends the active call. The built-in window then shows the post-call review with the transcript. Does nothing when no call is active.

### `disconnect()`

```ts theme={"dark"}
disconnect(): void
```

Tears down the current call and its transcript, cancels a call that is still connecting, and returns the widget to the collapsed launcher. The instance stays usable; call `call()` again to start over.

### `destroy()`

```ts theme={"dark"}
destroy(): void
```

Ends any call, closes the transcript stream, and removes the widget from the page. Use it when your component unmounts. The instance can't be used afterwards.

## Microphone and speaker

| Method | Signature | Description |
| - | - | - |
| `mute()` | `(): void` | Mutes the visitor's microphone. Fires `onMuteChange(true)`. |
| `unmute()` | `(): void` | Unmutes the microphone. Fires `onMuteChange(false)`. |
| `isMuted()` | `(): boolean` | Whether the microphone is muted. `false` with no active call. |
| `deafen()` | `(): void` | Silences the agent's audio for the visitor. Fires `onDeafenChange(true)`. |
| `undeafen()` | `(): void` | Turns the agent's audio back on. Fires `onDeafenChange(false)`. |
| `isDeafened()` | `(): boolean` | Whether the agent's audio is off. |

These do nothing when there is no active call, or when the state already matches.

```javascript theme={"dark"}
muteButton.onclick = () => (webCall.isMuted() ? webCall.unmute() : webCall.mute());
```

## Text input

### `sendInput()`

```ts theme={"dark"}
sendInput(content: string, widgetMessageId?: string): Promise<void>
```

Sends a typed message to the agent during an active call, voice or text. Up to 2,000 characters.

* To answer an in-call form, pass the form message's `id` as `widgetMessageId` and the answer as `content` (the built-in UI sends a JSON string of the field values).
* Throws `sendInput requires an active call` when no call is connected. To *start* a text conversation, see [Text and voice](https://docs.callers.ai/sdk/text-and-voice.md).
* Rejects with `Failed to send input: ...` if the API refuses the message.

```javascript theme={"dark"}
await webCall.sendInput('Can I reschedule to Friday?');
```

## Widget visibility

| Method | Signature | Description |
| - | - | - |
| `show()` | `(): void` | Shows the widget after `hidden: true` or `hide()`. |
| `hide()` | `(): void` | Hides the whole widget. A running call keeps running. |
| `isOpen()` | `(): boolean` | Whether the widget is set to visible (not whether a call is active). |

## Theme

### `setTheme()`

```ts theme={"dark"}
setTheme(theme: WidgetThemeConfig): void
```

Replaces the theme immediately, including during a call. Once you call it, your theme stays in effect for this instance even over the agent's dashboard theme. See [Theming](https://docs.callers.ai/sdk/theming.md#change-the-theme-at-runtime).

```javascript theme={"dark"}
webCall.setTheme({ base: 'dark', fab: { backgroundColor: '#0f766e' } });
```

## Transcript

### `getTranscriptMessages()`

```ts theme={"dark"}
getTranscriptMessages(): TranscriptMessage[]
```

Returns a copy of the current call's transcript (the most recent 500 messages). Returns an empty array before a call and after it ends; use `onCallEnded` with `onTranscriptChanged` if you need to keep the final transcript.

### `connectTranscriptStream()` / `disconnectTranscriptStream()`

```ts theme={"dark"}
connectTranscriptStream(): EventSource
disconnectTranscriptStream(): void
```

Opens or closes the live transcript stream manually. The SDK manages the stream for you; you only need these when you set no transcript callback and want to open the stream later. `connectTranscriptStream()` throws `connectTranscriptStream requires an active call` without a connected call.

## Other

| Member | Signature | Description |
| - | - | - |
| `getUsername()` | `(): string` | The call's one-time session ID, or `''` with no active call. Useful when reporting an issue to support. |
| `getPageContext()` | `(): string \| null` | The page summary Page Guide sends to the agent, or `null` when Page Guide is off. Use it to check what is shared. See [Page Guide](https://docs.callers.ai/sdk/page-guide.md). |
| `avatarStats` | `AvatarStats \| null` (getter) | Live avatar performance numbers (render backend, inference time, audio delay), or `null` without an avatar. |

## Exports

The `CallersWebSdk` global (and the package) export:

| Export | Kind | Purpose |
| - | - | - |
| `WebCall` | class | The widget and call controller |
| `generateToken(agentId, secret)` | function | Signs a 1-hour token. Server use only. |
| `STOCK_AVATARS` | array | Library avatars: `{ id, name, description, gender }` |
| `STOCK_BACKGROUNDS` | array | Avatar background presets: `{ id, name }` |
| `WEB_CALL_CAPTCHA_ACTION` | string | `'web-call-start'`, the Turnstile action for your own tokens |
| `DEFAULT_LIGHT_THEME`, `DEFAULT_DARK_THEME` | objects | Starting themes |
| `SipPhone` | class | Low-level calling client. See [Headless](https://docs.callers.ai/sdk/headless-and-react-native.md#low-level-sipphone). |
| `AvatarSession` | class | The avatar engine on its own. See [Avatars](https://docs.callers.ai/sdk/avatars.md#avatarsession). |
| `VERSION` | string | The SDK build version |

## Related

> **[Events and transcript](https://docs.callers.ai/sdk/events-and-transcript.md)**
>
> Callbacks and message shapes.

> **[Try methods in the playground](https://sdk-playground.callers.dev/)**
>
> Open **Developer** > **SDK methods** to call each method on a live widget.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.