onMessageSentToParticipant( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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 Declaration
Copy
function wixCrmInbox_onMessageSentToParticipant(
  event: MessageSentToParticipantEvent,
): void;
Method Parameters
eventMessageSentToParticipantEvent

Information about the message that was sent and metadata for the event.

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 * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?