import { RulesLogic } from 'json-logic-js'; type AgentToolSource = { type: 'builtin'; } | { type: 'custom'; } | { type: 'mcp'; serverName: string; }; type AgentToolResultContent = { type: 'text'; text: string; } | { type: 'citation'; url: string; title?: string; excerpts?: string[]; } | { type: 'json'; value: unknown; } | { type: 'media'; mediaType: string; data: string; name?: string; } | { type: 'unknown'; providerType: string; data: Record; }; type AgentMessageContent = { markdown: string; } | { card: Record; }; interface AgentFileRef { fileId: string; name?: string; mediaType?: string; /** Transitional: inline base64 payload until the pre-upload path ships. Same 5 MB limit as the reply API. */ data?: string; /** Transitional: publicly-accessible URL until the pre-upload path ships. Same limits as the reply API. */ url?: string; } type AgentMessageRole = 'user' | 'assistant'; type AgentMessageStatus = 'sending' | 'sent' | 'failed'; type AgentTextPartState = 'streaming' | 'done'; type AgentToolPartState = 'input-streaming' | 'input-available' | 'output-available' | 'output-error'; type AgentApprovalPartState = 'pending' | 'approved' | 'denied'; type AgentTextPart = { type: 'text'; text: string; state: AgentTextPartState; }; type AgentThinkingPart = { type: 'thinking'; thinkingId: string; text: string; state: AgentTextPartState; }; type AgentToolPart = { type: 'tool'; toolUseId: string; toolName: string; source?: AgentToolSource; input?: Record; output?: AgentToolResultContent[]; state: AgentToolPartState; }; type AgentApprovalPart = { type: 'approval'; approvalId: string; toolUseId: string; toolName: string; input?: Record; source?: AgentToolSource; state: AgentApprovalPartState; }; type AgentSourcePart = { type: 'source'; sourceType: 'url' | 'document'; url?: string; title?: string; filename?: string; }; type AgentFilePart = { type: 'file'; fileId: string; name?: string; mediaType?: string; }; type AgentCardPart = { type: 'card'; card: Record; }; type AgentMessagePart = AgentTextPart | AgentThinkingPart | AgentToolPart | AgentApprovalPart | AgentSourcePart | AgentFilePart | AgentCardPart; type AgentMessage = { id: string; role: AgentMessageRole; parts: AgentMessagePart[]; createdAt: string; status: AgentMessageStatus; }; declare const AGENT_EVENT_PROTOCOL_VERSION: 1; interface AgentEventUsage { inputTokens?: number; outputTokens?: number; totalTokens?: number; } type AgentRunOutcome = 'completed' | 'paused' | 'aborted'; type AgentFinishReason = 'stop' | 'length' | 'refused' | 'other'; interface AgentApprovalRequest { approvalId: string; toolUseId: string; toolName: string; input?: Record; source?: AgentToolSource; } type AgentSignal = { type: 'metadata'; action: 'set'; key: string; value: unknown; } | { type: 'metadata'; action: 'delete'; key: string; } | { type: 'metadata'; action: 'clear'; } | { type: 'trigger'; workflowId: string; to?: unknown; payload?: Record; }; type AgentEvent = { type: 'run-start'; } | { type: 'run-finish'; outcome: AgentRunOutcome; finishReason?: AgentFinishReason; usage?: AgentEventUsage; approvals?: AgentApprovalRequest[]; } | { type: 'run-error'; message: string; code?: string; } | { type: 'step-start'; name?: string; index?: number; } | { type: 'step-end'; name?: string; index?: number; usage?: AgentEventUsage; } | { type: 'message'; messageId: string; /** Who authored this durable message. Streaming events stay assistant-only and omit role. */ role: AgentMessageRole; content: AgentMessageContent; files?: AgentFileRef[]; } | { type: 'message-start'; messageId: string; } | { type: 'message-delta'; messageId: string; delta: string; } | { type: 'message-end'; messageId: string; content?: AgentMessageContent; files?: AgentFileRef[]; } | { type: 'thinking-start'; thinkingId: string; } | { type: 'thinking-delta'; thinkingId: string; delta: string; } | { type: 'thinking-end'; thinkingId: string; } | { type: 'source'; messageId: string; sourceType: 'url' | 'document'; url?: string; title?: string; filename?: string; } | { type: 'tool-use-start'; toolUseId: string; toolName: string; source?: AgentToolSource; } | { type: 'tool-use-delta'; toolUseId: string; delta: string; } | { type: 'tool-use-done'; toolUseId: string; toolName: string; input?: Record; source?: AgentToolSource; } | { type: 'tool-use-result'; toolUseId: string; content: AgentToolResultContent[]; isError?: boolean; } | ({ type: 'tool-approval-request'; /** When true, no companion message carries the approval UI. The consumer should render its default approval card. */ deliverCard?: boolean; } & AgentApprovalRequest) | { type: 'tool-approval-response'; approvalId: string; decision: 'approved' | 'denied'; reason?: string; automatic?: boolean; } | { type: 'resolve'; summary?: string; } | { type: 'signal'; signal: AgentSignal; } | { type: 'channel.typing'; state: 'on' | 'off'; status?: string; } | { type: 'channel.edit'; messageId: string; content: AgentMessageContent; files?: AgentFileRef[]; } | { type: 'channel.delete'; messageId: string; } | { type: 'channel.reaction'; messageId: string; emoji: string; op: 'add' | 'remove'; } | { type: 'connection.error'; source: 'mcp'; serverName: string; reason: 'authentication' | 'connection'; message: string; } | { type: 'custom'; name: string; data: unknown; }; interface AgentEventEnvelope { version: typeof AGENT_EVENT_PROTOCOL_VERSION; conversationId: string; /** Public `conv_*` identifier. Clients receive only this id, never `conversationId`. */ conversationIdentifier?: string; agentId: string; runId: string; turnId: string; sequence: number; timestamp: string; event: AgentEvent; } type HttpClientOptions = { apiVersion?: string; apiUrl?: string; headers?: Record; }; declare class HttpClient { private DEFAULT_BACKEND_URL; private apiUrl; private apiVersion; private headers; constructor(options?: HttpClientOptions); setAuthorizationToken(token: string): void; setKeylessHeader(identifier?: string): void; setHeaders(headers: Record): void; get(path: string, searchParams?: URLSearchParams, unwrapEnvelope?: boolean): Promise; post(path: string, body?: any, options?: RequestInit): Promise; patch(path: string, body?: any): Promise; delete(path: string, body?: any): Promise; private doFetch; } declare class NovuError extends Error { originalError: Error; constructor(message: string, originalError: unknown); } type SendMessageArgs = { agentId: string; text: string; /** * Existing conversation to append to. * Omit this field to create a new conversation. The client does not reuse a prior chat. * After create, pass the returned `conversationId` on later sends. */ conversationId?: string; /** * Immutable holder key for the local store and emit subscription. * Defaults to `conversationId` on resume, or a minted `local_*` key on create. */ key?: string; }; type SendMessageResult = { conversationId: string; messageId: string; }; type LoadConversationArgs = { agentId: string; conversationId: string; }; type LoadConversationResult = { conversationId: string; messages: AgentMessage[]; }; type AgentChatMessagesUpdated = { agentId: string; conversationId?: string; /** Immutable holder key. Stable for the life of the local conversation entry. */ key: string; messages: AgentMessage[]; }; type ListPreferencesArgs = { tags?: string[]; severity?: SeverityLevelEnum | SeverityLevelEnum[]; criticality?: WorkflowCriticalityEnum; }; type BasePreferenceArgs = { workflowId: string; channels: ChannelPreference; }; type InstancePreferenceArgs = { preference: Preference; channels: ChannelPreference; }; type UpdatePreferenceArgs = BasePreferenceArgs | InstancePreferenceArgs; type UpdateScheduleArgs = { isEnabled?: boolean; weeklySchedule?: WeeklySchedule; }; declare class PreferencesCache { #private; constructor({ emitterInstance }: { emitterInstance: NovuEventEmitter; }); private updatePreference; private updatePreferenceSchedule; private handleScheduleEvent; private handlePreferenceEvent; has(args: ListPreferencesArgs): boolean; set(args: ListPreferencesArgs, data: Preference[]): void; getAll(args: ListPreferencesArgs): Preference[] | undefined; clearAll(): void; } type ScheduleLike = Partial>; declare class Schedule { #private; readonly isEnabled: boolean | undefined; readonly weeklySchedule: WeeklySchedule | undefined; constructor(schedule: ScheduleLike, { emitterInstance, inboxServiceInstance, cache, useCache, }: { emitterInstance: NovuEventEmitter; inboxServiceInstance: InboxService; cache: ScheduleCache; useCache: boolean; }); update(args: UpdateScheduleArgs): Result; } declare class ScheduleCache { #private; constructor({ emitterInstance }: { emitterInstance: NovuEventEmitter; }); private updateScheduleInCache; private handleScheduleEvent; has(): boolean; set(data: Schedule): void; getAll(): Schedule | undefined; clearAll(): void; } type PreferenceLike = Pick & { schedule?: ScheduleLike; }; declare class Preference { #private; readonly level: PreferenceLevel; readonly enabled: boolean; readonly channels: ChannelPreference; readonly workflow?: Workflow; schedule: Schedule; constructor(preference: PreferenceLike, { emitterInstance, inboxServiceInstance, cache, scheduleCache, useCache, }: { emitterInstance: NovuEventEmitter; inboxServiceInstance: InboxService; cache: PreferencesCache; scheduleCache: ScheduleCache; useCache: boolean; }); update({ channels, channelPreferences, }: Prettify & { /** @deprecated Use channels instead */ channelPreferences?: ChannelPreference; }>): Result; } type KeylessInitializeSessionArgs = {} & { [K in string]?: never; }; type InitializeSessionArgs = KeylessInitializeSessionArgs | { applicationIdentifier: string; subscriber: Subscriber; subscriberHash?: string; contextHash?: string; defaultSchedule?: DefaultSchedule; context?: Context; }; declare class SubscriptionPreference { #private; readonly subscriptionId: string; readonly workflow: Workflow; readonly enabled: boolean; readonly condition?: RulesLogic; constructor(preference: SubscriptionPreferenceResponse, emitter: NovuEventEmitter, inboxService: InboxService, cache: SubscriptionsCache, useCache?: boolean); update(args: { value: boolean | RulesLogic; }): Result; } type WorkflowIdentifierOrId = string; type WorkflowFilter = { workflowId: WorkflowIdentifierOrId; enabled?: boolean; condition?: RulesLogic; filter?: never; }; type WorkflowGroupFilter = { filter: { workflowIds?: Array; tags?: string[]; }; enabled?: boolean; condition?: RulesLogic; workflowId?: never; }; type PreferenceFilter = WorkflowIdentifierOrId | WorkflowFilter | WorkflowGroupFilter; type ListSubscriptionsArgs = { topicKey: string; }; type GetSubscriptionArgs = { topicKey: string; identifier?: string; workflowIds?: string[]; tags?: string[]; }; type CreateSubscriptionArgs = { topicKey: string; topicName?: string; identifier?: string; name?: string; preferences?: Array | undefined; }; type BaseUpdateSubscriptionArgs = { topicKey: string; identifier: string; name?: string; preferences?: Array; }; type InstanceUpdateSubscriptionArgs = { subscription: TopicSubscription; name?: string; preferences?: Array; }; type UpdateSubscriptionArgs = BaseUpdateSubscriptionArgs | InstanceUpdateSubscriptionArgs; type BaseSubscriptionPreferenceArgs = { workflowId: string; value: boolean | RulesLogic; }; type InstanceSubscriptionPreferenceArgs = { preference: SubscriptionPreference; value: boolean | RulesLogic; }; type UpdateSubscriptionPreferenceArgs = BaseSubscriptionPreferenceArgs | InstanceSubscriptionPreferenceArgs; type BaseDeleteSubscriptionArgs = { identifier: string; topicKey: string; }; type InstanceDeleteSubscriptionArgs = { subscription: TopicSubscription; }; type DeleteSubscriptionArgs = BaseDeleteSubscriptionArgs | InstanceDeleteSubscriptionArgs; declare class SubscriptionsCache { #private; constructor({ emitterInstance, inboxServiceInstance, useCache, }: { emitterInstance: NovuEventEmitter; inboxServiceInstance: InboxService; useCache: boolean; }); private handleCreate; private handleUpdate; private handlePreferenceUpdate; private handleBulkPreferenceUpdate; private updateSubscriptionPreferences; private createUpdatedSubscription; private handleDelete; private handleDeleteByIdentifier; has(args: ListSubscriptionsArgs): boolean; set(args: ListSubscriptionsArgs, data: TopicSubscription[]): void; setOne(args: GetSubscriptionArgs, data: TopicSubscription): void; getAll(args: ListSubscriptionsArgs): TopicSubscription[] | undefined; get(args: GetSubscriptionArgs): TopicSubscription | undefined; invalidate(args: { topicKey: string; }): void; clearAll(): void; } declare class TopicSubscription { #private; readonly id: string; readonly identifier: string; readonly topicKey: string; readonly preferences?: Array | undefined; constructor(subscription: SubscriptionResponse & { topicKey: string; }, emitter: NovuEventEmitter, inboxService: InboxService, cache: SubscriptionsCache, useCache?: boolean); update(args: BaseUpdateSubscriptionArgs): Result; update(args: InstanceUpdateSubscriptionArgs): Result; updatePreference(args: BaseSubscriptionPreferenceArgs): Result; updatePreference(args: InstanceSubscriptionPreferenceArgs): Result; bulkUpdatePreferences(args: Array): Result; bulkUpdatePreferences(args: Array): Result; delete(): Result; } type NovuPendingEvent = { args: A; data?: D; }; type NovuResolvedEvent = NovuPendingEvent & { error?: unknown; }; type EventName = `${T}.pending` | `${T}.resolved`; type EventStatus = `${T extends `${infer _}.${infer __}.${infer V}` ? V : never}`; type EventObject> = EVENT_STATUS extends 'pending' ? NovuPendingEvent : NovuResolvedEvent; type BaseEvents = { [key in `${EventName}`]: EventObject; }; type SessionInitializeEvents = BaseEvents<'session.initialize', InitializeSessionArgs, Session>; type NotificationsFetchEvents = BaseEvents<'notifications.list', ListNotificationsArgs, ListNotificationsResponse>; type NotificationsFetchCountEvents = BaseEvents<'notifications.count', CountArgs, CountResponse>; type NotificationReadEvents = BaseEvents<'notification.read', ReadArgs, Notification>; type NotificationUnreadEvents = BaseEvents<'notification.unread', UnreadArgs, Notification>; type NotificationSeenEvents = BaseEvents<'notification.seen', SeenArgs, Notification>; type NotificationArchiveEvents = BaseEvents<'notification.archive', ArchivedArgs, Notification>; type NotificationUnarchiveEvents = BaseEvents<'notification.unarchive', UnarchivedArgs, Notification>; type NotificationDeleteEvents = BaseEvents<'notification.delete', DeletedArgs, Notification>; type NotificationSnoozeEvents = BaseEvents<'notification.snooze', SnoozeArgs, Notification>; type NotificationUnsnoozeEvents = BaseEvents<'notification.unsnooze', UnsnoozeArgs, Notification>; type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>; type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>; type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', { tags?: TagsFilter; data?: Record; }, Notification[]>; type NotificationsSeenAllEvents = BaseEvents<'notifications.seen_all', { notificationIds: string[]; } | { tags?: TagsFilter; data?: Record; } | {}, Notification[]>; type NotificationsArchivedAllEvents = BaseEvents<'notifications.archive_all', { tags?: TagsFilter; data?: Record; }, Notification[]>; type NotificationsReadArchivedAllEvents = BaseEvents<'notifications.archive_all_read', { tags?: TagsFilter; data?: Record; }, Notification[]>; type NotificationsDeletedAllEvents = BaseEvents<'notifications.delete_all', { tags?: TagsFilter; data?: Record; }, Notification[]>; type PreferencesFetchEvents = BaseEvents<'preferences.list', ListPreferencesArgs, Preference[]>; type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferenceArgs, Preference>; type PreferencesBulkUpdateEvents = BaseEvents<'preferences.bulk_update', Array, Preference[]>; type PreferenceScheduleGetEvents = BaseEvents<'preference.schedule.get', undefined, Schedule>; type PreferenceScheduleUpdateEvents = BaseEvents<'preference.schedule.update', UpdateScheduleArgs, Schedule>; type SubscriptionsFetchEvents = BaseEvents<'subscriptions.list', ListSubscriptionsArgs, TopicSubscription[]>; type SubscriptionGetEvents = BaseEvents<'subscription.get', GetSubscriptionArgs, TopicSubscription | null>; type SubscriptionCreateEvents = BaseEvents<'subscription.create', CreateSubscriptionArgs, TopicSubscription>; type SubscriptionUpdateEvents = BaseEvents<'subscription.update', UpdateSubscriptionArgs, TopicSubscription>; type SubscriptionPreferenceUpdateEvents = BaseEvents<'subscription.preference.update', UpdateSubscriptionPreferenceArgs, SubscriptionPreference>; type SubscriptionPreferencesBulkUpdateEvents = BaseEvents<'subscription.preferences.bulk_update', Array, SubscriptionPreference[]>; type SubscriptionDeleteEvents = BaseEvents<'subscription.delete', DeleteSubscriptionArgs, void>; type ChannelConnectionOAuthUrlEvents = BaseEvents<'channel-connection.oauth-url', GenerateChatOAuthUrlArgs, { url: string; }>; type ChannelConnectionsFetchEvents = BaseEvents<'channel-connections.list', ListChannelConnectionsArgs, ChannelConnectionResponse[]>; type ChannelConnectionGetEvents = BaseEvents<'channel-connection.get', GetChannelConnectionArgs, ChannelConnectionResponse | null>; type ChannelConnectionDeleteEvents = BaseEvents<'channel-connection.delete', DeleteChannelConnectionArgs, void>; type ChannelEndpointOAuthUrlEvents = BaseEvents<'channel-endpoint.oauth-url', GenerateLinkUserOAuthUrlArgs, { url: string; }>; type ChannelEndpointsFetchEvents = BaseEvents<'channel-endpoints.list', ListChannelEndpointsArgs, ChannelEndpointResponse[]>; type ChannelEndpointGetEvents = BaseEvents<'channel-endpoint.get', GetChannelEndpointArgs, ChannelEndpointResponse | null>; type ChannelEndpointCreateEvents = BaseEvents<'channel-endpoint.create', CreateChannelEndpointArgs, ChannelEndpointResponse>; type ChannelEndpointDeleteEvents = BaseEvents<'channel-endpoint.delete', DeleteChannelEndpointArgs, void>; type ChannelEndpointLinkEvents = BaseEvents<'channel-endpoint.link', LinkChannelEndpointArgs, LinkChannelEndpointResponse>; type SocketConnectEvents = BaseEvents<'socket.connect', { socketUrl: string; }, undefined>; type NotificationReceivedEvent = `notifications.${WebSocketEvent.RECEIVED}`; type NotificationUnseenEvent = `notifications.${WebSocketEvent.UNSEEN}`; type NotificationUnreadEvent = `notifications.${WebSocketEvent.UNREAD}`; type SocketEvents = { [key in NotificationReceivedEvent]: { result: Notification; }; } & { [key in NotificationUnseenEvent]: { result: number; }; } & { [key in NotificationUnreadEvent]: { result: { total: number; severity: Record; }; }; }; type AgentChatEvents = { 'agent_chat.messages.updated': { data: AgentChatMessagesUpdated; }; }; /** * Events that are emitted by Novu Event Emitter. * * The event name consists of second pattern: module.action.status * - module: the name of the module * - action: the action that is being performed * - status: the status of the action, could be pending or resolved * * Each event has a corresponding payload that is associated with the event: * - pending: the args that are passed to the action and the optional optimistic value * - resolved: the args that are passed to the action and the result of the action or the error that is thrown */ type Events = SessionInitializeEvents & NotificationsFetchEvents & { 'notifications.list.updated': { data: ListNotificationsResponse; }; } & NotificationsFetchCountEvents & PreferencesFetchEvents & { 'preferences.list.updated': { data: Preference[]; }; } & PreferenceUpdateEvents & PreferencesBulkUpdateEvents & PreferenceScheduleGetEvents & PreferenceScheduleUpdateEvents & { 'preference.schedule.get.updated': { data: Schedule; }; } & SubscriptionsFetchEvents & SubscriptionGetEvents & SubscriptionCreateEvents & SubscriptionPreferenceUpdateEvents & SubscriptionUpdateEvents & SubscriptionPreferencesBulkUpdateEvents & SubscriptionDeleteEvents & { 'subscriptions.list.updated': { data: { topicKey: string; subscriptions: TopicSubscription[]; }; }; } & ChannelConnectionOAuthUrlEvents & ChannelConnectionsFetchEvents & ChannelConnectionGetEvents & ChannelConnectionDeleteEvents & ChannelEndpointOAuthUrlEvents & ChannelEndpointsFetchEvents & ChannelEndpointGetEvents & ChannelEndpointCreateEvents & ChannelEndpointDeleteEvents & ChannelEndpointLinkEvents & SocketConnectEvents & SocketEvents & AgentChatEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationSeenEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationDeleteEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsSeenAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents & NotificationsDeletedAllEvents; type EventNames = keyof Events; type SocketEventNames = keyof SocketEvents; type EventHandler = (event: T) => void; declare class NovuEventEmitter { #private; constructor(); on(eventName: Key, listener: EventHandler): () => void; off(eventName: Key, listener: EventHandler): void; emit(type: Key, event?: Events[Key]): void; } declare class Notification implements Pick, InboxNotification { #private; readonly id: InboxNotification['id']; readonly transactionId: InboxNotification['transactionId']; readonly subject?: InboxNotification['subject']; readonly body: InboxNotification['body']; readonly to: InboxNotification['to']; readonly isRead: InboxNotification['isRead']; readonly isSeen: InboxNotification['isSeen']; readonly isArchived: InboxNotification['isArchived']; readonly isSnoozed: InboxNotification['isSnoozed']; readonly snoozedUntil?: InboxNotification['snoozedUntil']; readonly deliveredAt?: InboxNotification['deliveredAt']; readonly createdAt: InboxNotification['createdAt']; readonly readAt?: InboxNotification['readAt']; readonly firstSeenAt?: InboxNotification['firstSeenAt']; readonly archivedAt?: InboxNotification['archivedAt']; readonly avatar?: InboxNotification['avatar']; readonly primaryAction?: InboxNotification['primaryAction']; readonly secondaryAction?: InboxNotification['secondaryAction']; readonly channelType: InboxNotification['channelType']; readonly tags: InboxNotification['tags']; readonly redirect: InboxNotification['redirect']; readonly data?: InboxNotification['data']; readonly workflow?: InboxNotification['workflow']; readonly severity: InboxNotification['severity']; constructor(notification: InboxNotification, emitter: NovuEventEmitter, inboxService: InboxService); read(): Result; unread(): Result; seen(): Result; archive(): Result; unarchive(): Result; delete(): Result; snooze(snoozeUntil: string): Result; unsnooze(): Result; completePrimary(): Result; completeSecondary(): Result; revertPrimary(): Result; revertSecondary(): Result; on(eventName: Key, listener: EventHandler): () => void; /** * @deprecated * Use the cleanup function returned by the "on" method instead. */ off(eventName: Key, listener: EventHandler): void; } type ListNotificationsArgs = { tags?: TagsFilter; read?: boolean; data?: Record; archived?: boolean; snoozed?: boolean; seen?: boolean; severity?: SeverityLevelEnum | SeverityLevelEnum[]; limit?: number; after?: string; offset?: number; useCache?: boolean; createdGte?: number; createdLte?: number; }; type ListNotificationsResponse = { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter; }; type FilterCountArgs = { tags?: TagsFilter; data?: Record; read?: boolean; archived?: boolean; snoozed?: boolean; seen?: boolean; severity?: SeverityLevelEnum | SeverityLevelEnum[]; createdGte?: number; createdLte?: number; }; type FiltersCountArgs = { filters: Array<{ tags?: TagsFilter; read?: boolean; archived?: boolean; snoozed?: boolean; seen?: boolean; data?: Record; severity?: SeverityLevelEnum | SeverityLevelEnum[]; createdGte?: number; createdLte?: number; }>; }; type CountArgs = undefined | FilterCountArgs | FiltersCountArgs; type FilterCountResponse = { count: number; filter: NotificationFilter; }; type FiltersCountResponse = { counts: Array<{ count: number; filter: NotificationFilter; }>; }; type CountResponse = FilterCountResponse | FiltersCountResponse; type BaseArgs = { notificationId: string; }; type InstanceArgs = { notification: Notification; }; type ReadArgs = BaseArgs | InstanceArgs; type UnreadArgs = BaseArgs | InstanceArgs; type ArchivedArgs = BaseArgs | InstanceArgs; type UnarchivedArgs = BaseArgs | InstanceArgs; type DeletedArgs = BaseArgs | InstanceArgs; type SeenArgs = BaseArgs | InstanceArgs; type SnoozeArgs = (BaseArgs | InstanceArgs) & { snoozeUntil: string; }; type UnsnoozeArgs = BaseArgs | InstanceArgs; type CompleteArgs = BaseArgs | InstanceArgs; type RevertArgs = BaseArgs | InstanceArgs; declare global { /** * If you want to provide custom types for the notification.data object, * simply redeclare this rule in the global namespace. * Every notification object will use the provided type. */ interface NotificationData { [k: string]: unknown; } } declare enum NotificationStatus { READ = "read", SEEN = "seen", SNOOZED = "snoozed", UNREAD = "unread", UNSEEN = "unseen", UNSNOOZED = "unsnoozed" } declare enum PreferenceLevel { GLOBAL = "global", TEMPLATE = "template" } declare enum ChannelType { IN_APP = "in_app", EMAIL = "email", SMS = "sms", CHAT = "chat", PUSH = "push", TOOL = "tool" } declare enum WebSocketEvent { RECEIVED = "notification_received", UNREAD = "unread_count_changed", UNSEEN = "unseen_count_changed" } type SocketTypeOption = 'cloud' | 'self-hosted'; type NovuSocketOptions = { socketType?: SocketTypeOption; [key: string]: unknown; }; declare enum SeverityLevelEnum { HIGH = "high", MEDIUM = "medium", LOW = "low", NONE = "none" } declare enum WorkflowCriticalityEnum { CRITICAL = "critical", NON_CRITICAL = "nonCritical", ALL = "all" } type UnreadCount = { total: number; severity: Record; }; type Session = { token: string; /** @deprecated Use unreadCount.total instead */ totalUnreadCount: number; unreadCount: UnreadCount; removeNovuBranding: boolean; isDevelopmentMode: boolean; maxSnoozeDurationHours: number; applicationIdentifier?: string; contextKeys?: string[]; }; type Subscriber = { id?: string; subscriberId: string; firstName?: string; lastName?: string; email?: string; phone?: string; avatar?: string; locale?: string; data?: Record; timezone?: string; }; type Redirect = { url: string; target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'; }; declare enum ActionTypeEnum { PRIMARY = "primary", SECONDARY = "secondary" } type Action = { label: string; isCompleted: boolean; redirect?: Redirect; }; type Workflow = { id: string; identifier: string; name: string; critical: boolean; tags?: string[]; severity: SeverityLevelEnum; }; type TagsFilterOrGroup = { or: string[]; }; type TagsFilterAndForm = { and: TagsFilterOrGroup[]; }; /** * Inbox tag filter: a **single** OR-group as `string[]` or `{ or: string[] }`, or **multiple** OR-groups (AND of OR) as `{ and: [{ or: string[] }, ...] }`. * * @example Single OR-group — match notifications tagged `promo` **or** `sale` * ```ts * const tags: TagsFilter = ['promo', 'sale']; * ``` * * @example AND of OR-groups — match (`urgent` **or** `critical`) **and** (`billing`) * ```ts * const tags: TagsFilter = { * and: [{ or: ['urgent', 'critical'] }, { or: ['billing'] }], * }; * ``` */ type TagsFilter = string[] | TagsFilterOrGroup | TagsFilterAndForm; type InboxNotification = { id: string; transactionId: string; subject?: string; body: string; to: Subscriber; isRead: boolean; isSeen: boolean; isArchived: boolean; isSnoozed: boolean; snoozedUntil?: string | null; deliveredAt?: string[]; createdAt: string; readAt?: string | null; firstSeenAt?: string | null; archivedAt?: string | null; avatar?: string; primaryAction?: Action; secondaryAction?: Action; channelType: ChannelType; tags?: string[]; data?: NotificationData; redirect?: Redirect; workflow?: Workflow; severity: SeverityLevelEnum; }; type NotificationFilter = { tags?: TagsFilter; read?: boolean; archived?: boolean; snoozed?: boolean; seen?: boolean; /** * Filter notifications by keys in their `data` object. * * Each top-level key value can be: * - a scalar (exact equality) * - `Scalar[]` (OR — match any of the listed values) * - `{ or: Scalar[] }` (explicit OR) * - `{ and: [{ or: Scalar[] }, ...] }` (AND of OR-groups) * - a 1-level nested object whose sub-keys follow the same rules * * Across keys clauses are AND-ed together. */ data?: Record; severity?: SeverityLevelEnum | SeverityLevelEnum[]; createdGte?: number; createdLte?: number; }; type ChannelPreference = { email?: boolean; sms?: boolean; in_app?: boolean; chat?: boolean; push?: boolean; tool?: boolean; }; type TimeRange = { start: string; end: string; }; type DaySchedule = { isEnabled: boolean; hours?: Array; }; type WeeklySchedule = { monday?: DaySchedule; tuesday?: DaySchedule; wednesday?: DaySchedule; thursday?: DaySchedule; friday?: DaySchedule; saturday?: DaySchedule; sunday?: DaySchedule; }; type DefaultSchedule = { isEnabled?: boolean; weeklySchedule?: WeeklySchedule; }; type ContextValue = string | { id: string; data?: Record; }; type Context = Partial>; type PreferencesResponse = { level: PreferenceLevel; enabled: boolean; condition?: RulesLogic; subscriptionId?: string; channels: ChannelPreference; overrides?: IPreferenceOverride[]; workflow?: Workflow; schedule?: { isEnabled: boolean; weeklySchedule?: WeeklySchedule; }; }; declare enum PreferenceOverrideSourceEnum { SUBSCRIBER = "subscriber", TEMPLATE = "template", WORKFLOW_OVERRIDE = "workflowOverride" } type IPreferenceOverride = { channel: ChannelType; source: PreferenceOverrideSourceEnum; }; type SubscriptionPreferenceResponse = Omit & { subscriptionId: string; workflow: Workflow; }; type SubscriptionResponse = { id: string; identifier: string; name?: string; preferences?: Array; }; type Options = { refetch?: boolean; useCache?: boolean; }; type Result = Promise<{ data?: D; error?: E; }>; type KeylessNovuOptions = {} & { [K in string]?: never; }; type StandardNovuOptions = { /** @deprecated Use apiUrl instead */ backendUrl?: string; applicationIdentifier: string; subscriberHash?: string; contextHash?: string; apiUrl?: string; socketUrl?: string; /** * Custom socket configuration options. These options will be merged with the default socket configuration. * Use `socketType` to explicitly select the socket implementation: `'cloud'` for PartySocket or `'self-hosted'` for socket.io. * For socket.io-client connections, supports all socket.io-client options (e.g., `path`, `reconnectionDelay`, `timeout`, etc.). * For PartySocket connections, options are applied to the WebSocket instance. */ socketOptions?: NovuSocketOptions; useCache?: boolean; defaultSchedule?: DefaultSchedule; context?: Context; } & ({ /** @deprecated Use subscriber prop instead */ subscriberId: string; subscriber?: never; } | { subscriber: Subscriber | string; subscriberId?: never; }); type NovuOptions = KeylessNovuOptions | StandardNovuOptions; type Prettify = { [K in keyof T]: T[K]; } & {}; type ChannelConnectionResponse = { identifier: string; /** The provider workspace/team this connection is bound to. */ workspace?: { id: string; name?: string; botUserId?: string; }; /** ISO timestamp of when the connection was created. */ createdAt?: string; }; type ChannelEndpointResponse = { identifier: string; type: string; }; type OAuthMode = 'connect' | 'link_user'; type ConnectionMode = 'subscriber' | 'shared'; /** * @deprecated Use GenerateConnectOAuthUrlArgs or GenerateLinkUserOAuthUrlArgs instead. */ type GenerateChatOAuthUrlArgs = { integrationIdentifier: string; connectionIdentifier?: string; subscriberId?: string; context?: Context; scope?: string[]; userScope?: string[]; mode?: OAuthMode; connectionMode?: ConnectionMode; autoLinkUser?: boolean; }; /** Args for creating a workspace/tenant channel connection (Slack install or MS Teams admin consent). */ type GenerateConnectOAuthUrlArgs = { integrationIdentifier: string; connectionIdentifier?: string; subscriberId?: string; context?: Context; /** * HMAC-SHA256 of the canonicalized `context`, signed with the tenant environment * secret key (same "Inbox with context" signing). Required when connecting to a * `restricted` agent and the session did not already verify the context. */ contextHash?: string; /** Slack only: OAuth bot scopes to request. */ scope?: string[]; connectionMode?: ConnectionMode; autoLinkUser?: boolean; }; /** Args for linking a subscriber to their personal chat identity (Slack user or MS Teams user OID). */ type GenerateLinkUserOAuthUrlArgs = { integrationIdentifier: string; connectionIdentifier?: string; /** Required — this operation always binds a specific subscriber to a user identity. */ subscriberId: string; context?: Context; /** * HMAC-SHA256 of the canonicalized `context`, signed with the tenant environment * secret key. Required when linking to a `restricted` agent and the session did * not already verify the context, so the per-user link carries a trustworthy binding. */ contextHash?: string; /** Slack only: user-level OAuth scopes (e.g. identity.basic). */ userScope?: string[]; }; type ListChannelConnectionsArgs = { subscriberId?: string; integrationIdentifier?: string; channel?: string; providerId?: string; contextKeys?: string[]; /** * Scope results relative to the subscriber. `subscriber` returns only the * subscriber's own connections, `shared` returns only shared (workspace-level) * connections. Omit to return both. */ connectionMode?: ConnectionMode; limit?: number; after?: string; before?: string; }; type GetChannelConnectionArgs = { identifier: string; connectionMode?: ConnectionMode; }; type CreateChannelConnectionArgs = { identifier?: string; integrationIdentifier: string; subscriberId?: string; context?: Context; workspace: { id: string; name?: string; }; auth: { accessToken: string; }; }; type DeleteChannelConnectionArgs = { identifier: string; }; type ListChannelEndpointsArgs = { subscriberId?: string; integrationIdentifier?: string; connectionIdentifier?: string; channel?: string; providerId?: string; contextKeys?: string[]; limit?: number; after?: string; before?: string; }; type GetChannelEndpointArgs = { identifier: string; }; type CreateChannelEndpointArgs = { identifier?: string; integrationIdentifier: string; connectionIdentifier?: string; subscriberId: string; context?: Context; type: string; endpoint: Record; }; type DeleteChannelEndpointArgs = { identifier: string; }; /** * Args for issuing a provider-specific URL the subscriber opens to link their * chat identity (e.g. a Telegram `t.me` deep link). The subscriber is derived * from the session token, so only the integration identifier is required. */ type LinkChannelEndpointArgs = { integrationIdentifier: string; /** * Context bound to the resulting channel endpoint at link time. */ context?: Context; /** * HMAC-SHA256 of the canonicalized `context`, signed with the tenant environment * secret key (the same "Inbox with context" signing). Required when the * integration has HMAC validation enabled and the current session did not * already verify the context. */ contextHash?: string; }; type LinkChannelEndpointResponse = { /** URL the subscriber opens to link their chat identity (deep link or OAuth URL). */ url: string; /** Provider-specific metadata returned alongside the link URL (e.g. Telegram `botUsername`, `expiresAt`). */ providerMetadata?: Record; }; type InboxServiceOptions = HttpClientOptions & { httpClient?: HttpClient; }; declare class InboxService { #private; isSessionInitialized: boolean; constructor(options?: InboxServiceOptions); initializeSession({ applicationIdentifier, subscriberHash, contextHash, subscriber, defaultSchedule, context, }: { applicationIdentifier?: string; subscriberHash?: string; contextHash?: string; subscriber?: Subscriber; defaultSchedule?: DefaultSchedule; context?: Context; }): Promise; fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, createdGte, createdLte, }: { tags?: TagsFilter; read?: boolean; archived?: boolean; snoozed?: boolean; seen?: boolean; limit?: number; after?: string; offset?: number; data?: Record; severity?: SeverityLevelEnum | SeverityLevelEnum[]; createdGte?: number; createdLte?: number; }): Promise<{ data: InboxNotification[]; hasMore: boolean; filter: NotificationFilter; }>; count({ filters, }: { filters: Array<{ tags?: TagsFilter; read?: boolean; archived?: boolean; snoozed?: boolean; seen?: boolean; data?: Record; severity?: SeverityLevelEnum | SeverityLevelEnum[]; }>; }): Promise<{ data: Array<{ count: number; filter: NotificationFilter; }>; }>; read(notificationId: string): Promise; unread(notificationId: string): Promise; archive(notificationId: string): Promise; unarchive(notificationId: string): Promise; snooze(notificationId: string, snoozeUntil: string): Promise; unsnooze(notificationId: string): Promise; readAll({ tags, data }: { tags?: TagsFilter; data?: Record; }): Promise; archiveAll({ tags, data }: { tags?: TagsFilter; data?: Record; }): Promise; archiveAllRead({ tags, data }: { tags?: TagsFilter; data?: Record; }): Promise; delete(notificationId: string): Promise; deleteAll({ tags, data }: { tags?: TagsFilter; data?: Record; }): Promise; markAsSeen({ notificationIds, tags, data, }: { notificationIds?: string[]; tags?: TagsFilter; data?: Record; }): Promise; seen(notificationId: string): Promise; completeAction({ actionType, notificationId, }: { notificationId: string; actionType: ActionTypeEnum; }): Promise; revertAction({ actionType, notificationId, }: { notificationId: string; actionType: ActionTypeEnum; }): Promise; fetchPreferences({ tags, severity, criticality, }: { tags?: string[]; severity?: SeverityLevelEnum | SeverityLevelEnum[]; criticality: WorkflowCriticalityEnum; }): Promise; bulkUpdatePreferences(preferences: Array<{ workflowId: string; } & ChannelPreference>): Promise; updateGlobalPreferences(preferences: ChannelPreference & { schedule?: { isEnabled?: boolean; weeklySchedule?: WeeklySchedule; }; }): Promise; updateWorkflowPreferences({ workflowId, channels, }: { workflowId: string; channels: ChannelPreference; }): Promise; fetchGlobalPreferences(): Promise; triggerHelloWorldEvent(): Promise; fetchSubscriptions(topicKey: string): Promise; getSubscription(topicKey: string, identifier?: string, workflowIds?: string[], tags?: string[]): Promise; createSubscription({ identifier, name, topicKey, topicName, preferences, }: { identifier?: string; name?: string; topicKey: string; topicName?: string; preferences?: Array; }): Promise; updateSubscription({ topicKey, identifier, name, preferences, }: { topicKey: string; identifier: string; name?: string; preferences?: Array; }): Promise; updateSubscriptionPreference({ subscriptionIdentifier, workflowId, enabled, condition, email, sms, in_app, chat, push, }: { subscriptionIdentifier: string; workflowId: string; enabled?: boolean; condition?: RulesLogic; email?: boolean; sms?: boolean; in_app?: boolean; chat?: boolean; push?: boolean; }): Promise; bulkUpdateSubscriptionPreferences(preferences: Array<{ subscriptionIdentifier: string; workflowId: string; enabled?: boolean; condition?: RulesLogic; email?: boolean; sms?: boolean; in_app?: boolean; chat?: boolean; push?: boolean; }>): Promise; deleteSubscription({ topicKey, identifier }: { topicKey: string; identifier: string; }): Promise; /** * @deprecated Use generateConnectOAuthUrl() or generateLinkUserOAuthUrl() instead. */ generateChatOAuthUrl({ integrationIdentifier, connectionIdentifier, subscriberId, context, scope, userScope, mode, connectionMode, autoLinkUser, }: GenerateChatOAuthUrlArgs): Promise<{ url: string; }>; generateConnectOAuthUrl({ integrationIdentifier, connectionIdentifier, subscriberId, context, contextHash, scope, connectionMode, autoLinkUser, }: GenerateConnectOAuthUrlArgs): Promise<{ url: string; }>; generateLinkUserOAuthUrl({ integrationIdentifier, connectionIdentifier, subscriberId, context, contextHash, userScope, }: GenerateLinkUserOAuthUrlArgs): Promise<{ url: string; }>; listChannelConnections(args?: ListChannelConnectionsArgs): Promise<{ data: ChannelConnectionResponse[]; next?: string; previous?: string; }>; getChannelConnection({ identifier, connectionMode }: GetChannelConnectionArgs): Promise; createChannelConnection({ identifier, integrationIdentifier, subscriberId, context, workspace, auth, }: CreateChannelConnectionArgs): Promise; deleteChannelConnection(identifier: string): Promise; listChannelEndpoints(args?: ListChannelEndpointsArgs): Promise<{ data: ChannelEndpointResponse[]; next?: string; previous?: string; }>; getChannelEndpoint(identifier: string): Promise; createChannelEndpoint({ identifier, integrationIdentifier, connectionIdentifier, subscriberId, context, type, endpoint, }: CreateChannelEndpointArgs): Promise; deleteChannelEndpoint(identifier: string): Promise; linkChannelEndpoint({ integrationIdentifier, context, contextHash, }: LinkChannelEndpointArgs): Promise; } export { SubscriptionPreference as $, type AgentMessage as A, type BaseDeleteSubscriptionArgs as B, type Context as C, type DaySchedule as D, type EventHandler as E, type FiltersCountResponse as F, type GenerateChatOAuthUrlArgs as G, NotificationStatus as H, type InboxNotification as I, NovuError as J, type NovuOptions as K, type LinkChannelEndpointArgs as L, type NovuSocketOptions as M, Notification as N, type PreferenceFilter as O, Preference as P, PreferenceLevel as Q, type PreferencesResponse as R, SeverityLevelEnum as S, type TagsFilter as T, Schedule as U, type SendMessageArgs as V, type SendMessageResult as W, type SocketEventNames as X, type SocketTypeOption as Y, type StandardNovuOptions as Z, type Subscriber as _, type NotificationFilter as a, type TagsFilterAndForm as a0, type TagsFilterOrGroup as a1, type TimeRange as a2, TopicSubscription as a3, type UnreadCount as a4, type UpdateSubscriptionArgs as a5, type UpdateSubscriptionPreferenceArgs as a6, WebSocketEvent as a7, type WeeklySchedule as a8, WorkflowCriticalityEnum as a9, type Options as aA, type EventNames as aB, type ContextValue as aC, type WorkflowFilter as aa, type WorkflowGroupFilter as ab, type WorkflowIdentifierOrId as ac, type ConnectionMode as ad, HttpClient as ae, type AgentEventEnvelope as af, InboxService as ag, NovuEventEmitter as ah, type Session as ai, type Result as aj, ScheduleCache as ak, type UpdateScheduleArgs as al, PreferencesCache as am, type ListPreferencesArgs as an, type BasePreferenceArgs as ao, type InstancePreferenceArgs as ap, type ListNotificationsArgs as aq, type FilterCountArgs as ar, type FilterCountResponse as as, type FiltersCountArgs as at, type BaseArgs as au, type InstanceArgs as av, type SnoozeArgs as aw, type GenerateConnectOAuthUrlArgs as ax, type GenerateLinkUserOAuthUrlArgs as ay, SubscriptionsCache as az, type BaseUpdateSubscriptionArgs as b, type ChannelConnectionResponse as c, type ChannelEndpointResponse as d, type ChannelPreference as e, ChannelType as f, type CreateChannelConnectionArgs as g, type CreateChannelEndpointArgs as h, type CreateSubscriptionArgs as i, type DefaultSchedule as j, type DeleteChannelConnectionArgs as k, type DeleteChannelEndpointArgs as l, type DeleteSubscriptionArgs as m, type Events as n, type GetChannelConnectionArgs as o, type GetChannelEndpointArgs as p, type GetSubscriptionArgs as q, type InstanceDeleteSubscriptionArgs as r, type InstanceUpdateSubscriptionArgs as s, type LinkChannelEndpointResponse as t, type ListChannelConnectionsArgs as u, type ListChannelEndpointsArgs as v, type ListNotificationsResponse as w, type ListSubscriptionsArgs as x, type LoadConversationArgs as y, type LoadConversationResult as z };