UNPKG

plazbot

Version:

Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.

288 lines (287 loc) 6.99 kB
export interface PlazbotOptions { workspaceId: string; apiKey: string; zone: "LA" | "EU"; customUrl?: string; } export type AgentColor = "orange" | "blue" | "green" | "gray" | "white"; export type ActionType = "action.asign" | "action.stage" | "action.agentShutDown" | "action.segmentation" | "action.tag" | "action.solved" | "action.event.add" | "action.event.update" | "action.event.delete" | "action.event.list"; export type FieldType = "string" | "number" | "integer" | "boolean" | "date" | "datetime" | "email" | "phone"; export type WidgetIcon = "robot" | "message" | "support" | "qa" | "chat" | "smile" | "voice" | "uservoice"; export interface RequiredField { name: string; description?: string; promptHint?: string; type?: FieldType; } export interface AgentInstructions { tone?: string; style?: string; personality?: string; objective?: string; language?: string; emojis?: boolean; preferredFormat?: string; maxWords?: number; avoidTopics?: string[]; respondOnlyIfKnows?: boolean; maintainToneBetweenMessages?: boolean; greeting?: string; } export interface AgentPerson { name?: string; role?: string; speaksInFirstPerson?: boolean; isHuman?: boolean; } export interface AgentFallbacks { noAnswer?: string; serviceError?: string; doNotUnderstand?: string; } export interface AgentRules { doNotMentionPrices?: boolean; doNotDiagnose?: boolean; doNotRespondOutsideHours?: string; } export interface AgentExample { value: string; color: AgentColor; } export interface AgentChannel { channel: string; key: string; multianswer?: boolean; } export interface AIProvider { provider: "openai" | "claude" | "gemini"; model: string; apiToken: string; temperature?: number; maxTokens?: number; isDefault?: boolean; } export interface ServiceResponseCondition { condition: string; message?: string; nextService?: string; } export interface AgentService { intent: string; reference: string; enabled?: boolean; method: "GET" | "POST"; tags?: string[]; endpoint: string; requiredFields: RequiredField[]; headers?: Record<string, string>; bodyTemplate?: Record<string, string>; bodySchema?: Record<string, "string" | "date" | "boolean" | "numeric">; responseMapping?: Record<string, string>; responseMessage?: string; responseConditions?: ServiceResponseCondition[]; action?: string; } export interface AgentActionItem { type: ActionType; value: string; } export interface AgentAction { intent: string; reference: string; tags?: string[]; enabled: boolean; requiredFields?: RequiredField[]; responseMessage?: string; responseJson?: boolean; action: AgentActionItem[]; } export interface AgentConfig { name: string; description?: string; prompt: string; zone: "LA" | "EU"; timezone?: string; buffer: number; version?: string; color?: AgentColor; question?: string; enable?: boolean; tags?: string[]; instructions?: AgentInstructions; person?: AgentPerson; fallbacks?: AgentFallbacks; rules?: AgentRules; examples?: AgentExample[]; showInChat?: boolean; enableWidget?: boolean; enableWhatsappWidget?: boolean; urlWhatsappWidget?: string; formWidget?: boolean; darkWidget?: boolean; nameWidget?: string; initialShowWidget?: boolean; fUseAutomationFlowWidget?: boolean; iconWidget?: WidgetIcon; useToolCalling?: boolean; customAIConfig?: boolean; aiProviders?: AIProvider[]; channels?: AgentChannel[]; services?: AgentService[]; actions?: AgentAction[]; [key: string]: unknown; } export interface AgentData extends AgentConfig { id: string; _id?: string; } export interface AgentSource { title?: string; url?: string; content?: string; } export interface ActionExecuted { name?: string; intent?: string; result?: unknown; } export interface AgentResponse { answer: string; sources?: AgentSource[]; actionsExecuted?: ActionExecuted[]; } export interface CreateAgentResult { agentId: string; success: boolean; message: string; } export interface UpdateAgentResult { success: boolean; message: string; } export interface WidgetResult { success: boolean; message: string; script?: string; } export interface DeleteResult { success: boolean; message: string; } export interface AgentFileResult { fileId?: string; success?: boolean; message?: string; status?: string; } export interface PortalConfig { name: string; url?: string; title?: string; subtitle?: string; logo?: string; logodark?: string; access?: "direct" | "form"; theme?: "light" | "dark"; disabled?: boolean; brandOff?: boolean; zone: "LA" | "EU"; } export interface PortalUpdateConfig { id: string; name?: string; url?: string; title?: string; subtitle?: string; logo?: string; logodark?: string; access?: "direct" | "form"; theme?: "light" | "dark"; disabled?: boolean; brandOff?: boolean; } export interface PortalData { id: string; name: string; url: string; title?: string; subtitle?: string; logo?: string; logodark?: string; access?: string; theme?: string; disabled?: boolean; brandOff?: boolean; } export interface CreatePortalResult { id: string; url: string; } export interface PortalResult { success: boolean; portal: PortalData; } export interface TemplateVariable { variable: string; value: string; } export interface TemplateFile { fileUrl: string; fileName: string; } export interface SendMessageParams { to: string; message: string; } export interface SendTemplateParams { to: string; template: string; variablesBody?: TemplateVariable[]; variablesHeader?: TemplateVariable[]; file?: TemplateFile; } export interface WebhookParams { number: string; webhookUrl: string; } export interface MessageResult { success?: boolean; messageId?: string; } export interface MessageData { id: string; content?: string; from?: string; to?: string; timestamp?: string; type?: string; } export interface WhatsAppTemplate { id: string; name: string; status: string; language?: string; category?: string; components?: unknown[]; } export interface ContactData { id: string; name?: string; cellphone?: string; email?: string; tags?: string[]; stage?: string; owner?: string; createdAt?: string; updatedAt?: string; } export interface CreateContactParams { name?: string; cellphone?: string; email?: string; tags?: string[]; stage?: string; } export interface UpdateContactParams extends CreateContactParams { id: string; }