Basic Usage
Trigger Options
| Parameter | Type | Description |
|---|---|---|
eventName | string | Required. The event name (must match an event configured in your agent’s Events tab) |
context | object | Key-value pairs passed to the agent as conversation context |
options | object | Display and behavior options (see below) |
Options
| Option | Type | Default | Description |
|---|---|---|---|
text | string | Event name | The message shown in the trigger card |
delay | number | 0 | Milliseconds to wait before showing the trigger |
dismissible | boolean | true | Whether the user can close the trigger card |
screenshot | boolean | false | Capture a screenshot of the page and send it with the trigger |
user | object | null | User metadata: { id, email, name, ...custom } |
Screenshots
Enable screenshot capture to give your agent visual context about what the user was seeing:Screenshot capture requires html2canvas. Add it to your page:
Dismissing Triggers
Custom Messages
UseaddMessage() to show cards without firing an event — useful for announcements, tips, or custom CTAs:
Trigger Events
Listen for trigger lifecycle events:| Event | Description |
|---|---|
trigger:shown | Trigger card appeared above the bubble |
trigger:clicked | User clicked a trigger card |
trigger:loading | Trigger is being processed |
trigger:success | Trigger completed, chat opened |
trigger:error | Trigger failed |
Trigger-Only Mode
If you only want triggers without the persistent chat bubble, setwidget: false:
Migration from trigger.js
If you were using the standalonetrigger.js script, migrate to the unified widget.js:
- Replace
trigger.jswithwidget.js - Remove
type: 'toast'(toast is now the only trigger style) - Use
textinstead ofmessagefor the trigger card text boostgpt.triggerDirect()is now justboostgpt.trigger()- The old
trigger.jsstill works with a deprecation warning but will be removed in a future version