onMessageButtonInteracted( )


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 postback button is clicked.

The onMessageButtonInteracted() event handler runs when contact, member, or site visitor clicks on a postback button that was sent with a message. The received MessageButtonInteracted object contains information about the interaction with the postback button.

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

Method Declaration
Copy
function wixCrmInbox_onMessageButtonInteracted(
  event: MessageButtonInteracted,
): void;
Method Parameters
eventMessageButtonInteracted

Information about the button interaction and metadata for the event.

An event triggered when a postback button is clicked
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_onMessageButtonInteracted(event) { const eventId = event.metadata.id; const messageId = event.data.message._id; } /* Full event object: * { * "data": { * "appId": "151e476a-715e-ec33-db9a-a7ff4d51f70a", * "conversationId": "6fd2b962-dd8f-382f-8d27-ae63f188c939", * "interactedBy": { * "contactId": "9e668c08-8bdb-4240-babb-8176935f6f78" * }, * "interactionId": "spa_day_54321__change_appointment" * }, * "metadata": { * "entityId": "4b0d9a97-7c33-4ee9-945d-6a2f82d2f26d", * "eventTime": "2023-11-15T15:24:51.096099Z", * "id": "4fe18293-0a00-4650-be2e-ba754ee5cba0", * "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?