Integration – ClubsiteCMS¶
Overview¶
The chatbot is integrated into ClubsiteCMS via three Classic ASP/JS files that are automatically included in all pages for a given tenant.
Include Order¶
All CMS pages (e.g. default.asp)
└── #include "common-front/ai_chatbot_loader.asp"
└── (if IsActive=1) #include "../ai_chat_widget.asp"
└── Writes <script src="/assets/js/chatbot.js">
ai_chatbot_loader.asp¶
Location: SKI/common-front/ai_chatbot_loader.asp
Runs server-side on every page view. Does the following:
- Queries the
AI_Chatbot_Settingstable in the club's database - Writes CSS variables to a
<style>block: - Writes JS constants to a
<script>block: - Includes
ai_chat_widget.aspifIsActive = 1
AI_Chatbot_Settings – Database Table¶
| Column | Type | Description |
|---|---|---|
ClubID |
int | Foreign key to Clubs |
IsActive |
bit | Chatbot enabled (1) or disabled (0) |
BotName |
nvarchar | Display name for the bot |
WelcomeMessage |
nvarchar | Welcome message |
ThemeColor |
nvarchar | CSS colour (hex) |
LogoUrl |
nvarchar | URL to bot logo |
ExcludedPaths |
nvarchar | Comma-separated list of pages without chatbot |
ai_chat_widget.asp¶
Location: SKI/ai_chat_widget.asp
Simple HTML structure for the chatbot widget. Rendered server-side and conditionally included from the loader.
chatbot.js¶
Location: SKI/assets/js/chatbot.js
Vanilla JavaScript client. Key logic:
const API_URL = "/api/chat";
async function sendMessage(message) {
const response = await fetch(API_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
tenant_id: TENANT_ID, // injected from ASP loader
message: message,
history: conversationHistory
})
});
const data = await response.json();
return data.reply;
}
Conversation history is stored only in the browser's memory (JavaScript array). It is sent with each request for context but is never stored on the server.
Admin Settings (CSADMIN)¶
Location: SKI/CSADMIN/files_setup/cChatbot.asp
Gives CMS administrators an interface to: - Enable/disable the chatbot - Change bot name and welcome message - Set theme colour and logo image - Define excluded pages
Saving is handled by SKI/CSADMIN/files_setup/scr_chatbot.asp via SQL UPSERT against AI_Chatbot_Settings.
IIS Configuration¶
/api/chat requests are routed by IIS to the uvicorn process via URL Rewrite (reverse proxy). The rule is configured at the IIS site level, not in the per-tenant-folder web.config.