Documentation
Complete guide to integrating PageBot into your website.
Quick Start
Add PageBot to your website with a single line of code:
<script src="https://pagebot.themenonlab.com/widget.js"></script>
That's it! The widget will appear in the bottom-right corner of your page.
AI Providers
PageBot supports multiple AI providers. You can use our default backend or bring your own API key.
Supported Providers
| Provider | Value | Models |
|---|---|---|
| OpenAI | openai |
gpt-4o, gpt-4o-mini, gpt-4, gpt-3.5-turbo |
| Anthropic | anthropic |
claude-sonnet-4-20250514, claude-3-5-sonnet, claude-3-haiku |
| Google Gemini | gemini |
gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash |
| Azure OpenAI | azure |
Your deployment name |
| OpenRouter | openrouter |
100+ models via openrouter.ai |
| Custom API | custom |
Any OpenAI-compatible endpoint |
Using Your Own API Key
<script
src="https://pagebot.themenonlab.com/widget.js"
data-provider="openai"
data-api-key="sk-..."
data-model="gpt-4o"
></script>
Azure OpenAI
<script
src="https://pagebot.themenonlab.com/widget.js"
data-provider="azure"
data-api-key="your-azure-key"
data-azure-endpoint="https://your-resource.openai.azure.com"
data-azure-deployment="gpt-4o"
></script>
Custom OpenAI-Compatible Endpoint
Use with Ollama, LM Studio, vLLM, or any OpenAI-compatible API:
<script
src="https://pagebot.themenonlab.com/widget.js"
data-provider="custom"
data-custom-endpoint="http://localhost:11434/v1"
data-model="llama3.2"
></script>
Configuration Options
| Attribute | Default | Description |
|---|---|---|
data-key |
— | Your PageBot API key (from dashboard) |
data-provider |
azure | AI provider: openai, anthropic, gemini, azure, openrouter, custom |
data-api-key |
— | Your AI provider API key |
data-model |
Provider default | Model name (e.g., gpt-4o) |
data-theme |
default | Theme: default, dark, brand |
data-color |
#2563eb | Primary color (hex) |
data-position |
bottom-right | Widget position: bottom-right, bottom-left, top-right, top-left |
data-title |
PageBot | Widget header title |
data-welcome |
Hi! I can answer... | Welcome message |
data-placeholder |
Ask about this page... | Input placeholder text |
data-branding |
true | Show "Powered by PageBot" (Pro to remove) |
JavaScript API
Control the widget programmatically after it loads:
Basic Controls
// Open the chat widget
PageBot.open();
// Close the chat widget
PageBot.close();
// Toggle open/closed
PageBot.toggle();
// Send a message programmatically
PageBot.send("What is this page about?");
Page Context
// Get the current scraped page context
const context = PageBot.getContext();
console.log(context);
// Re-scrape the page (useful for SPAs after navigation)
const newContext = PageBot.rescrape();
Provider Control
// Switch providers at runtime
PageBot.setProvider('openai', 'sk-your-key', 'gpt-4o');
// Clear conversation history
PageBot.clearHistory();
// Access current config
console.log(PageBot.config);
How Page Scraping Works
PageBot automatically extracts content from your page:
- Page title —
document.title - URL — Current page URL
- Meta description —
<meta name="description"> - Headings — All h1, h2, h3 tags
- Content — Paragraphs, article text, lists
Content is truncated to ~8,000 characters to fit in the AI context window.
What's Excluded
- Navigation and footer elements
- Scripts and styles
- Hidden elements
- The PageBot widget itself
Single Page Apps (SPAs)
For React, Vue, Next.js, and other SPAs, call rescrape() after navigation:
// React Router example
useEffect(() => {
if (window.PageBot) {
window.PageBot.rescrape();
}
}, [location.pathname]);
Custom Styling
Override widget styles with CSS:
.pagebot-widget-container {
/* Move widget position */
}
.pagebot-widget-button {
/* Customize the floating button */
}
.pagebot-widget-chat {
/* Customize the chat window */
}
.pagebot-widget-message.assistant {
/* Style assistant messages */
}
.pagebot-widget-message.user {
/* Style user messages */
}
Self-Hosting
Deploy your own PageBot backend:
- Clone the repo:
git clone https://github.com/menonpg/pagebot-widget - Configure
cloudflare-worker/wrangler.toml - Set secrets:
wrangler secret put AZURE_OPENAI_KEY - Deploy:
wrangler deploy - Update widget to use your worker URL:
data-api-url="https://your-worker.workers.dev"
FAQ
Why isn't the chatbot seeing my page content?
The widget scrapes content on page load. For SPAs, call PageBot.rescrape() after navigation. Also check that your content isn't inside hidden elements or loaded dynamically after the widget initializes.
Can I use my own AI model?
Yes! Use data-provider="custom" with your OpenAI-compatible endpoint, or any of the supported providers with your own API key.
Is my data stored?
Page content is sent directly to your configured AI provider. PageBot does not store conversation data unless you're using the dashboard analytics features.
Can I remove the "Powered by PageBot" branding?
Yes, with a Pro subscription. Set data-branding="false".