Ask AI Buttons
Add a button anywhere on your site that sends a question to the chat with one click
You can place a button or link anywhere on your site — next to a product, in your pricing table, or in an FAQ — that opens the chat and instantly asks a question for the visitor. One click sends the message and the AI replies, so they get answers without typing.
Tip: Perfect for pricing tables, FAQ entries, and product pages — put an Ask AI button next to anything visitors commonly ask about.
How It Works
Once the Asyntai widget script is installed on your page, it exposes a global JavaScript API at window.AsyntaiWidget. You can call its methods to control the chat widget programmatically.
To send a question, call window.AsyntaiWidget.ask() with the message you want to send:
// Open the chat and send a question
window.AsyntaiWidget.ask("What are your shipping times?");
Basic Example
Add a button anywhere in your HTML and pass the question it should send:
<button onclick="window.AsyntaiWidget.ask('What are your shipping times?')">
Ask about shipping
</button>
When a visitor clicks the button, the chat opens and the question is sent automatically.
Text Link Example
Add a text link that sends a question when clicked:
<a href="#" onclick="event.preventDefault(); window.AsyntaiWidget.ask('Do you offer refunds?');">
Ask about refunds
</a>
Note: Use event.preventDefault() on anchor links to prevent the page from scrolling to the top when clicked.
Styled Button Example
Create a more prominent CTA button with custom styling:
<style>
.ask-ai-btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 18px;
background: #6366f1;
color: #fff;
border: none;
border-radius: 10px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.ask-ai-btn:hover {
background: #4f46e5;
transform: translateY(-1px);
box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}
</style>
<button class="ask-ai-btn" onclick="window.AsyntaiWidget.ask('How does pricing work?')">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2l1.9 4.8L18.7 8l-4.8 1.9L12 14.7l-1.9-4.8L5.3 8l4.8-1.2L12 2z"/>
</svg>
Ask AI
</button>
It Loads Automatically
The ask() method waits for the widget to finish loading before sending, so it works even if a visitor clicks the moment the page loads — you don't need to check whether the widget is ready.
Full API Reference
| Method | Description |
|---|---|
AsyntaiWidget.ask("message") |
Opens the chat and sends a message as if the visitor typed it |
AsyntaiWidget.open() |
Opens the chat widget |
AsyntaiWidget.close() |
Closes the chat widget |
AsyntaiWidget.toggle() |
Toggles the chat open or closed |