/** * TypeScript type definitions for MoltFlow API responses * * This file contains interfaces matching the Pydantic response models * from the MoltFlow REST API. All types are derived from actual API * endpoint implementations. */ /** * Response format enum for list/get operations */ export declare enum ResponseFormat { MARKDOWN = "markdown", JSON = "json" } /** * Generic paginated response wrapper for list endpoints */ export interface PaginatedResponse { /** Array of items in the current page */ items: T[]; /** Total number of items across all pages */ total: number; /** Maximum items per page (from request) */ limit: number; /** Current offset (from request) */ offset: number; /** Number of items in current response */ count?: number; /** Whether more items exist beyond current page */ has_more?: boolean; /** Offset value for next page */ next_offset?: number; } /** * Standard API error response */ export interface ApiErrorResponse { /** HTTP status code */ status?: number; /** Error message */ detail: string; /** Additional error context */ error?: string; /** Field-level validation errors */ errors?: Record; } /** * WhatsApp session response * Represents a connected WhatsApp number/account */ export interface SessionResponse { /** Unique session identifier */ id: string; /** Tenant that owns this session */ tenant_id?: string; /** Human-readable session name */ name: string; /** Connected WhatsApp phone number (E.164 format) */ phone_number?: string | null; /** Whether this is a WhatsApp Business account */ is_business: boolean; /** WhatsApp display name */ wa_name?: string | null; /** Current connection status */ status?: "stopped" | "starting" | "qr_code" | "working" | "failed"; /** WAHA engine type (NOWEB, WEBJS, etc.) */ engine?: string | null; /** Session configuration object */ config?: Record | null; /** When the session was created */ created_at: string; /** Last activity timestamp */ last_active_at?: string | null; } /** * Session event (QR code, status changes, etc.) */ export interface SessionEventResponse { /** Event record ID */ id: string; /** Session this event belongs to */ session_id: string; /** Event type (session.status, qr, etc.) */ event_type: string; /** When the event occurred */ created_at: string; /** Event payload data */ event_data?: Record | null; /** Original WAHA event type */ waha_event_type?: string | null; } /** * WhatsApp message response */ export interface MessageResponse { /** Unique message identifier */ id: string; /** Chat (conversation) this message belongs to */ chat_id: string; /** WhatsApp message ID from WAHA */ wa_message_id?: string | null; /** Message direction */ direction: "inbound" | "outbound"; /** Message content type */ message_type: "text" | "image" | "audio" | "video" | "document" | "location" | "contact" | "sticker"; /** First 500 characters of content (encrypted) */ content_preview?: string | null; /** Delivery status */ status: "pending" | "sent" | "delivered" | "read" | "failed"; /** When message was sent */ sent_at?: string | null; /** When message was delivered */ delivered_at?: string | null; /** When message was read */ read_at?: string | null; /** Message creation timestamp */ created_at: string; } /** * Chat (conversation) response */ export interface ChatResponse { /** Unique chat identifier */ id: string; /** Session this chat belongs to */ session_id: string; /** WhatsApp chat ID (e.g., 123456@c.us for contacts, 123@g.us for groups) */ wa_chat_id: string; /** Whether this is a group chat */ is_group: boolean; /** Contact/group display name */ contact_name?: string | null; /** Contact phone number (for private chats) */ contact_phone?: string | null; /** Number of messages in this chat */ message_count: number; /** Timestamp of most recent message */ last_message_at?: string | null; /** Whether contact is marked as lead */ is_lead: boolean; /** Lead status if is_lead is true */ lead_status?: "new" | "contacted" | "qualified" | "converted" | "lost" | null; /** When chat was created */ created_at: string; } /** * Simplified chat list item */ export interface ChatListItem { /** Chat ID */ id: string; /** WhatsApp chat ID */ wa_chat_id: string; /** Display name */ contact_name?: string | null; /** Phone number (private chats) */ contact_phone?: string | null; /** Is group chat */ is_group: boolean; /** Message count */ message_count: number; /** Last message timestamp */ last_message_at?: string | null; } /** * Lead source group information */ export interface LeadSourceGroup { /** Monitored group ID */ id: string; /** Group name */ name: string; } /** * Lead trigger metadata */ export interface LeadTrigger { /** Keyword that triggered lead detection */ matched_keyword?: string | null; /** Preview of the message that triggered detection */ message_preview?: string | null; /** Monitor mode (all, keyword) */ monitor_mode?: string | null; /** When lead was detected */ detected_at?: string | null; } /** * Lead list item response */ export interface LeadListItem { /** Lead (chat) ID */ id: string; /** Contact display name */ contact_name?: string | null; /** Contact phone number */ contact_phone?: string | null; /** Current lead status */ lead_status: "new" | "contacted" | "qualified" | "converted" | "lost"; /** When lead was first detected */ lead_detected_at?: string | null; /** Lead quality score (0-100) */ lead_score: number; /** Source group if lead came from group monitoring */ source_group?: LeadSourceGroup | null; /** Trigger information */ trigger?: LeadTrigger | null; } /** * Detailed lead response with full chat context */ export interface LeadDetailResponse extends LeadListItem { /** WhatsApp chat ID */ wa_chat_id?: string | null; /** Contact push name from WhatsApp */ contact_push_name?: string | null; /** Total message count */ message_count: number; /** Last message timestamp */ last_message_at?: string | null; /** Chat creation timestamp */ created_at?: string | null; /** Additional metadata */ meta_data?: Record | null; } /** * Monitored group response */ export interface MonitoredGroupResponse { /** Group monitoring record ID */ id: string; /** Session this group belongs to */ session_id: string; /** WhatsApp group ID */ wa_group_id: string; /** Group name */ name?: string | null; /** Group description */ description?: string | null; /** Number of participants */ participant_count: number; /** Monitoring mode (all messages or keyword-based) */ monitor_mode: "all" | "first_message" | "keyword"; /** Whether monitoring is active */ is_active: boolean; /** Keywords to monitor for (if mode is keyword) */ monitor_keywords: string[]; /** AI prompt for lead detection */ monitor_prompt?: string | null; /** Whether to auto-respond to detected leads */ auto_respond: boolean; /** Whether to auto-label detected leads */ auto_label_leads: boolean; /** Number of messages processed */ messages_processed: number; /** Number of leads detected */ leads_detected: number; /** Last message timestamp */ last_message_at?: string | null; /** When monitoring started */ created_at: string; } /** * Available WhatsApp group (from WAHA, not yet monitored) */ export interface AvailableGroupResponse { /** WhatsApp group ID */ wa_group_id: string; /** Group name/subject */ name: string; /** Number of participants */ participant_count: number; /** Whether group is already monitored */ is_monitored: boolean; } /** * Custom group member response */ export interface CustomGroupMemberResponse { /** Member record ID */ id: string; /** Contact phone number */ contact_phone: string; /** Contact display name */ contact_name?: string | null; /** When contact was added to group */ added_at: string; } /** * Custom group response */ export interface CustomGroupResponse { /** Custom group ID */ id: string; /** Tenant that owns this group */ tenant_id: string; /** Group name */ name: string; /** When group was created */ created_at: string; /** Last modification timestamp */ updated_at?: string | null; /** Number of members */ member_count: number; /** Array of group members */ members: CustomGroupMemberResponse[]; } /** * Bulk send recipient response */ export interface BulkSendRecipientResponse { /** Recipient record ID */ id: string; /** Contact phone number */ contact_phone: string; /** Contact display name */ contact_name?: string | null; /** Send status */ status: "pending" | "sent" | "failed" | "skipped"; /** When message was sent */ sent_at?: string | null; /** Error message if failed */ error_message?: string | null; } /** * Bulk send job response */ export interface BulkSendJobResponse { /** Job ID */ id: string; /** Custom group to send to */ custom_group_id: string; /** Session to send from */ session_id: string; /** Message type */ message_type: "text" | "media"; /** Message content (for text messages) */ message_content?: string | null; /** Job status */ status: "pending" | "running" | "paused" | "completed" | "cancelled" | "failed"; /** Total number of recipients */ total_recipients: number; /** Number of messages sent */ sent_count: number; /** Number of failed sends */ failed_count: number; /** When job was created */ created_at: string; /** When job started executing */ started_at?: string | null; /** When job finished */ completed_at?: string | null; /** Estimated completion time */ estimated_completion?: string | null; /** Custom group name */ group_name?: string | null; } /** * Bulk send job with recipient details */ export interface BulkSendJobDetailResponse extends BulkSendJobResponse { /** Array of recipients with individual statuses */ recipients: BulkSendRecipientResponse[]; } /** * Scheduled message execution history item */ export interface ScheduledMessageHistoryResponse { /** History record ID */ id: string; /** Scheduled message this execution belongs to */ scheduled_message_id: string; /** Execution status */ status: "success" | "failed" | "skipped"; /** When execution was triggered */ triggered_at: string; /** When execution completed */ completed_at?: string | null; /** Number of messages sent */ messages_sent: number; /** Number of messages failed */ messages_failed: number; /** Error message if failed */ error_message?: string | null; } /** * Scheduled message response */ export interface ScheduledMessageResponse { /** Scheduled message ID */ id: string; /** Message name/description */ name: string; /** Custom group to send to */ custom_group_id: string; /** Session to send from */ session_id: string; /** Schedule type */ schedule_type: "one_time" | "daily" | "weekly" | "monthly" | "custom"; /** Message type */ message_type: "text" | "media"; /** Message content (for text) */ message_content?: string | null; /** Media URL (for media) */ media_url?: string | null; /** Cron expression (for recurring schedules) */ cron_expression?: string | null; /** Timezone for schedule */ timezone: string; /** Next scheduled run time */ next_run_at?: string | null; /** Last run time */ last_run_at?: string | null; /** Current status */ status: "active" | "paused" | "completed" | "cancelled" | "failed"; /** Total number of executions */ total_runs: number; /** Number of successful executions */ successful_runs: number; /** Number of failed executions */ failed_runs: number; /** When schedule was created */ created_at: string; /** When schedule was last modified */ updated_at?: string | null; /** Custom group name */ group_name?: string | null; /** Session name */ session_name?: string | null; } /** * Usage statistics response */ export interface UsageResponse { /** Billing period (YYYY-MM) */ period: string; /** Period start timestamp */ period_start: string; /** Period end timestamp */ period_end: string; /** Messages sent this period */ messages_sent: number; /** Messages received this period */ messages_received: number; /** Total messages (sent + received) */ total_messages: number; /** Leads detected this period */ leads_detected: number; /** API calls made this period */ api_calls: number; /** Plan limit: messages per month */ limit_messages: number; /** Plan limit: monitored groups */ limit_groups: number; /** Plan limit: active sessions */ limit_sessions: number; /** Currently active groups */ groups_active: number; /** Currently active sessions */ sessions_active: number; /** Usage as percentage of limit */ usage_percentage: number; } /** * Plan limits response */ export interface PlanLimitsResponse { /** Plan name */ plan: string; /** Maximum messages per month */ messages_per_month: number; /** Maximum active sessions */ sessions: number; /** Maximum monitored groups */ groups: number; /** Maximum custom groups */ custom_groups: number; /** Maximum bulk send jobs per day */ bulk_send_per_day: number; /** Maximum scheduled messages */ scheduled_messages: number; /** Whether AI features are enabled */ ai_enabled: boolean; /** Whether A2A protocol is enabled */ a2a_enabled: boolean; /** Whether webhook delivery is enabled */ webhooks_enabled: boolean; /** API rate limit (requests per minute) */ rate_limit: number; } /** * Daily usage breakdown */ export interface UsageDailyResponse { /** Date (YYYY-MM-DD) */ date: string; /** Messages sent */ messages_sent: number; /** Messages received */ messages_received: number; /** Leads detected */ leads_detected: number; /** API calls */ api_calls: number; } //# sourceMappingURL=types.d.ts.map