Turn any button, link, or element on your website into a conversation starter. AI Agent Triggers let you open the chat widget with pre-filled prompts, perfect for replacing contact forms, adding product inquiries, and creating contextual help experiences.
8 min read
Updated April 2026
AI Agent Triggers allow you to open the ChatSpark widget from any clickable element on your website, with an optional pre-filled message. Instead of customers clicking the chat bubble and figuring out what to ask, you guide them with context-specific prompts.
Common use cases:
Add two attributes to any HTML element to make it trigger your AI Agent:
class="cs-trigger-agent" - Tells ChatSpark this element opens the widgetdata-trigger="Your message here" - Pre-fills the chat with your prompt (optional)Basic example:
<button class="cs-trigger-agent" data-trigger="I'd like to learn more">
Chat With Us
</button>When a visitor clicks this button, the chat widget opens and automatically sends "I'd like to learn more," starting the conversation with context.
data-trigger attribute, the widget simply opens without a pre-filled message. Useful for generic "Chat Now" buttons.Traditional contact forms are friction-heavy and often go unanswered for days. Replace them with AI Agent Triggers for instant, conversational engagement.
Example implementation:
<!-- Replace your contact form with this -->
<a href="#" class="cs-trigger-agent" data-trigger="I'd like to contact your team">
Contact Us
</a>
<!-- Or a more specific prompt -->
<button class="cs-trigger-agent" data-trigger="I have a question about your services">
Get In Touch
</button>Add "Learn More" buttons throughout your website that open conversations about specific products or services.
Product page example:
<div class="product-card">
<h3>Professional Camera Kit</h3>
<p>Everything you need to start your photography journey.</p>
<button class="cs-trigger-agent" data-trigger="Tell me more about the Professional Camera Kit">
Learn More
</button>
</div>Service page example:
<button class="cs-trigger-agent" data-trigger="What's included in your consulting services?">
Ask About Consulting
</button>Pricing page example:
<a href="#" class="cs-trigger-agent" data-trigger="I have a question about your pricing">
Have Questions?
</a>Place contextual help buttons throughout your app or documentation to provide instant support exactly where users need it.
Feature-specific help:
<button class="cs-trigger-agent" data-trigger="How do I set up Lead Capture?">
Need Help?
</button>FAQ shortcuts:
<ul class="faq-list">
<li>
<a href="#" class="cs-trigger-agent" data-trigger="What are your business hours?">
What are your business hours?
</a>
</li>
<li>
<a href="#" class="cs-trigger-agent" data-trigger="What's your return policy?">
What's your return policy?
</a>
</li>
<li>
<a href="#" class="cs-trigger-agent" data-trigger="How do I track my order?">
How do I track my order?
</a>
</li>
</ul>Error page recovery:
<!-- On a 404 page -->
<p>Can't find what you're looking for?</p>
<button class="cs-trigger-agent" data-trigger="I can't find what I'm looking for on your website">
Ask Our AI Agent
</button>Automatic Triggers open the chat widget on their own based on visitor behavior. You configure them in your AI Agent settings. No code is required.
/pricing means the trigger only fires when the visitor is on a page whose URL contains /pricing.Example no-code flow: A visitor lands on your pricing page. After 30 seconds, a speech bubble appears above the chat button with the message “Have a question about our pricing? I can help.” The visitor clicks the bubble, the widget opens, and the conversation starts.
For conditions that cannot be configured in the dashboard, use the ChatSpark.trigger() method to fire the overlay programmatically from your own code.
ChatSpark.trigger("I noticed you're leaving — can I help before you go?");The method accepts an optional message string. If the widget is already open, the call is ignored. If no message is provided, the bubble appears without text and clicking it opens the widget.
// Open the widget with no pre-filled message
ChatSpark.trigger();Example: fire on custom storefront event
// Trigger when a user tries to close a checkout modal
checkoutModal.addEventListener("close", function () {
ChatSpark.trigger("I noticed you're leaving — can I help before you go?");
});The more context you provide in the trigger, the better the response:
"Help""Help me understand your pricing plans"Button text should tell visitors what happens when they click:
Click HereAsk About PricingGet Product DetailsChat With SalesReview your Conversations to see how visitors interact with different triggers. Adjust prompts based on what leads to the best conversations.