Voice Widget Example 🎧
Easily integrate the Vapi Voice Widget into your website for enhanced user interaction.
Improve your website’s user interaction with the Vapi Voice Widget. This robust tool enables your visitors to engage with a voice assistant for support and interaction, offering a smooth and contemporary way to connect with your services.
Steps for Installation
Insert the Widget Snippet
Copy the snippet below and insert it into your website’s HTML, ideally before the closing </body>
tag.
Generate Your Assistant
From your Vapi dashboard, create an assistant to get the assistant ID. Alternatively, define an assistant configuration directly in your website’s code as demonstrated in the example below.
Modify the Button
Modify the buttonConfig
object to align with your website’s style and branding. Choose between a pill or round button and set colors, positions, and icons.
Add Functionality to Vapi Instance
You can use the vapiInstance
returned from the run function in the snippet to further customize the behaviour. For instance, you might want to listen to various EventSource, or even send some messages to the bot programmatically.
Customization
Modify your assistant’s behavior and the initial message users will see. Refer to the provided examples to customize the assistant’s model, voice, and initial greeting.
UI Customization
For advanced styling, target the exposed CSS and other classes to ensure the widget’s appearance aligns with your website’s design. Here is a list of the classes you can customize:
.vapi-btn
: The primary class for the Vapi button..vapi-btn-is-idle
: The class for the Vapi button when the call is disconnected..vapi-btn-is-active
: The class for the Vapi button when the call is active..vapi-btn-is-loading
: The class for the Vapi button when the call is connecting..vapi-btn-is-speaking
: The class for the Vapi button when the bot is speaking..vapi-btn-pill
: The class for Vapi button to set pill variant..vapi-btn-round
: The class for Vapi button to set round variant.
Was this page helpful?