Skip to main content
@telzino/react provides a context provider and hooks over @telzino/voice. No UI is included; you render it.

Example

<TelzinoProvider>

Wrap the part of your app that uses the hooks. Pass config with the same options as new TelzinoVoice(config): publishableKey, session and apiBaseUrl. See Core API.
  • Changing the identity of config does not recreate the client. Only a change to publishableKey or apiBaseUrl does. session is read at call time.
  • Unmounting the provider ends any live call.
  • The provider also accepts a client prop instead of config, for tests.
Hooks used outside <TelzinoProvider> throw a TelzinoError with code invalid_request.

Hooks

Behavior notes

  • status is connecting as soon as start() is called. A second start() while connecting or live is a no-op.
  • end() while connecting cancels the call as soon as it exists; it is not an error.
  • After a hang-up (yours or the agent’s) the snapshot is kept (status: 'ended', transcript still readable) until the next start().
  • setMuted and resume never reject; failures land in error.
  • error is a TelzinoError. See Events and errors for the codes.

Using the core client alongside the hooks

call from useTelzino() is the underlying VoiceCall, so you can use its methods directly, for example call?.sendText('Hello') or call?.setInputDevice(deviceId). The examples/web-basic app uses this to add a microphone picker and a text box.