Overview
You've added your AI Agent. Now let your website start conversations too, whether it's from search bars, buttons, or help links across your pages.
Instead of waiting for a visitor to click the chat bubble, you can trigger the AI from anywhere.
Common Use Cases:
- Custom Buttons: Create your own buttons that instantly start a specific conversation (e.g., "Get a Quote"). Programmatically create AI buttons relevant to each page.
- Text Links & Headers: Turn any text into an interactive trigger. Perfect for clarifying complex terms or pricing details right where they appear.
- Search Bars: Connect your search input to the AI, so users get answered immediately instead of seeing a "no results" page.
Watch this quick overview:
Accessing the API
Depending on which product you are using, the API is available through a different global object on your page. Both objects support the exact same methods.
- AI Nav: Use
window.expertiseAi
- Widget: Use
window.chatsimpleWidget
Note: In the examples below, we will use
window.expertiseAi, but you can replace it with window.chatsimpleWidget if you are using the classic widget.Examples
1. Talk to AI Button
Turn your hero button into a conversation starter. Instead of sending visitors to a form, let them talk directly to your AI Agent.
<button onclick="window.expertiseAi.sendMessage('I want to schedule a demo')"> Talk to AI Now </button>
2. Help Links in Your Content
Add links within your content that open the AI Agent. When visitors hit a complex topic, they can instantly ask for clarification without losing their place.
<p> Check our enterprise rates. <a href="#" onclick="window.expertiseAi.sendMessage('Tell me about enterprise pricing'); return false;"> See how much you can save </a> </p>
API Reference
Here are the available methods to control the agent programmatically.
sendMessage(message)
Opens the chat window and sends the specified message as the user. This is the primary way to start a conversation from a specific context.
Parameters:
message(string): The text to send to the AI.
Example:
window.expertiseAi.sendMessage("Help me choose a plan");
restart()
Clears the current conversation history and starts a fresh session. Useful if you want to reset the context for a new topic or user.
Example:
window.expertiseAi.restart();
show()
Makes the agent visible if it was previously hidden.
Example:
window.expertiseAi.show();
hide()
Hides the agent from the screen.
Example:
window.expertiseAi.hide();