RTVIClient
The client-side component that speaks to the Daily Bot
Overview
The RTVIClient
is the component you will primarily interface with for interacting with your Daily Bot. This client is part of the RTVI suite of client libraries, all of which follow the same API design detailed below. The purpose of this component is to:
- Provides a
connect()
method that handshakes / authenticates with your bot service - Configures your bot services
- Manages your media connections
- Provides methods, callbacks and events for interfacing with your bot
The RTVIClient
works in conjunction with the DailyTransport
from the realtime-ai-daily
library to enable voice and video communication with the bot. A DailyTransport
is required for Daily Bots.
This page provides details on the most common parameters, methods, and callbacks you will use with the RTVIClient
along with specific API expectations required for Daily Bots. For full reference material and installation instructions, visit the docs for your corresponding library.
Source Docs
API Reference
Constructor Parameters
Handshake URL to your hosted endpoint that triggers authentication, transport session creation and bot instantiation.
The RTVIClient
will send a JSON POST
request to this URL and pass the local configuration (config
) as a body param.
The RTVIClient
expects this endpoint to return the response from the Daily Bots endpoint to establish the connection. Doing so will then established the connection automatically.
Example:
These are your local app’s endpoints that your client will use to connect to the /bots/start
endpoint or initiate bot actions. For example, if you’re running a Next.js application, you may have a route.ts that is used to call the /bots/start
endpoint at /api/v1/start-bot/route.ts
. Given that example, your baseUrl
would be /api/v1
and your connect
endpoint would be start-bot
. The same pattern applies for the actions
endpoint.
Example:
Pipeline configuration object for your registered services. Must contain a valid RTVIClientConfig
array.
Client config is passed to the bot at startup, and can be overriden in your server-side endpoint (where sensitive information can be provided, such as API keys.)
See configuration.
Example:
Pass through custom request body parameters to your defined connect
endpoint.
Example:
Note: services
is intended to be set on the server-side. If you have a need to pass them from the client-side, you can use params.requestData
.
An array of callback functions. See callbacks.
Enable user’s local microphone device.
Enable user’s local webcam device.
Custom HTTP headers to include in the initial connect
web request to the
baseUrl
.