// Navigate to the getting started guide
window.GitBook("navigateToPage", "/getting-started");
// Navigate to a specific API documentation page
window.GitBook("navigateToPage", "/api/authentication");
// Navigate to FAQ section
window.GitBook("navigateToPage", "/faq/billing");
// Switch to the assistant tab
window.GitBook("navigateToAssistant");
// You might use this in response to a button click
document.getElementById("help-button").addEventListener("click", () => {
window.GitBook("navigateToAssistant");
});
// Send a predefined message
window.GitBook("postUserMessage", "How do I reset my password?");
// Send a message based on user action
function askAboutBilling() {
window.GitBook("postUserMessage", "I have questions about my billing");
}
// Send a message with context
const userPlan = "premium";
window.GitBook(
"postUserMessage",
`I'm on the ${userPlan} plan and need help with advanced features`
);
// Clear the chat
window.GitBook("clearChat");
// Clear chat and start fresh conversation
function startNewConversation() {
window.GitBook("clearChat");
window.GitBook("postUserMessage", "Hello, I need help with a new issue");
}
// Clear chat when switching contexts
document.getElementById("new-topic").addEventListener("click", () => {
window.GitBook("clearChat");
window.GitBook("navigateToAssistant");
});
window.GitBook('configure', {
tabs: ['assistant', 'docs'],
actions: [
{
icon: 'circle-question',
label: 'Contact Support',
onClick: () => window.open('https://support.example.com', '_blank')
}
],
greeting: { title: 'Welcome!', subtitle: 'How can I help?' },
suggestions: ['What is GitBook?', 'How do I get started?']
});