Widget Embedding
Overview
The PromethistAI Widget allows you to embed Relational Agents directly into your website with a simple script tag. The widget appears as a floating assistant that users can expand to interact with your agent.
Basic Integration
Minimal Setup
Add this single line to your HTML page:
<script src="https://eu.promethist.ai/client/embedding/promethist-widget.js" data-region="eu"></script>
|
The |
With Agent Key
Specify your region and agent key using data attributes:
<script src="https://eu.promethist.ai/client/embedding/promethist-widget.js"
data-region="eu"
data-agent-key="agent:yourAgentKey"></script>
Replace yourAgentKey with your agent’s unique identifier. You can find it by copying the identifier shown below the button Open URL (e.g., @eli).
Using Draft Agents
If your agent is not published and still in draft status, you need to append the draft number to the agent key:
<!-- For Draft-0 -->
<script src="https://eu.promethist.ai/client/embedding/promethist-widget.js"
data-region="eu"
data-agent-key="agent:yourAgentKey.0"></script>
<!-- For Draft-1 -->
<script src="https://eu.promethist.ai/client/embedding/promethist-widget.js"
data-region="eu"
data-agent-key="agent:yourAgentKey.1"></script>
|
Configuration Options
Using Data Attributes
Customize the widget appearance and behavior directly in the script tag:
<script src="https://eu.promethist.ai/client/embedding/promethist-widget.js"
data-region="eu"
data-agent-key="agent:yourAgentKey"
data-width="140px"
data-height="140px"
data-expanded-width="400px"
data-expanded-height="600px"
data-fade-in-delay="1000"></script>
Available Configuration Parameters
| Parameter | Description | Default |
|---|---|---|
|
Server region ( |
None |
|
Your agent’s unique identifier (use |
None |
|
Widget width when collapsed |
|
|
Widget height when collapsed |
|
|
Widget width when expanded |
|
|
Widget height when expanded |
|
|
Delay before widget appears (milliseconds) |
|
|
Enable microphone access for voice interaction |
|
|
Enable camera access for video interaction |
|
Advanced Configuration
Global Configuration Object
For more control, set configuration globally before loading the script:
<script>
window.PromethistWidget = {
region: 'eu', // Required: 'eu' or 'us'
agentKey: 'agent:yourAgentKey', // Use 'agent:key.0' for drafts
width: '140px',
height: '140px',
expandedWidth: '400px',
expandedHeight: '600px',
fadeInDelay: 1000,
allowMicrophone: true,
allowCamera: true
};
</script>
<script src="https://eu.promethist.ai/client/embedding/promethist-widget.js"></script>
This approach is useful when you need to:
-
Dynamically generate configuration values
-
Integrate with existing JavaScript frameworks
-
Apply conditional logic to widget settings
JavaScript API
Programmatic Control
Control the widget programmatically using the JavaScript API:
// Expand the widget
PromethistWidget.expand();
// Collapse the widget
PromethistWidget.collapse();
// Toggle between expanded and collapsed states
PromethistWidget.toggle();
// Hide the widget completely
PromethistWidget.hide();
// Show the widget after hiding
PromethistWidget.show();
Technical Requirements
The widget inherits the same technical requirements as the Web Client:
-
WebGPU support in the browser
-
Microphone permissions for voice interaction
-
Modern browser (Chrome, Edge, Safari with WebGPU)
See Web Client Technical Requirements for detailed browser compatibility information.