AI4CALL Widget
One line of code to let your visitors talk to the AI voice assistant directly from the browser.
๐
1
Quick Start
Copy and paste into your HTML. Done.
๐
Where do I find my apikey?
In the AI4CALL portal, on your assistant card. It has the format
ai4call_sk_xxxxxxxx. 2
Parameters
All data-* attributes available on the script tag.
| data-apikey | string | AI4CALL assistant apikey. Identifies which assistant answers the call. |
| Parameter | Values | Description |
|---|---|---|
| data-mode | embed fixed api |
embed = the button appears where you place the script tag. fixed = floating button in a corner, always visible. api = no UI at all, JavaScript API only. |
| data-style | pill round square minimal pulse gradient outline 3d glass neon |
Visual style of the button. See Style Gallery. |
| data-color | #hex |
Primary color of the button. |
| data-position | bottom-right bottom-left top-right top-left bottom-center |
Button position. Only for mode=fixed. |
| data-text | free text | Button text (e.g. "Talk to Mario"). |
| data-hide-branding | true false |
Hides "Powered by AI4CALL". Subject to your contract plan. |
| Parameter | Values | Description |
|---|---|---|
| data-cid-name | free text | Custom CallerID name visible to the assistant. |
| data-cid-num | number | Custom CallerID number. |
| Parameter | Values | Description |
|---|---|---|
| data-lang | it en fr es |
Language of the automatic labels (Connecting, In call, Hang up). |
3
Style Gallery
10 styles available. Pick a color and a state to preview.
4
Behavior
The button automatically changes appearance based on the call state.
๐ก
No modal, no popup. A single button that switches state. Multiple assistants on the same page? Only one call at a time: the others auto-disable.
5
Examples
Copy-paste ready snippets for every scenario.
Minimal example
Custom style and text
Floating bottom-left
With custom CallerID
Gallery โ multiple assistants on the same page
All parameters
6
JavaScript API
For developers who want to build their own custom UI.
Use data-mode="api" to disable the widget UI. Build your own UI on top of the exposed JavaScript functions.
| Function | Parameters | Description |
|---|---|---|
| AI4CALL.call(opts) | {cidName, cidNum} |
Starts the call to the assistant. |
| AI4CALL.hangup() | โ | Hangs up the current call. |
| AI4CALL.getState() | โ | Returns the state: idle, calling, connected. |
| AI4CALL.onStateChange(fn) | fn(state, secs) |
Callback fired on every state change. secs = call duration in seconds. |
Single button with toggle
Dynamic CallerID with authenticated user
๐ค
Scenario: the user is logged in on your website
If your site has a login area, you can pass the logged-in user's phone number as the CallerID. The AI assistant will know who is calling and can answer in a personalized way.
โ๏ธ
How it works
The CallerID is passed as a SIP header to the AI assistant. If the assistant is configured with an MCP customer-lookup tool, it can recognize the number and tailor the conversation: "Good morning Mario, how can I help you?"
PHP example โ inject user data into the template
โ ๏ธ
Security note
The CallerID is set client-side, so a user could modify it. Don't use it for authentication or sensitive-data access. Use it as a hint for the AI assistant, not as proof of identity.
7
Technical requirements
What you need for the widget to work.
WebRTC
The browser must support WebRTC. All modern browsers do: Chrome, Firefox, Safari, Edge.
Microphone
The browser will ask permission on the first click. If the user denies it, the call cannot start.
HTTPS
Required. WebRTC and microphone access need a secure connection.
No dependencies
The widget loads everything on its own (~15KB). The SIP library loads in the background after 3 seconds without blocking the page.