export interface Message { /** Message ID. */ _id?: string; /** Conversation ID. */ conversationId?: string; /** Message sender type. */ sender?: Sender; /** Feedback attached to the message. Only relevant for messages sent by the AI assistant. */ feedback?: Feedback; /** * Date and time the message was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the message was updated. * @readonly */ _updatedDate?: Date | null; /** * Revision number, which increments by 1 each time the message is updated. To prevent conflicting changes, the current revision must be passed when updating the message. * * Ignored when creating a message. * @readonly */ revision?: string | null; /** Message body. */ body?: Body; /** ID of the message that this message is answering. */ answerTo?: string | null; /** Extended fields. */ extendedFields?: ExtendedFields; /** Tags. */ tags?: Tags; } export declare enum Sender { /** Unknown sender type. */ UNKNOWN_SENDER = "UNKNOWN_SENDER", /** Wix user. For example, a site admin. */ USER = "USER", /** AI assistant. */ ASSISTANT = "ASSISTANT" } export interface Feedback { /** Feedback text. */ text?: string | null; /** * Document attached to the feedback. * @readonly */ document?: Document; /** * Defined if there's an error attaching the document. * @readonly */ error?: string | null; /** Feedback type. */ type?: FeedbackType; } export interface Document { /** ID of the external document. */ _id?: string; /** Title of the external document. */ title?: string; /** Description of the external document. */ description?: string; /** Tags of the external document. */ tags?: string[]; /** URL of the external document. */ url?: string; /** Category of the external document. */ category?: Category; /** Action to be taken when the external document is presented to the user. */ action?: Action; /** Whether the external document is generated from a feedback. */ isFeedback?: boolean | null; /** Whether the external document is published. */ isPublished?: boolean | null; /** Timestamp of the last update of the external document. */ updateTs?: Date | null; /** Relevance of the external document. */ relevance?: number | null; /** Usage of the external document. */ usage?: number | null; } /** Category of the external document. */ export declare enum Category { NO_CATEGORY = "NO_CATEGORY", ENRICHMENT = "ENRICHMENT", /** FEEDBACK = 2; */ RESTRICTION = "RESTRICTION" } /** Action to be taken when the external document is presented to the user. */ export declare enum Action { NO_ACTION = "NO_ACTION", NO_ANSWER = "NO_ANSWER", CONTACT = "CONTACT" } export declare enum FeedbackType { /** Unknown feedback type. */ UNKNOWN = "UNKNOWN", /** AI assistant provided relevant and correct information. */ THUMBS_UP = "THUMBS_UP", /** AI assistant didn't answer the question. */ IRRELEVANT = "IRRELEVANT", /** AI assistant provided incorrect information. */ INCORRECT = "INCORRECT", /** AI Assistant should not answer the question asked. */ SHOULD_NOT_ANSWER = "SHOULD_NOT_ANSWER", /** AI Assistant answered the question, but could be improved. */ OK_BUT = "OK_BUT", /** Other. */ OTHER = "OTHER" } export interface Body { /** Main text of the message. */ mainText?: string | null; /** Footer text of the message. */ footerText?: string | null; /** Additional data. */ additionalData?: Record[] | null; } export interface ExtendedFields { /** * Extended field data. Each key corresponds to the namespace of the app that created the extended fields. * The value of each key is structured according to the schema defined when the extended fields were configured. * * You can only access fields for which you have the appropriate permissions. * * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields). */ namespaces?: Record>; } /** * Common object for tags. * Should be use as in this example: * message Foo { * string id = 1; * ... * Tags tags = 5 * } * * example of taggable entity * { * id: "123" * tags: { * tags: { * tag_ids:["11","22"] * }, * private_tags: { * tag_ids: ["33", "44"] * } * } * } */ export interface Tags { /** Tags that require an additional permission in order to access them, normally not given to site members or visitors. */ privateTags?: TagList; /** Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. */ tags?: TagList; } export interface TagList { /** List of tag IDs */ tagIds?: string[]; } export interface QueryMessagesRequest { /** WQL expression. */ query?: CursorQuery; } export interface CursorQuery extends CursorQueryPagingMethodOneOf { /** * Cursor paging options. * * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: CursorPaging; /** * Filter object. * * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section). */ filter?: Record | null; /** * Sort object. * * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section). */ sort?: Sorting[]; } /** @oneof */ export interface CursorQueryPagingMethodOneOf { /** * Cursor paging options. * * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: CursorPaging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } export interface CursorPaging { /** Maximum number of items to return in the results. */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. */ cursor?: string | null; } export interface QueryMessagesResponse { /** * Messages type. * */ messages?: Message[]; /** Paging metadata. */ pagingMetadata?: CursorPagingMetadata; } export interface CursorPagingMetadata { /** Number of items returned in current page. */ count?: number | null; /** Cursor strings that point to the next page, previous page, or both. */ cursors?: Cursors; /** * Whether there are more pages to retrieve following the current page. * * + `true`: Another page of results can be retrieved. * + `false`: This is the last page. */ hasNext?: boolean | null; } export interface Cursors { /** Cursor string pointing to the next page in the list of results. */ next?: string | null; /** Cursor pointing to the previous page in the list of results. */ prev?: string | null; } export interface AskQuestionRequest { /** Question message. */ question: Message; } export interface AskQuestionResponse { /** Answer message. */ answer?: Message; } export interface AddFeedbackRequest { /** ID of the message to add feedback to. */ messageId: string; /** Feedback to add to the message. */ feedback: Feedback; /** Latest message revision. */ revision: string; } export interface AddFeedbackResponse { /** Updated message. */ message?: Message; } export interface BulkUpdateMessageTagsRequest { /** Message IDs. Tags are updated for messages included in this list. */ ids: string[] | null; /** Tags to assign. */ assignTags: Tags; /** Tags to unassign. */ unassignTags?: Tags; } export interface BulkUpdateMessageTagsResponse { /** List of metadata for each message updated. */ results?: BulkUpdateMessageTagsResult[]; /** Metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface ItemMetadata { /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */ _id?: string | null; /** Index of the item within the request array. Allows for correlation between request and response items. */ originalIndex?: number; /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */ success?: boolean; /** Details about the error in case of failure. */ error?: ApplicationError; } export interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } export interface BulkUpdateMessageTagsResult { /** Individual message metadata. */ itemMetadata?: ItemMetadata; } export interface BulkActionMetadata { /** Number of items that were successfully processed. */ totalSuccesses?: number; /** Number of items that couldn't be processed. */ totalFailures?: number; /** Number of failures without details because detailed failure threshold was exceeded. */ undetailedFailures?: number; } export interface BulkUpdateMessageTagsByFilterRequest { /** Filter to apply to the messages. Tags are updated for messages included in this filter. */ filter: Record | null; /** Tags to assign. */ assignTags: Tags; /** Tags to unassign. */ unassignTags?: Tags; } export interface BulkUpdateMessageTagsByFilterResponse { /** Job ID. */ jobId?: string; } export interface UpdateExtendedFieldsRequest { /** ID of the entity to update. */ _id: string; /** Identifier for the app whose extended fields are being updated. */ namespace: string; /** Data to update. Structured according to the [schema](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields#json-schema-for-extended-fields) defined when the extended fields were configured. */ namespaceData: Record | null; } export interface UpdateExtendedFieldsResponse { /** Updated message. */ message?: Message; } export interface Empty { } export interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } /** @oneof */ export interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } export interface EntityCreatedEvent { entity?: string; } export interface RestoreInfo { deletedDate?: Date | null; } export interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } export interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntity?: string | null; } export interface ActionEvent { body?: string; } export interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } export interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ export interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } export declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } interface DocumentNonNullableFields { _id: string; title: string; description: string; tags: string[]; url: string; category: Category; action: Action; } interface FeedbackNonNullableFields { document?: DocumentNonNullableFields; type: FeedbackType; } interface TagListNonNullableFields { tagIds: string[]; } interface TagsNonNullableFields { privateTags?: TagListNonNullableFields; tags?: TagListNonNullableFields; } interface MessageNonNullableFields { _id: string; conversationId: string; sender: Sender; feedback?: FeedbackNonNullableFields; tags?: TagsNonNullableFields; } export interface QueryMessagesResponseNonNullableFields { messages: MessageNonNullableFields[]; } export interface AskQuestionResponseNonNullableFields { answer?: MessageNonNullableFields; } export interface AddFeedbackResponseNonNullableFields { message?: MessageNonNullableFields; } interface ApplicationErrorNonNullableFields { code: string; description: string; } interface ItemMetadataNonNullableFields { originalIndex: number; success: boolean; error?: ApplicationErrorNonNullableFields; } interface BulkUpdateMessageTagsResultNonNullableFields { itemMetadata?: ItemMetadataNonNullableFields; } interface BulkActionMetadataNonNullableFields { totalSuccesses: number; totalFailures: number; undetailedFailures: number; } export interface BulkUpdateMessageTagsResponseNonNullableFields { results: BulkUpdateMessageTagsResultNonNullableFields[]; bulkActionMetadata?: BulkActionMetadataNonNullableFields; } export interface BulkUpdateMessageTagsByFilterResponseNonNullableFields { jobId: string; } export interface UpdateExtendedFieldsResponseNonNullableFields { message?: MessageNonNullableFields; } /** * Creates a query to retrieve a list of messages. * The `queryMessages()` function builds a query to retrieve a list of messages and returns a `MessagesQueryBuilder` object. * The returned object contains the query definition, which is typically used to run the query using the `find()` function. * You can refine the query by chaining `MessagesQueryBuilder` functions onto the query. `MessagesQueryBuilder` functions enable you to sort, filter, and control the results `queryMessages()` returns. * `queryMessages()` runs with these `MessagesQueryBuilder` defaults, which you can override: * * *`skip(0)` * * `limit(50)` * * `ascending("createdDate")` * * The functions that are chained to `queryMessages()` are applied in the order they are called. For example, if you apply `ascending('createdDate')` and then `descending('id')`, the results are sorted first by the created date, and then, if there are multiple results with the same created date, the messages are sorted by ID. * * ## Supported Filters and Sorting * * | Field | Supported Filters | Sortable | * |----------------|------------------------------------------------------------------------------------------|-----------| * | `id` | [All operators](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#operators). | Sortable | * | `createdDate` | [All operators](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#operators). | Sortable | * @public * @documentationMaturity preview * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionId INNOVATION_LAB.WIX_ASSISTANT * @applicableIdentity APP * @fqn wix.innovation.assistant.playground.v2.WixAssistantPlaygroundV2.QueryMessages */ export declare function queryMessages(): MessagesQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface MessagesQueryResult extends QueryCursorResult { items: Message[]; query: MessagesQueryBuilder; next: () => Promise; prev: () => Promise; } export interface MessagesQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ eq: (propertyName: '_id' | '_createdDate', value: any) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ ne: (propertyName: '_id' | '_createdDate', value: any) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ ge: (propertyName: '_createdDate', value: any) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ gt: (propertyName: '_createdDate', value: any) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ le: (propertyName: '_createdDate', value: any) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ lt: (propertyName: '_createdDate', value: any) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. * @documentationMaturity preview */ startsWith: (propertyName: '_id', value: string) => MessagesQueryBuilder; /** @param propertyName - Property whose value is compared with `values`. * @param values - List of values to compare against. * @documentationMaturity preview */ hasSome: (propertyName: '_id' | '_createdDate', value: any[]) => MessagesQueryBuilder; /** @documentationMaturity preview */ in: (propertyName: '_id' | '_createdDate', value: any) => MessagesQueryBuilder; /** @documentationMaturity preview */ exists: (propertyName: '_id' | '_createdDate', value: boolean) => MessagesQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. * @documentationMaturity preview */ ascending: (...propertyNames: Array<'_id' | '_createdDate'>) => MessagesQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. * @documentationMaturity preview */ descending: (...propertyNames: Array<'_id' | '_createdDate'>) => MessagesQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. * @documentationMaturity preview */ limit: (limit: number) => MessagesQueryBuilder; /** @param cursor - A pointer to specific record * @documentationMaturity preview */ skipTo: (cursor: string) => MessagesQueryBuilder; /** @documentationMaturity preview */ find: () => Promise; } /** * Asks a question to the AI Assistant. * * This method creates and sends a message from a Wix user. * @param question - Question message. * @public * @documentationMaturity preview * @requiredField question * @permissionId INNOVATION_LAB.WIX_ASSISTANT * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @applicableIdentity APP * @fqn wix.innovation.assistant.playground.v2.WixAssistantPlaygroundV2.AskQuestion */ export declare function askQuestion(question: Message): Promise; /** * Adds feedback to a message. * @param messageId - ID of the message to add feedback to. * @public * @documentationMaturity preview * @requiredField messageId * @requiredField options * @requiredField options.feedback * @requiredField options.revision * @permissionId INNOVATION_LAB.WIX_ASSISTANT * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @applicableIdentity APP * @fqn wix.innovation.assistant.playground.v2.WixAssistantPlaygroundV2.AddFeedback */ export declare function addFeedback(messageId: string, options: AddFeedbackOptions): Promise; export interface AddFeedbackOptions { /** Feedback to add to the message. */ feedback: Feedback; /** Latest message revision. */ revision: string; } /** * Synchronously updates tags on a list of messages, specified using the messages' IDs. * * If a tag appears in both `assignTags` and `unassignTags`, it is assigned. * @param ids - Message IDs. Tags are updated for messages included in this list. * @public * @documentationMaturity preview * @requiredField ids * @requiredField options.assignTags * @permissionId INNOVATION_LAB.WIX_ASSISTANT * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @applicableIdentity APP * @fqn wix.innovation.assistant.playground.v2.WixAssistantPlaygroundV2.BulkUpdateMessageTags */ export declare function bulkUpdateMessageTags(ids: string[] | null, options?: BulkUpdateMessageTagsOptions): Promise; export interface BulkUpdateMessageTagsOptions { /** Tags to assign. */ assignTags: Tags; /** Tags to unassign. */ unassignTags?: Tags; } /** * Asynchronously updates tags on a list of messages, specified by applying a filter to all messages. If a filter is not specified, this method updates all messages. * * If a tag appears in both `assignTags` and `unassignTags`, it is assigned. * @param filter - Filter to apply to the messages. Tags are updated for messages included in this filter. * @public * @documentationMaturity preview * @requiredField filter * @requiredField options.assignTags * @permissionId INNOVATION_LAB.WIX_ASSISTANT * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @applicableIdentity APP * @fqn wix.innovation.assistant.playground.v2.WixAssistantPlaygroundV2.BulkUpdateMessageTagsByFilter */ export declare function bulkUpdateMessageTagsByFilter(filter: Record | null, options?: BulkUpdateMessageTagsByFilterOptions): Promise; export interface BulkUpdateMessageTagsByFilterOptions { /** Tags to assign. */ assignTags: Tags; /** Tags to unassign. */ unassignTags?: Tags; } /** * Updates extended fields. This method does not increment the revision. * @param _id - ID of the entity to update. * @param namespace - Identifier for the app whose extended fields are being updated. * @public * @documentationMaturity preview * @requiredField _id * @requiredField namespace * @requiredField options * @requiredField options.namespaceData * @permissionId INNOVATION_LAB.WIX_ASSISTANT * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @applicableIdentity APP * @fqn wix.innovation.assistant.playground.v2.WixAssistantPlaygroundV2.UpdateExtendedFields */ export declare function updateExtendedFields(_id: string, namespace: string, options: UpdateExtendedFieldsOptions): Promise; export interface UpdateExtendedFieldsOptions { /** Data to update. Structured according to the [schema](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields#json-schema-for-extended-fields) defined when the extended fields were configured. */ namespaceData: Record | null; } export {};