Skip to main content

Initialization

Initialize the script with your agent ID:
boostgpt.init({
  botId: 'your-agent-uuid'  // Required
});

Init Options

OptionTypeDefaultDescription
botIdstringRequired. Your agent’s UUID

Triggering Events

boostgpt.trigger(eventName, context, options);

Parameters

ParameterTypeRequiredDescription
eventNamestringYesThe event identifier
contextobjectNoData to pass to your agent
optionsobjectNoTrigger appearance and behavior

Basic Example

boostgpt.trigger('checkout_help', {
  cart_value: '$149',
  items: 3
});

With Options

boostgpt.trigger('checkout_help', {
  cart_value: '$149'
}, {
  type: 'toast',
  position: 'bottom-right',
  message: 'Need help checking out?'
});

Common Options

These options work with all trigger types:
OptionTypeDefaultDescription
typestring"button"Trigger style: "button", "toast", "banner", "inline"
botIdstringnullOverride the agent for this trigger (uses init botId if not set)
positionstring"bottom-right"Screen position (see below)
delaynumber0Delay before showing (milliseconds)
openInNewTabbooleanfalseOpen chat in new tab
loadingTextstring"Thinking..."Text shown while loading
zIndexnumber999999CSS z-index
dismissiblebooleantrueShow dismiss button
autoShowbooleantrueAuto-show on trigger()
offsetXstring"20px"Horizontal offset from edge
offsetYstring"20px"Vertical offset from edge

Position Values

TypeAvailable Positions
Button/Toast/Inline"bottom-right", "bottom-left", "top-right", "top-left"
Banner"top", "bottom"

Button Options

For type: 'button':
OptionTypeDefaultDescription
buttonTextstring"Need help?"Button label
buttonColorstring"#7788BB"Background color
textColorstring"#FFFFFF"Text color
showIconbooleantrueShow chat icon
borderRadiusstring"50px"Border radius
fontSizestring"14px"Font size
fontWeightstring"600"Font weight
paddingstring"12px 20px"Button padding
boxShadowstring"0 4px 12px rgba(0,0,0,0.15)"Box shadow
boostgpt.trigger('help', {}, {
  type: 'button',
  buttonText: 'Get Help',
  buttonColor: '#EF4444',
  textColor: '#FFFFFF',
  borderRadius: '8px'
});

Toast Options

For type: 'toast':
OptionTypeDefaultDescription
messagestring"Need help? Click to chat..."Single chat bubble text
messagesarraynullMultiple chat bubbles (stacked)
avatarstringnullAvatar image URL (uses agent avatar if null)
titlestringnullAgent name (uses agent name if null)
toastBackgroundstring"#ffffff"Toast background color
toastTextColorstring"#374151"Toast text color
buttonColorstring"#7788BB"Action button color
// Single message
boostgpt.trigger('onboarding_help', {}, {
  type: 'toast',
  message: 'Stuck on this step? I can help!',
  title: 'Support Bot'
});

// Stacked messages
boostgpt.trigger('welcome', {}, {
  type: 'toast',
  messages: [
    'Hey there! 👋',
    'Need any help getting started?',
    'Click here to chat!'
  ]
});
For type: 'banner':
OptionTypeDefaultDescription
bannerTextstring"Need help? Click here..."Banner message
bannerColorstring"#7788BB"Background color
bannerTextColorstring"#FFFFFF"Text color
bannerPaddingstring"14px 20px"Padding
buttonTextstring"Chat Now"CTA button text
boostgpt.trigger('promo', {}, {
  type: 'banner',
  position: 'top',
  bannerText: 'Questions about our sale? Chat with us!',
  bannerColor: '#10B981',
  buttonText: 'Ask Now'
});

Inline Options

For type: 'inline':
OptionTypeDefaultDescription
containerstring/elementnullCSS selector or DOM element
buttonTextstring"Need help?"Button label
buttonColorstring"#7788BB"Background color
textColorstring"#FFFFFF"Text color
showIconbooleantrueShow chat icon
borderRadiusstring"8px"Border radius
fontSizestring"14px"Font size
paddingstring"12px 20px"Padding
<div id="help-trigger"></div>

<script>
boostgpt.trigger('inline_help', {}, {
  type: 'inline',
  container: '#help-trigger',
  buttonText: 'Chat with Support',
  buttonColor: '#4F46E5'
});
</script>

Screenshot Options

Capture a screenshot of the page when the trigger is clicked. The screenshot is sent to your agent as an attachment, providing visual context.
Screenshot capture requires the html2canvas library. Load it before trigger.js:
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
<script src="https://embed.boostgpt.co/trigger.js"></script>
OptionTypeDefaultDescription
captureScreenshotbooleanfalseEnable screenshot capture
screenshotQualitynumber0.8JPEG quality (0.0 - 1.0)
screenshotMaxWidthnumber1280Maximum screenshot width
screenshotMaxHeightnumber800Maximum screenshot height
boostgpt.trigger('checkout_error', {
  error_code: '500',
  step: 'payment'
}, {
  type: 'toast',
  message: 'Having trouble? I can see your screen to help!',
  captureScreenshot: true,
  screenshotQuality: 0.7
});
Your agent receives:
  • The user’s message with context
  • The page URL (source_url)
  • A screenshot attachment showing exactly what the user sees

User Data

Pass user information for personalized experiences:
boostgpt.trigger('support', {
  issue: 'billing'
}, {
  user: {
    id: 'user_123',
    email: 'sarah@example.com',
    name: 'Sarah Chen',
    plan: 'pro',
    // Add any custom fields
    company: 'Acme Inc'
  }
});
User data is:
  • Passed to your agent in the message context
  • Logged for analytics
  • Available in prompt templates as {{user.field}}

Multiple Bots

Override the botId per trigger to route different events to different agents:
// Initialize with your primary bot
boostgpt.init({ botId: 'support-bot-uuid' });

// Use default bot (from init)
boostgpt.trigger('general_help', {});

// Override for sales bot
boostgpt.trigger('pricing_question', {
  product: 'Enterprise'
}, {
  botId: 'sales-bot-uuid',  // Different bot!
  type: 'toast',
  message: 'Questions about pricing?'
});

// Override for billing bot
boostgpt.trigger('billing_issue', {}, {
  botId: 'billing-bot-uuid'
});
Use botId overrides when you have specialized agents for different purposes (sales, billing, technical support) on the same page.

Dismissing Triggers

Remove active triggers programmatically:
// Dismiss all triggers
boostgpt.dismissAll();

// Dismiss specific event
boostgpt.dismiss('checkout_help');

Next Steps