/** Available provider options in the Chat Config API. */ type ProviderName = 'whatsapp' | 'gmail' | 'outlook' | 'messenger' | 'direct' | 'yunique'; interface Provider { id: string; name: string; configurationsSchema: Record | null; defaultSession: number; type: string; createdAt: string; updatedAt: string; } type ProviderListResponse = Provider[]; interface GetProviderConfigurationsParams { id: string | string[]; companyId?: string; } interface WhatsAppProviderSettings { pin: string; csat: boolean; phone: string; wabaId: string; csatTTL: number; isEnabledMarketingMessagesAPI: boolean; phoneId: string; appToken: string; csatAnswer: string; debugToken: string; accessToken: string; alias: string; } interface WidgetProviderFunctionValues { chat: TValue; voice: TValue; whatsapp: TValue; } interface WidgetProviderFunctions extends WidgetProviderFunctionValues { voice_in_chat: boolean; } interface WidgetProviderAuthSettings { name: boolean; nameValidationQuestion: string; phone: boolean; phoneValidationQuestion: string; email: boolean; emailValidationQuestion: string; company: boolean; subject: boolean; cpfValidationQuestion: string; } interface WidgetProviderVoiceConfiguration { id: number; attendanceGroupId: string; voiceTimeout: number; description: string; surname: string; icon: string; } interface WidgetProviderThemeColors { primary: string; secondary: string; accent: string; neutral: string; } interface WidgetProviderThemeSettings { name: string; hexColors: WidgetProviderThemeColors; tailwindColors: WidgetProviderThemeColors; textColor: string; type: string; } interface WidgetProviderWhatsappSettings { phone: string; } interface WidgetProviderSettings { name: string; type: string; hidePoweredByOpens: boolean; showToClientEndChatOption: boolean; showToClientRecordAudioOption: boolean; hideBottomNavigation: boolean; hideCloseButton: boolean; openYuniqueWidget: boolean; fontChoice: string; useLogoAsUserImage: boolean; removeFileButton: boolean; position: string; positionMarginLeft: number; positionMarginTop: number; iconImage: string; customIconImage: string; functionsIcons: WidgetProviderFunctionValues; functionsIconsDisplays: WidgetProviderFunctionValues; functionsDescriptions: WidgetProviderFunctionValues; functionsNames: WidgetProviderFunctionValues; functionsColors: WidgetProviderFunctionValues; functions: WidgetProviderFunctions; auth: WidgetProviderAuthSettings; initialFlow: boolean; initialFlowId: string | null; textVoiceLines: string[]; voiceConfig: Record; iconSize: string; theme: WidgetProviderThemeSettings; flow?: any; locale: string; voiceRemoteAddress: string; voiceDevice: string; voiceCode: string; buttonType: string; whatsapp: WidgetProviderWhatsappSettings; customButtonIcon: string; logoUrl: string; } /** A provider configuration entity returned by the Chat Config API. */ type ProviderConfiguration = { id: string; isAssistanceEnabled: boolean; rewind: number; companyId: string; active: boolean; priority: number | null; providerId: string; configurations: WhatsAppProviderSettings | WidgetProviderSettings; inbound: boolean; outbound: boolean; deletedAt: string | null; csatConditionalRulesEnabled: boolean; csatFeedbackTTL: number | null; createdAt: string; updatedAt: string; }; /** Response returned by the Chat Config API when listing provider configurations. */ interface ProviderConfigurationsResponse { data: ProviderConfiguration[]; } /** Query parameters for retrieving provider configuration display info. */ interface GetProviderDisplayInfoParams { /** Provider identifier (e.g. `whatsapp`, `gmail`, `outlook`). */ provider: ProviderName | string; /** Configuration identifier. */ configId: string; } /** * Normalized display info for a provider configuration. * `channel` is the human-facing address (phone, email, handle) when available; otherwise `null`. */ interface ProviderDisplayInfoResponse { id: string; provider: ProviderName | string; name: string; channel: string | null; } /** A provider entity nested within a configuration response. */ interface ConfigProvider { id: string; name: string; type: string; defaultSession: number; configurationsSchema: Record | null; createdAt: string; updatedAt: string; } /** A configuration entity returned by the Chat Config API. */ interface Config { id: string; isAssistanceEnabled: boolean; rewind: number | null; companyId: string; active: boolean; configurations: Record; priority: number | null; inbound: boolean; outbound: boolean; deletedAt: string | null; providers: ConfigProvider; } /** Response returned by the Chat Config API when listing configurations by provider. */ interface ConfigListByProviderResponse { configurations: Config[]; } /** Query parameters for filtering configurations by provider. */ interface GetConfigsByProviderParams { isAssistanceEnabled?: boolean; rewind?: number; active?: boolean; priority?: number; inbound?: boolean; outbound?: boolean; providerType?: string; providerName?: string; } /** Query parameters for listing queue memberships of a member. */ interface GetMemberQueuesRequest { memberId: string; association?: boolean; } /** Queue membership entry returned by the Chat Config API. */ interface QueueMember { id: string; memberId: string; priority: number; permission: string; lastAttendance: string | null; lastInvite: string | null; paused: boolean; activeChat: number; online: boolean; companyId: string; avatar: string; username: string; createdAt: string; updatedAt: string; queueId: string; queue?: Queue; } /** Distribution type associated with a queue. */ type DistributionType = { id: string; alias: string; description: string; createdAt: string; updatedAt: string; }; /** Queue entity returned by the Chat Config API. */ interface Queue { id: string; distributionTypeId: string; companyId: string; name: string; strategy: 'leastrecent' | 'roundrobin' | 'random'; defaultQueue: boolean; unlimitedService: boolean; serviceLimit: number; timeLimit: number; skipOncallUsers: boolean; csat: boolean; csatAnswer: string; csatTTL: number; csatConditionalRulesEnabled: boolean; csatFeedbackTTL: number | null; outsideBusinessHourMessage: string; createCallbackOnExpired: boolean; createCallbackOnOutsideBusinessHours: boolean; archived: boolean; isPrivate: boolean; createdAt: string; updatedAt: string; members: QueueMember[]; distributionType: DistributionType; csatConditionalRules: Record[]; } interface QueueListResponse { queues: Queue[]; } interface GetServiceGroupsParams { id: string | string[]; companyId?: string; } interface ServiceGroup extends Queue { } interface ServiceGroupsResponse { data: ServiceGroup[]; } /** Representation of a button in a Meta template. */ interface MetaTemplateButton { /** Unique identifier of the button. */ id: string; /** Type of the button (e.g. 'URL', 'PHONE_NUMBER', 'QUICK_REPLY'). */ type: string; /** Text displayed on the button. */ text: string; /** Value of the button (e.g. URL or phone number). */ value?: string | null; /** Dynamic variable of the button. */ variable?: string | null; /** ID of the template configuration to which the button belongs. */ templateConfigId: string; /** Creation date of the record. */ createdAt?: string; /** Update date of the record. */ updatedAt?: string; } /** Detailed configuration of a Meta template. */ interface MetaTemplateConfigResponse { /** Unique identifier of the template configuration. */ id: string; /** Name of the template in Meta. */ name: string; /** Identifier of the template in Meta. */ templateId: string; /** Company identifier in Meta. */ companyId: string; /** Format of the template (e.g. TEXT, IMAGE, VIDEO). */ format?: string | null; /** Content of the template header. */ headerContent?: string | null; /** Defines if the header has dynamic content (parameters). */ isDynamicHeader: boolean; /** Type of the header (e.g. TEXT, IMAGE, DOCUMENT, VIDEO). */ headerType?: string | null; /** Content of the template body. */ bodyContent?: string | null; /** Type of the body (e.g. TEXT). */ bodyType?: string | null; /** Content of the template footer. */ footerContent?: string | null; /** Type of the footer (e.g. TEXT). */ footerType?: string | null; /** ID of the configuration associated with the template. */ configId?: string | null; /** ID of the provider associated with the template. */ providerId?: string | null; /** Creation date of the record. */ createdAt?: string; /** Update date of the record. */ updatedAt?: string; /** List of buttons in the template. */ buttons?: MetaTemplateButton[]; } /** Response containing the list of template configurations associated with a configuration. */ interface MetaTemplateConfigsResponse { /** List of Meta template configurations. */ templatesConfig: MetaTemplateConfigResponse[]; } /** Request payload for finding or creating a queue rule. */ interface FindOrCreateQueueRuleRequest { companyId: string; queueId: string; configId: string; } /** Response returned when finding or creating a queue rule. */ interface QueueRule extends Rule { flow?: Record[]; } type GetRootRulesRequest = { companyId: string; offset: number; limit: number; name?: string; }; interface Rule { id: string; companyId: string; name: string; action: string; message: string; automaticMessage: { messageBody: string; caption: string | null; messageType: string; } | null; callOnQueue: Record | null; uraDescription: string; interactiveMessageId: string | null; configId: string | null; queueId: string | null; redirectQueue: Record | null; redirectRuleId: string | null; questionnaire: Record; webhook: Record | null; isRoot: boolean; redirectDefault: boolean; redirectTimeout: number; delay: number | null; disableTyping: boolean; archivedAt: string | null; autoTagEnabled: boolean; autoTagIds: string[]; createdAt: string; updatedAt: string; } /** Response returned by the Chat Config API when listing root rules. */ type RootRulesResponse = { data: Rule[]; }; export type { Config, ConfigListByProviderResponse, ConfigProvider, DistributionType, FindOrCreateQueueRuleRequest, GetConfigsByProviderParams, GetMemberQueuesRequest, GetProviderConfigurationsParams, GetProviderDisplayInfoParams, GetRootRulesRequest, GetServiceGroupsParams, MetaTemplateButton, MetaTemplateConfigResponse, MetaTemplateConfigsResponse, Provider, ProviderConfiguration, ProviderConfigurationsResponse, ProviderDisplayInfoResponse, ProviderListResponse, ProviderName, Queue, QueueListResponse, QueueMember, QueueRule, RootRulesResponse, Rule, ServiceGroup, ServiceGroupsResponse, WhatsAppProviderSettings, WidgetProviderSettings };