> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: onMessageSentToParticipant(event: MessageSentToParticipantEvent)

# Method package: wixInboxV2

# Method menu location: wixInboxV2 --> onMessageSentToParticipant

# Method Link: https://dev.wix.com/docs/velo/events-service-plugins/inbox/events/on-message-sent-to-participant.md

# Method Description:

An event that triggers when a business sends a message to a contact, member, or site visitor.

The `onMessageSentToParticipant()` event handler runs when a message is sent from a business to a site's contact, member, or visitor. The received `MessageSentToParticipantEvent` object contains information about the message that was sent.

>**Note:** Backend events don't work when previewing your site.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## An event triggered when the business site messages the site user  

```javascript
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.

export function wixCrmInbox_onMessageSentToParticipant(event) {
    const eventId = event.metadata.id;
    const messageId = event.data.message._id;
    const conversationId = event.data.conversationId;
  }
  
/* Full event object:
 * {
 *   "data": {
 *     "conversationId": "6fd2b962-dd8f-382f-8d27-ae63f188c939",
 *     "message": {
 *       "_createdDate": "2023-11-15T16:18:56.558Z",
 *       "_id": "1700065136558061",
 *       "appId": "151e476a-715e-ec33-db9a-a7ff4d51f70a",
 *       "badges": [],
 *       "content": {
 *         "previewText": "Thank You",
 *         "basic": {
 *           "items": [
 *             {
 *               "text": "Thank you for submitting!"
 *             }
 *           ]
 *         },
 *         "contentType": "BASIC"
 *       },
 *       "direction": "BUSINESS_TO_PARTICIPANT",
 *       "sender": {
 *         "wixUserId": "b17c523c-6ec9-4b56-9d9d-123cc6978bdf"
 *       },
 *       "sequence": "1700065136558061",
 *       "sourceChannel": "UNKNOWN_CHANNEL_TYPE",
 *       "targetChannels": [],
 *       "visibility": "BUSINESS_AND_PARTICIPANT"
 *     },
 *   }
 *   "metadata": {
 *     "id": "2715920c-e7d4-4bd0-ab00-33cb3fe01a9f",
 *     "entityId": "1700065136558061",
 *     "eventTime": "2023-11-15T16:18:56.681603Z",
 *     "triggeredByAnonymizeRequest": false
 *   }
 * }
 */
```

---