@developer.notchatbot/webchat
Version:
A beautiful React chatbot widget with single-file bundle
44 lines (43 loc) • 1.39 kB
TypeScript
import { Message } from '../types';
export interface SendMessagePayload {
conversationId: string;
conversation: {
id: string;
senderId: string;
createdAt: string;
chatbotActivated: boolean;
updatedAt: string;
source: string;
website: string;
messages: any[];
};
chatbotUid: string;
}
/**
* Creates a fallback bot message for error scenarios
* @returns Fallback bot message
*/
export declare const createFallbackMessage: () => Message;
/**
* Builds the payload for sending messages to the API
* @param conversationId Conversation ID
* @param messages Array of messages
* @param config Chat configuration
* @param sessionId User's session identifier
* @returns API payload
*/
export declare const buildMessagePayload: (conversationId: string, messages: Message[], config: {
apiKey: string;
}, sessionId: string) => SendMessagePayload;
/**
* Sends messages to the chat API
* @param payload Message payload
* @returns Promise that resolves to API response or null if failed
*/
export declare const sendMessageToAPI: (payload: SendMessagePayload) => Promise<any>;
/**
* Creates a bot message from API response
* @param responseData API response data
* @returns Bot message or null if no content
*/
export declare const createBotMessageFromResponse: (responseData: any) => Message | null;