Global Object
The script creates a globalwindow.boostgpt object with the following methods:
Methods
init(config)
Initialize the trigger script with your agent configuration.| Name | Type | Required | Description |
|---|---|---|---|
config | object | Yes | Configuration object |
config.botId | string | Yes | Your agent’s UUID |
void
trigger(eventName, context, options)
Trigger an event and display the trigger UI.| Name | Type | Required | Description |
|---|---|---|---|
eventName | string | Yes | Event identifier |
context | object | No | Data to pass to your agent |
options | object | No | Display and behavior options |
void
Context Object:
Any key-value pairs you want to pass to your agent. These are injected into prompt templates.
dismiss(eventName)
Remove a specific trigger from the page.| Name | Type | Required | Description |
|---|---|---|---|
eventName | string | Yes | Event identifier to dismiss |
void
dismissAll()
Remove all active triggers from the page.void
isLoaded()
Check if the trigger script is initialized.boolean
Events
The trigger script dispatches custom events on the document:boostgpt:trigger:shown
Fired when a trigger UI is displayed.boostgpt:trigger:clicked
Fired when a user clicks the trigger UI.boostgpt:trigger:dismissed
Fired when a trigger is dismissed (by user or programmatically).boostgpt:chat:started
Fired when a chat is successfully created after clicking trigger.HTTP API
When users click triggers, the script calls:POST /v1/bot/trigger
Creates a new chat with context. Request:| Code | HTTP Status | Description |
|---|---|---|
BOT_NOT_FOUND | 404 | Agent doesn’t exist or is inactive |
RATE_LIMITED | 429 | IP rate limit exceeded |
PLAN_LIMIT_EXCEEDED | 402 | Monthly trigger limit reached |
INVALID_REQUEST | 400 | Missing required fields |