pk_...) that is meant to sit in page HTML: it can only start web calls to agents in your account, within the limits you set, and browsers only start those calls from the domains you list.
How it works
Every call is checked before it starts. A call from a domain that isn’t on the key, to an agent outside your account, or over the key’s limits is refused.Set it up in the dashboard
1
Open the Web widget tab
In the Bolna dashboard, go to Developers and open the Web widget tab.
2
Create a widget key
A key belongs to your account, not to one agent: it works with any of your agents. Give it a name and choose:
- Allowed domains: the websites the widget may run on, for example
acme.comand*.acme.com. Press Space or Enter after each one. See allowed domains. - Allowed prompt variables: the variable names a page may fill in, for example
nameorpage, again with Space or Enter after each. Leave it empty if the page passes none. - Concurrent calls and the other limits. The defaults suit most websites.
3
Design the widget
Below the keys, under Set up the widget, pick the agent, the key and a style, then set the heading, subheading, colour, position and theme. The preview beside these settings runs the real widget: click it to place a test call with your agent.
4
Copy the code
Under Code, choose your stack (HTML, React, Next.js, Vue, Angular, or WordPress / Webflow), copy the code and paste it into your site.
Add the code to your site
The dashboard writes the code for you. For a plain HTML page it looks like this; paste it before</body>:
<bolna-widget> tag in your templates. React, Next.js, Vue and Angular each need a one-line setting to accept a custom tag; the code the dashboard writes for each stack includes it.
The widget draws itself in a shadow DOM, so your site’s CSS can’t change or break it. Calls start from a visitor’s click, which browsers require before playing audio.
Attributes
While a call is live, the ring around the mic moves with the agent’s voice and a mute button appears. Clicking the widget again ends the call.
Pass variables to the agent
Fill{variable} placeholders in the agent’s prompt and welcome message from the page, the same way user_data works for phone calls:
- Only the variable names listed under Allowed prompt variables on the key are accepted. A call that sends any other name is refused.
- Each value is text, a number or true/false, at most 500 characters. All variables together can be at most 2 KB.
- Anyone can read and change what a page sends, so never use variables for anything you need to trust, such as a customer’s account id or a price.
Listen to widget events
The widget fires DOM events you can send to your analytics:error doesn’t bubble, so listen on the widget element itself.
Allowed domains
A call is refused unless the visitor’s website is on the key’s allowed domains.The domain check reads the website the browser reports. It stops other websites from using your key in their visitors’ browsers, but a script running outside a browser can claim any website. What caps misuse is the key’s limits: calls per visitor, new calls per minute and per day, concurrent calls and the longest call. If a key is misused, create a new key, update your site, and revoke the old one.
- Enter a hostname only, with no
https://, port or path. A key can list up to 20 domains. - Every other website must use HTTPS.
- Wildcards aren’t allowed on shared hosting domains such as
*.vercel.app,*.netlify.appor*.github.io, because they would match other people’s sites. List your full hostname instead, for exampleacme.vercel.app.
Limits
Each key has its own limits, which you set when you create or edit it:- Web-call concurrency is shared. Widget calls count toward your account’s web-call concurrency, together with your other web calls. The Web widget tab shows your account’s number as Concurrent web calls. Contact support to raise it.
- An organization can have up to 10 active keys.
- Visitors who share one IP address, such as an office network, share the per-visitor limits.
What a public key can and can’t do
A public key is meant to be seen: anyone can read it from your page. It is built so that this is safe.- It can only start web calls, to agents in your account, within the key’s limits.
- Browsers only start those calls from the domains on the key. The domain comes from the browser, so a script outside a browser can still use the key, and the key’s limits are what cap it.
- It can’t read or change anything in your account. Every other Bolna API refuses it with
403. - Calls placed with it are billed to your account and show up in your call history, like your other web calls.
bn- API key is different: it must never be put in a web page.
If a key is copied somewhere you don’t want, create a new key, update your site, and revoke the old one. Changes to a key’s domains, variables and limits, and revoking it, apply to the next call.
Build your own button
To use your own design instead of the widget, use the Web Call SDK with the public key. You get the SDK’s events, mute and volume level, with no backend:Manage keys with the API
You can also create, list, edit and revoke widget keys with yourbn- API key. See the web widget keys API.
Troubleshooting
FAQ
Do I need a server?
Do I need a server?
No. The public key replaces the backend session route that the Web Call SDK normally needs. If you already run that route, you can keep using it with the SDK.
Can I use the widget in a mobile app?
Can I use the widget in a mobile app?
No. Allowed domains are checked against the website a browser reports, and native apps don’t report one. Mobile apps use the mobile SDKs with a session route on your backend.
Can I put more than one widget on a page?
Can I put more than one widget on a page?
Yes. Each
<bolna-widget> places its own calls and can use a different agent or style. Each visitor’s calls still count toward the key’s per-visitor limits.