> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # ListMessages # Package: aiSiteChat # Namespace: Messages # Method link: https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/messages/list-messages.md ## Permission Scopes: Innovation Lab User: SCOPE.INNOVATION_LAB.USER ## Introduction Retrieves a list of messages. Up to 100 Messages can be returned per request. This method must be called using the site visitor or site member identity ([SDK](https://dev.wix.com/docs/sdk/articles/get-started/about-identities.md#site-member) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/about-identities.md#site-member)) to identify the site visitor that is retrieving the messages. --- ## REST API ### Schema ``` Method: listMessages Description: Retrieves a list of messages. Up to 100 Messages can be returned per request. This method must be called using the site visitor or site member identity ([SDK](https://dev.wix.com/docs/sdk/articles/get-started/about-identities.md#site-member) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/about-identities.md#site-member)) to identify the site visitor that is retrieving the messages. URL: https://www.wixapis.com/v1/messages/list Method: GET Method parameters: param name: cursorPaging | type: CursorPaging - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: 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. Return type: ListMessagesResponse - name: messages | type: array | description: Retrieved messages. - name: id | type: string | description: Message GUID. - name: createdDate | type: string | description: Date and time the message was created. - name: sender | type: Sender | description: Message sender type. - enum: - ASSISTANT: AI assistant. - USER: Wix user. For example, a site admin. - SYSTEM: Message was sent automatically due to widget settings. For example, a contact form. - SITE_VISITOR: Site visitor. - name: conversationId | type: string | description: Conversation GUID. - name: answerTo | type: string | description: GUID of the message that this message is answering. - name: messageType | type: MessageType | description: Message type. - enum: - QUESTION: Question. - ANSWER: Answer. - INTRO: Intro message, as defined in the widget settings. - LEGAL: Legal disclaimer, as defined in the widget settings. - CONTACT_FORM: Contact form. - CONTACT_FORM_SUBMITTED: Message confirms that a contact form was successfully submitted. - SITE_OWNER_NOTIFICATION: Notification for the site owner. - OFFLINE: Message informing the site visitor that the AI assistant is offline, as defined in the widget settings. - OUT_OF_QUOTA: Message that informs the Wix user that they have reached the maximum number of messages on their current plan. - USER_ANSWER: User answer. - SITE_NAVIGATION: Site visitor site Navigation information. - NAVIGATION_ANSWER: Site visitor site Navigation information answer. - IGNORED_ANSWER: AI Site Chat ignored the question. - VISITOR_OPTION_SELECTED: Site visitor selected an option from Message.visitor_options. - ADD_TO_CART: Site visitor added a product to the cart. - BOOK_SERVICE: Site visitor booked a service. - GENERATED_QUESTION: AI assistant generated a question for the user to try. - SUGGESTED_QUESTION: Suggested question, as defined in the widget settings. - USER_QUESTION: Wix user question for testing and training. - USER_QUESTION_ANSWER: Wix assistant answer for testing and training. - WIX_USER_MEDIA: Media uploaded by Wix user for visitor. - MEDIA: Media uploaded by visitor for Wix user. - WIX_USER_CARD: Card template sent by the Wix User. - WIX_USER_MINIMAL_BODY: Simple template sent by the Wix User. - WIX_USER_FORM: Form sent by the Wix User. - WIX_SYSTEM: System message from comm channels. - name: body | type: Body | description: Message body. - name: mainText | type: string | description: Main text of the message. - name: footerText | type: string | description: Footer text of the message. - name: additionalData | type: array | description: Additional data for the message. - name: inboxId | type: string | description: Message Id in the Inbox - name: visitorOptions | type: array | description: Options site visitor can choose from. - name: assistantActions | type: array | description: List of actions that ai assistant executed on the site visitor's behalf. - name: visitorOptionsFields | type: array | description: List of detailed options the visitor can choose from. - name: engineStatus | type: string | description: Exact status message returned by ai site chat engine, - name: pagingMetadata | type: PagingMetadataV2 | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: offset | type: integer | description: Offset that was requested. - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field. - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.aiSiteChat.Messages.listMessages(options) Description: Retrieves a list of messages. Up to 100 Messages can be returned per request. This method must be called using the site visitor or site member identity ([SDK](https://dev.wix.com/docs/sdk/articles/get-started/about-identities.md#site-member) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/about-identities.md#site-member)) to identify the site visitor that is retrieving the messages. Method parameters: param name: options | type: ListMessagesOptions none - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: 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. Return type: PROMISE - name: messages | type: array | description: Retrieved messages. - name: _id | type: string | description: Message GUID. - name: _createdDate | type: Date | description: Date and time the message was created. - name: sender | type: Sender | description: Message sender type. - enum: - ASSISTANT: AI assistant. - USER: Wix user. For example, a site admin. - SYSTEM: Message was sent automatically due to widget settings. For example, a contact form. - SITE_VISITOR: Site visitor. - name: conversationId | type: string | description: Conversation GUID. - name: answerTo | type: string | description: GUID of the message that this message is answering. - name: messageType | type: MessageType | description: Message type. - enum: - QUESTION: Question. - ANSWER: Answer. - INTRO: Intro message, as defined in the widget settings. - LEGAL: Legal disclaimer, as defined in the widget settings. - CONTACT_FORM: Contact form. - CONTACT_FORM_SUBMITTED: Message confirms that a contact form was successfully submitted. - SITE_OWNER_NOTIFICATION: Notification for the site owner. - OFFLINE: Message informing the site visitor that the AI assistant is offline, as defined in the widget settings. - OUT_OF_QUOTA: Message that informs the Wix user that they have reached the maximum number of messages on their current plan. - USER_ANSWER: User answer. - SITE_NAVIGATION: Site visitor site Navigation information. - NAVIGATION_ANSWER: Site visitor site Navigation information answer. - IGNORED_ANSWER: AI Site Chat ignored the question. - VISITOR_OPTION_SELECTED: Site visitor selected an option from Message.visitor_options. - ADD_TO_CART: Site visitor added a product to the cart. - BOOK_SERVICE: Site visitor booked a service. - GENERATED_QUESTION: AI assistant generated a question for the user to try. - SUGGESTED_QUESTION: Suggested question, as defined in the widget settings. - USER_QUESTION: Wix user question for testing and training. - USER_QUESTION_ANSWER: Wix assistant answer for testing and training. - WIX_USER_MEDIA: Media uploaded by Wix user for visitor. - MEDIA: Media uploaded by visitor for Wix user. - WIX_USER_CARD: Card template sent by the Wix User. - WIX_USER_MINIMAL_BODY: Simple template sent by the Wix User. - WIX_USER_FORM: Form sent by the Wix User. - WIX_SYSTEM: System message from comm channels. - name: body | type: Body | description: Message body. - name: mainText | type: string | description: Main text of the message. - name: footerText | type: string | description: Footer text of the message. - name: additionalData | type: array | description: Additional data for the message. - name: inboxId | type: string | description: Message Id in the Inbox - name: visitorOptions | type: array | description: Options site visitor can choose from. - name: assistantActions | type: array | description: List of actions that ai assistant executed on the site visitor's behalf. - name: visitorOptionsFields | type: array | description: List of detailed options the visitor can choose from. - name: engineStatus | type: string | description: Exact status message returned by ai site chat engine, - name: pagingMetadata | type: PagingMetadataV2 | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: offset | type: integer | description: Offset that was requested. - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field. - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. ``` ### Examples ### listMessages ```javascript import { messages } from '@wix/ai-site-chat'; async function listMessages(options) { const response = await messages.listMessages(options); }; ``` ### listMessages (with elevated permissions) ```javascript import { messages } from '@wix/ai-site-chat'; import { auth } from '@wix/essentials'; async function myListMessagesMethod(options) { const elevatedListMessages = auth.elevate(messages.listMessages); const response = await elevatedListMessages(options); } ``` ### listMessages (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { messages } from '@wix/ai-site-chat'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { messages }, // Include the auth strategy and host as relevant }); async function listMessages(options) { const response = await myWixClient.messages.listMessages(options); }; ``` ---