@botforge/widget
Version:
Official BotForge chatbot widget for easy integration into any website or web application
39 lines (38 loc) • 1.29 kB
TypeScript
import { BotForgeMessage } from "../types";
export declare class BotForgeAPIClient {
private baseUrl;
private anonKey;
private chatbotId;
private conversationId;
private userIdentifier;
private debug;
private isInitializing;
private retryCount;
private maxRetries;
private isOfflineMode;
private connectionCheckInterval;
constructor(chatbotId: string, apiUrl?: string, anonKey?: string, debug?: boolean);
private log;
private startConnectionMonitoring;
private checkConnection;
private makeRequest;
initializeConversation(): Promise<{
conversationId: string;
userIdentifier: string;
welcomeMessage?: BotForgeMessage;
followUpMessage?: BotForgeMessage;
}>;
sendMessage(content: string, type?: "text" | "file"): Promise<{
userMessage: BotForgeMessage;
botMessage: BotForgeMessage;
}>;
getChatbotFlow(): Promise<any>;
setUserIdentifier(userIdentifier: string): void;
getConversationId(): string | null;
getUserIdentifier(): string | null;
isOffline(): boolean;
reset(): void;
destroy(): void;
}
export declare const generateUserIdentifier: () => string;
export declare const createFallbackResponse: (userMessage: string) => BotForgeMessage;