> 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 # BulkCreateMessages # Package: aiSiteChat # Namespace: Messages # Method link: https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/messages/bulk-create-messages.md ## Permission Scopes: Innovation Lab User: SCOPE.INNOVATION_LAB.USER ## Introduction Bulk creates messages. 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 creating the messages. --- ## REST API ### Schema ``` Method: bulkCreateMessages Description: Bulk creates messages. 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 creating the messages. URL: https://www.wixapis.com/v1/bulk/messages/create Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: messages.messageType Method parameters: param name: messages | type: array | description: Messages to be 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: answerTo | type: string | description: GUID of the message that this message is answering. - name: messageType | type: MessageType | description: Message type. | required: true - 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: 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. Return type: BulkCreateMessagesResponse - name: messages | type: array | description: Created 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, ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.aiSiteChat.Messages.bulkCreateMessages(options) Description: Bulk creates messages. 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 creating the messages. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: options.messages.messageType Method parameters: param name: options | type: BulkCreateMessagesOptions none - name: messages | type: array | description: Messages to be 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: 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: 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. Return type: PROMISE - name: messages | type: array | description: Created 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, ``` ### Examples ### bulkCreateMessages ```javascript import { messages } from '@wix/ai-site-chat'; async function bulkCreateMessages(options) { const response = await messages.bulkCreateMessages(options); }; ``` ### bulkCreateMessages (with elevated permissions) ```javascript import { messages } from '@wix/ai-site-chat'; import { auth } from '@wix/essentials'; async function myBulkCreateMessagesMethod(options) { const elevatedBulkCreateMessages = auth.elevate(messages.bulkCreateMessages); const response = await elevatedBulkCreateMessages(options); } ``` ### bulkCreateMessages (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 bulkCreateMessages(options) { const response = await myWixClient.messages.bulkCreateMessages(options); }; ``` ---