Search.../

onMessageSentToBusiness( )

Developer Preview

Triggered when a visitor, contact, or member sends a message to the business.

Syntax

function wixCrmInbox_onMessageSentToBusiness(event: MessageSentToBusinessEvent): void

onMessageSentToBusiness Parameters

NAME
TYPE
DESCRIPTION
event
Optional
MessageSentToBusinessEvent

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when the site user messages the business site

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixCrmInbox_onMessageSentToBusiness(event) {
6 const eventId = event.metadata.id;
7 const messageId = event.data.message._id;
8 const conversationId = event.data.conversationId;
9}
10
11/* Full event object:
12 * {
13 * "data": {
14 * "conversationId": "6fd2b962-dd8f-382f-8d27-ae63f188c939",
15 * "message": {
16 * "_createdDate": "2023-11-15T10:19:44.064Z",
17 * "_id": "1700043584064712",
18 * "appId": "14517e1a-3ff0-af98-408e-2bd6953c36a2",
19 * "badges": [],
20 * "content": {
21 * "previewText": "You are very welcome.",
22 * "basic": {
23 * "items": [
24 * {
25 * "text": "You are very welcome."
26 * }
27 * ]
28 * },
29 * "contentType": "BASIC"
30 * },
31 * "direction": "PARTICIPANT_TO_BUSINESS",
32 * "sender": {
33 * "contactId": "9e668c08-8bdb-4240-babb-8176935f6f78"
34 * },
35 * "sequence": "1700043584064712",
36 * "sourceChannel": "UNKNOWN_CHANNEL_TYPE",
37 * "targetChannels": [],
38 * "visibility": "BUSINESS_AND_PARTICIPANT"
39 * }
40 * },
41 * "metadata": {
42 * "entityId": "1700043584064712",
43 * "eventTime": "2023-11-15T10:19:45.472455Z",
44 * "id": "45289008-1d03-4697-9cc2-a0c0f12cf823",
45 * "triggeredByAnonymizeRequest": false
46 * }
47 * }
48 */