Zoom Web Messenger SDK event listener not firing for conversation.started

Widget CSS is fine but the JavaScript SDK v2.1 not trigger the event when chat starts. I try follow some community post for the lifecycle event but it’s doing jack all.

{
 "error": "TypeError: cannot read property 'addEventListener' of null",
 "context": "ZoomCC_Messenger_SDK",
 "timestamp": "2024-05-21T04:12:00Z"
}

The snippet is in the head tag. It’s not working in prod.

It’s completely valid to feel stuck here - trying to hook into lifecycle events can feel like you’ve got a map but the road signs are written in a different language. You’re just trying to get a simple trigger to fire when the conversation starts, which is a basic building block for any good journey.

The issue is likely that the snippet is in the head tag. The SDK needs the DOM to be ready and the messenger to be fully initialized before it can listen for those events. If the script runs before the widget actually exists on the page, it’s like trying to turn a key in a lock before the door has even been installed.

Try moving the logic into a listener that waits for the Messenger.ready event first. The developer docs for the Zoom Web Messenger SDK emphasize this sequence. You’ll want to wrap your event listener inside the ready callback like this:

ZoomMESSENGER.on('ready', () => {
 ZoomMESSENGER.on('conversation.started', (event) => {
 console.log('Conversation started!', event);
 // Your custom logic here
 });
});

Checking the official Zoom developer documentation, it notes that events won’t fire if the listener isn’t registered before the event occurs. By nesting it inside the ready handler, you ensure the connection is established.

If that doesn’t do the trick, double check that the SDK version in the production environment actually matches v2.1. Sometimes a cached version of an older script can cause these listeners to go silent.

1 Like