/** Query parameters for listing chat invitations. */ interface ListInvitationsRequest { opensUserId: string; companyId: string; replied: boolean; expired: boolean; } /** Request payload for replying to a chat invitation. */ interface ReplyInvitationRequest { id: number; } /** Request payload for canceling a chat invitation. */ interface CancelInvitationRequest { delegatorId: string; } /** Chat invitation returned by the Chat Webservice API. */ interface InvitationResponse { id: number; chatRoomId: number; companyId: string; replied: boolean; expired: boolean; opensUserId: string; delegatorId: string; type: string; expiresAt: string | null; createdAt: string; updatedAt: string; provider: string; duration: number; roomCreatedAt: string; } /** Query parameters for listing live rooms assigned to a user. */ interface ListLiveUserRoomsRequest { recipientId: string; companyId: string; isOpen: boolean; } /** Query parameters for fetching a room by its identifier. */ interface GetRoomByIdRequest { companyId?: string; includeMembers?: boolean; } /** Date range used to determine room activity windows. */ interface RoomActiveDates { gte: string; lte: string; } /** Tag associated with a chat room. */ interface RoomTagResponse { id: string; chatRoomId: number; tagId: number; tagName: string; companyId: string; createdAt: string; updatedAt: string; } /** Member participating in a chat room. */ interface RoomMemberResponse { id: number; exited: boolean; new: boolean; recipientId: string; subject?: string; origin: string; chatRoomId: number; externalClientId?: string; provider: string; providerAccessToken?: string; channel: string; companyId: string; createdAt: string; updatedAt: string; } /** Chat room entity returned by the Chat Webservice API. */ interface RoomResponse { id: number; subject: string; companyId: string; chatConfigId: string; status: string; open: boolean; inTransfer: boolean; closedBy: string; latestTransferId: string; waitTime: number; attendanceTime: number; score: number; csatFeedback?: string | null; currentRule: string; queueId: string; campaignId?: string; createdBy: string; creatorProvider: string; lastClientMsgAt: string; lastOperatorMsgAt: string; createdAt: string; updatedAt: string; inactivityLimit: number; wasTransferred: boolean; wasFinishedSilently: boolean; type: string; answeredAt: string; protocol: string; activeDates: RoomActiveDates; activeWeekDays: number[]; priority: number; topic: string; routedAt: string; locale: string; tags?: RoomTagResponse[]; members?: RoomMemberResponse[]; new?: boolean; unreadMessagesCount?: number; } /** Live room entry for a user, including membership metadata and the nested room. */ interface LiveUserRoomResponse { id: number; recipientId: string; unreadMessagesCount: string | number; exited: boolean; new: boolean; provider: string; channel: string; room: RoomResponse; } /** Attachment metadata associated with a chat message. */ interface MessageAttachment { id: string; key: string; bucket: string; filename: string; type: string; contentType: string; link?: string; } /** Status entry tracking delivery/read state of a chat message. */ interface MessageStatusResponse { id: number; status: string; message: unknown; createdAt: string; updatedAt: string; chatRoomMessageId: number; chatRoomId: number; chatRoomMemberId: number; attachmentIndex: number | null; } /** Reaction applied to a chat message. */ interface MessageReactionResponse { id: number; emoji: string; chatRoomId: number; chatRoomMessageId: number; chatRoomMemberId: number; createdAt: string; updatedAt: string; } /** Compact representation of the message being replied to. */ interface MessageReplyContext { id: number; messageType: string; messageBody: string; filename?: string; createdAt: string; } /** Optional metadata associated with a chat message. */ interface MessageMetadata { isExternalInit?: boolean; privateReason?: string; hiddenByOperatorId?: string; hiddenByOperatorName?: string; hiddenAt?: string; forwarding?: ForwardMessageForwardingMetadata; [key: string]: unknown; } /** Chat message entity returned by the Chat Webservice API. */ interface MessageResponse { id: number; chatRoomId: number; chatRoomMemberId: number; companyId: string; secretId: unknown; messageHeader: string; messageBody: string; messageFooter: unknown; caption: unknown; messageHeaderType: string; messageType: string; messageFooterType: unknown; subject: unknown; origin: unknown; recipientId: string; provider: string; providerId: string; canBeInteractedWith: boolean; buttons: unknown; replyingToId?: number; attachments: unknown; createdAt: string; updatedAt: string; topic: unknown; isPrivate: boolean; metadata?: MessageMetadata | null; carousel?: { data?: unknown[]; }; status: MessageStatusResponse[]; reactions: MessageReactionResponse[]; replyingTo?: MessageReplyContext; echo?: string; } /** Query parameters for fetching the initial message context of a room. */ interface GetInitialContextRequest { companyId: string; chatRoomId: number; chatRoomMemberId: number; limit?: number; associations?: string[]; } /** Paginated initial context response centered around unread messages. */ interface GetInitialContextResponse { data: MessageResponse[]; meta: { count: number; oldestCursor: number; newestCursor: number; lastUnreadMessageId: number | null; hasMoreBefore: boolean; hasMoreAfter: boolean; }; } /** Query parameters for cursor-based message pagination. */ interface GetMessagesByCursorRequest { companyId: string; chatRoomId: number; beforeId?: number; afterId?: number; limit?: number; associations?: string[]; } /** Paginated response for cursor-based message listing. */ interface GetMessagesByCursorResponse { data: MessageResponse[]; meta: { hasMore: boolean; count: number; oldestCursor: number; newestCursor: number; hasMoreBefore?: boolean; hasMoreAfter?: boolean; }; } /** Request payload for sending a chat message. */ interface SendMessageRequest { recipientId: string; origin: string; channel: string; provider: string; chatRoomId: number; companyId: string; messageBody?: string; messageType: string; chatRoomMemberId: number; attachments?: { data: MessageAttachment[]; }; replyingToId?: number; } /** Destination contact metadata used when forwarding a chat message. */ interface ForwardMessageDestination { contactId: string; contactName: string | null; email: string; avatar: unknown | null; } /** Forwarding metadata attached to a chat message payload. */ interface ForwardMessageForwardingMetadata { requested: boolean; type: string; provider: string; sourceMessageId: number; sourceChatRoomId: number; destination: ForwardMessageDestination[]; } /** Optional metadata associated with a forwarded chat message request. */ interface ForwardMessageMetadata { forwarding?: ForwardMessageForwardingMetadata; [key: string]: unknown; } /** Request payload for creating a forwarded chat message. */ interface ForwardMessageRequest { companyId: string; chatRoomId: number; messageBody: string; recipientId?: string; origin?: string; channel?: string; provider?: string; messageType?: string; chatRoomMemberId?: number; replyingToId?: number; metadata?: ForwardMessageMetadata; } /** Response returned when sending an attachment message. */ interface SendAttachmentMessageResponse { message: MessageResponse; } /** Request payload for marking specific messages as read. */ interface MarkMessagesAsReadRequest { chatRoomId: number; chatRoomMemberId: number; chatRoomMessageId: number[]; status: string; } /** Response returned after marking messages as read. */ interface MarkMessagesAsReadResponse { updatedMessageStatus: MessageStatusResponse[]; } /** Request payload for updating a room member. */ interface UpdateMemberInRoomRequest { new?: boolean; } /** Query parameters for fetching company chat and email usage. */ interface ChatWebserviceCompanyUsageRequest { createdGte?: string; createdLte?: string; } /** Usage totals split by inbound and outbound entries in the Chat Webservice API. */ interface ChatWebserviceCompanyUsageEntryResponse { inbound: number; outbound: number; } /** Provider usage totals for chat attendances in the Chat Webservice API. */ interface ChatWebserviceChatUsageProvidersResponse { whatsapp: number; yunique: number; messenger: number; direct: number; } /** Provider usage totals for email attendances in the Chat Webservice API. */ interface ChatWebserviceEmailUsageProvidersResponse { gmail: number; outlook: number; } /** Chat usage totals returned by the Chat Webservice API. */ interface ChatWebserviceChatUsageResponse { total: number; entry: ChatWebserviceCompanyUsageEntryResponse; providers: ChatWebserviceChatUsageProvidersResponse; } /** Email usage totals returned by the Chat Webservice API. */ interface ChatWebserviceEmailUsageResponse { total: number; entry: ChatWebserviceCompanyUsageEntryResponse; providers: ChatWebserviceEmailUsageProvidersResponse; } /** Company usage response returned by the Chat Webservice API. */ interface ChatWebserviceCompanyUsageResponse { data: { chat: ChatWebserviceChatUsageResponse; email: ChatWebserviceEmailUsageResponse; }; } export type { CancelInvitationRequest, ChatWebserviceChatUsageProvidersResponse, ChatWebserviceChatUsageResponse, ChatWebserviceCompanyUsageEntryResponse, ChatWebserviceCompanyUsageRequest, ChatWebserviceCompanyUsageResponse, ChatWebserviceEmailUsageProvidersResponse, ChatWebserviceEmailUsageResponse, ForwardMessageDestination, ForwardMessageForwardingMetadata, ForwardMessageMetadata, ForwardMessageRequest, GetInitialContextRequest, GetInitialContextResponse, GetMessagesByCursorRequest, GetMessagesByCursorResponse, GetRoomByIdRequest, InvitationResponse, ListInvitationsRequest, ListLiveUserRoomsRequest, LiveUserRoomResponse, MarkMessagesAsReadRequest, MarkMessagesAsReadResponse, MessageAttachment, MessageMetadata, MessageReactionResponse, MessageReplyContext, MessageResponse, MessageStatusResponse, ReplyInvitationRequest, RoomActiveDates, RoomMemberResponse, RoomResponse, RoomTagResponse, SendAttachmentMessageResponse, SendMessageRequest, UpdateMemberInRoomRequest };