WebRTC Widget

Embed a Guava voice agent on your website so visitors can start a voice conversation directly from the browser. The WebRTC audio widget is a drop-in <script> tag that handles all WebRTC signaling, UI, and state management — no additional CSS, JS, or dependencies required.

Integration

Add a single <script> tag to your page. The only required attribute is webrtc-code, which is the agent code (starts with grtc-) obtained from the Guava dashboard.

index.html
<script
  src="https://app.goguava.ai/static/build/webrtc-widgets/guava-widget.js"
  webrtc-code="grtc-YOUR_AGENT_CODE_HERE"
></script>

Self-contained. The widget injects its own HTML and CSS with no global variables or style conflicts. Works on any page with a modern browser — just add the script tag and configure with attributes.

Customization

ParameterTypeDefaultDescription
gw-namestring"Guava"Display name shown on the widget.
gw-colorstring"#4ecb8d"Accent color as a 6-digit hex code (e.g. "#4ecb8d" or "4ecb8d").
enable-chatflagoffAdd this attribute to enable the chat panel with message transcript, text input, and mic toggle.

Try it

Configure the widget and copy the script tag for your site.

Talk to Guava
Guava
Connected0:42
Hi! How can I help you today?
I have a question about pricing.
Of course! I'd be happy to walk you through our plans.
Type a message...
index.html
<script
  src="https://app.goguava.ai/static/build/webrtc-widgets/guava-widget.js"
  webrtc-code="grtc-YOUR_AGENT_CODE_HERE"
></script>

Chat panel

The chat panel adds a full conversation interface when the user clicks the orb:

  • Live message transcript (agent and caller speech)
  • Text input for sending messages during the call
  • Mic toggle to mute/unmute
  • Call timer and hang-up button
  • Draggable header to reposition the panel
  • Post-call "New conversation" button to start another session

Generating a WebRTC code via SDK

Instead of obtaining a WebRTC code from the Guava dashboard, you can generate one programmatically with client.create_webrtc_agent(). This is useful when you need to create codes on-the-fly or control their TTL.

generate_code.py
from guava import Client
from datetime import timedelta

client = Client(api_key="your-api-key")

# Create a WebRTC code valid for 1 hour
webrtc_code = client.create_webrtc_agent(ttl=timedelta(hours=1))
print(f"WebRTC code: {webrtc_code}")

# Use the code to listen for inbound calls
client.listen_inbound(webrtc_code=webrtc_code, controller_class=MyCallController)
ParameterTypeRequiredDescription
ttldatetime.timedelta | NoneNoHow long the WebRTC code should remain valid. If omitted, the server default TTL applies.

Returns: str — a WebRTC code (e.g. grtc-...) that can be passed to listen_inbound(webrtc_code=...) or used as a ?webrtc_code=<value> query parameter in the browser widget.

Raises an HTTP error (via check_response) if the API request fails.

Ready to build?

Get started with Guava

Sign up, grab your API key, and ship your first voice agent in an afternoon.

Open Guava Dashboard

Questions? hi@goguava.ai