Enable newMessage event in Chat SDK

There are many options to add event listeners for Chat widget on web pages. You can for example trigger analytics events for: conversationStarted, contactAssociated and even for quick reply buttons via event called “quickReplyButtonClick”. The documentation is here.
BUT: There is no way to add event listener for new message event. Meaning when user types and sends a normal message, that can’t be used as a trigger.
Why this is important / How to use it:
- This “newMessage” event could be used in analytics. For example tracking in GA how many messages are sent or how many visitors started a real conversation with a support agent.
- This event could be used for personalizing site based on user actions. AI could provide customized content and recommendations.
- This event could be used to filter spam messages and to automatically block harassers.

Currently, we are receiving multiple disruptive and burdensome messages everyday from individual people who are targeting our customer support team members.

HubSpot do not have an ability to block these people automatically. Instead we need to send their IP addresses to HubSpot support and support forward ticket to technical team which manually block disturbing individuals. Unfortunately, IP’s changes often so this requires constantly manual work. With this javascript event callback we could set some custom rules and create functionality to block access to entire website via Cloudflare.