Developer Documentation
Bridget Widget Integration Guide
Learn how to embed Bridget AI chat widgets into your web and mobile applications using iframe integration.
This guide explains how to embed the Bridget widget into your web or mobile application using an <iframe>. The widget URL handles data fetching, theming, and real-time events back to your app.
Make sure your backend already implements the Bridgewise authentication flow and can provide a valid access token to the frontend. The token must be generated according to the Tenant Authentication guideline.
1 High-Level Integration Journey
A typical Bridget integration follows this end-to-end journey:
Your backend calls the Bridgewise authentication endpoint with your application credentials and receives an access token that Bridget widgets will use for all data calls.
The access token is stored securely on the backend and refreshed regularly (every 24 hours), or immediately when authentication errors occur.
When a user opens a page that should display Bridget, your frontend calls your backend, retrieves the current access token, and constructs the Bridget widget URL.
The frontend embeds Bridget using an iframe: bridget-chat for the full chat experience, or bridget-teaser as a compact teaser.
The widget sends events via postMessage (load, resize, navigation). Your app adjusts iframe height, handles navigation, and opens full chat from teasers.
Your application logs widget events and HTTP errors, reacting to token issues (401/403) by refreshing the token and reloading the widget.
2 Quick Start
Minimal Bridget Chat embed:
This example uses the default Bridgewise UI (tenant=bw) and the bridget-chat widget.
Replace YOUR_TOKEN with your actual access token and bw with your tenant name if using a custom tenant.
3 URL Structure & Available Widgets
3.1 Base URL Format
All Bridget widgets share the same base URL structure:
Path Parameters
Query Parameters
3.2 Available Widgets
? bridget-chatMain Bridget app with full chat capabilities and AI-powered responses. | ⚡ bridget-teaserCompact teaser with example questions. Redirects to full chat via events. |
3.3 Vanilla vs Custom Tenant UI
Default UI — use tenant=bw:
https://embeded.bridgewise.com/en-US/bw/bridget-chatCustom UI — use your tenant name:
https://embeded.bridgewise.com/en-US/my-tenant/bridget-chatYou can start using your tenant name before your custom design is ready. Until the custom preset is released, the widget will automatically fall back to the default UI.
4 Bridget-Specific Parameters
The following parameters apply only to the bridget-chat widget and Bridget teaser configuration.
5 Prompt Mapping & URL Construction
Parameters bridget.examples, teaser.examples and bridget.q accept a text/query mapping format. This allows you to display a short label in the UI while sending a more complex prompt to Bridget.
A single mapping is an object:
tText shown in UI (buttons, suggestions) | qPrompt sent to API (optional, defaults to |
5.1 How to Build the URL
To add examples to the widget URL, you must stringify the JSON array and then URI encode it.
JavaScript Example:
5.2 Quick Generator
Use this one-liner in your browser's Developer Console to generate the parameter:
Use teaser.examples to define compact teaser buttons. When clicked, bridget-teaser emits bridget-teaser-trigger. Your app should then open bridget-chat and optionally pre-fill bridget.q with the mapped prompt.
6 Events & postMessage
Bridget widgets send JSON-serialized messages to window.parent via postMessage. Each message has this format:
6.1 Event Types
Status Events
load { height: number }Widget fully loaded; provides suggested height.
resize { height: number }Content height changed; use for auto-resize.
success { height: number }Successful state update (for example, answer rendered).
error { message, status, data?, height }Error inside the widget or underlying services.
Interaction Events
click { id: string, ... }Click events (clipboard, disclaimer, etc.).
hover { id: string, ... }Hover events (where supported).
Navigation Events
navigate { href: string }Emitted instead of native navigation when actionType=external.
security-select { ticker, exchange, type }Security selected; use to navigate to your own stock / fund page.
Teaser Widget Events
bridget-teaser-trigger{ message, companyId, primaryTickerSymbol }
Emitted when a teaser question is clicked in bridget-teaser. Use this to open bridget-chat and pass the prompt.
Call-to-Action Events
click{ id: "trade", action: "confirm" | "cancel", instrument: { id, name, symbol, type } }
Emitted when a user interacts with the Call-to-action (trade) widget in the chat.
6.2 Basic Event Handler (Web)
7 Handling Navigation (actionType)
The actionType query parameter controls how Bridget handles clicks on links and securities.
defaultNative browser behavior. All links work as standard HTML links. When a user clicks on a security (stock, fund, etc.), they are redirected to the corresponding page on the Bridgewise platform.
Use case: When you want users to explore the full Bridgewise experience.
preventAll navigation disabled. Clicking on any link or security does nothing. The widget becomes read-only in terms of navigation.
Use case: Demo environments, restricted access scenarios, or when you want to prevent any external navigation.
external RECOMMENDEDFull control for your application. Instead of navigating, the widget emits events that your application can intercept and handle according to your own routing logic.
When a user clicks a link, you receive a navigate event with the target URL. When they click a security, you receive a security-select event with ticker, exchange, and type information.
Use case: Keeping users within your application, navigating to your own stock/fund pages, or implementing custom routing.
Use actionType=external to keep users within your application. Handle security-select events to navigate to your own stock or fund pages, providing a seamless integrated experience.
8 Theming, Localization & Security
? Theming
| ? Localization
| |
⚠️ Errors
| ? Security
|
9 Per-Security Text Customization
When displaying Bridget in context of a specific security, you can use placeholder tokens in customized text lines:
{companyName} | {companyTicker} |
When you load the widget with an ?identifier=... parameter, these placeholders are automatically replaced with the corresponding company name and ticker.
The bridget-teaser already uses placeholders. For bridget-chat welcome screen customization, contact Bridgewise to add personalized text to your tenant preset.
10 Native Mobile Integration
10.1 iOS (SwiftUI / UIKit)
On iOS, embed Bridget using WKWebView, bridge postMessage events into Swift, and adjust view height based on events.
10.2 Android (WebView)
On Android, use WebView with a JavaScript interface to receive messages.
Key Mobile Integration Points
- Widget is responsive and adapts to mobile viewports
- Use
actionType=externalto handle selections in your app - Listen for
errorevents for network/auth issues - Store tokens securely (iOS Keychain, Android EncryptedSharedPreferences)
- Test across device orientations and screen sizes
11 Mobile Integration Notes
? Responsive DesignWidget automatically adapts to mobile viewports. | ? External NavigationUse |
⚠️ Error HandlingListen for error events for network/auth issues. | ? Secure StorageUse iOS Keychain or Android EncryptedSharedPreferences. |
12 Optional: Compression for Long Parameters
If your encoded JSON becomes very long, you can optionally compress it to reduce URL size. This is not mandatory — use only if URL length is a concern.
Compression Steps
gz_Only implement compression if you encounter URL length issues. For most use cases, standard URI-encoded JSON is sufficient.
13 Call-to-Action Widget WIP
The widget can be configured to enable call-to-action controls (e.g., Trade buttons) in bot responses. These buttons emit a click event:
Use this event to redirect users to a dedicated trading or stock page within your application.