Hey Team,
i am experiencing an issue where the "conversation.started" event log is not triggering in Authenticated Web Messaging (AWM) deployments, while it works perfectly in Unauthenticated Web Messaging (UWM). So need you help in isolating the issue and/or confirming whether this is a working behavior of the messenger SDK in Authenticated Web Messaging.
We are using,
- Web Messaging with JavaScript SDK
- React application with custom event handling
I've been comparing console logs between working UWM and non-working AWM implementations. Here's what I found:
AWM logs:
genesys.min.js:11 Auth published: authenticated
genesys.min.js:11 Auth published: data.jwt
genesys.min.js:11 Auth published: data.authenticated
genesys.min.js:11 MessagingService called the command: MessengerHelper.openWebSocket
genesys.min.js:11 MessagingService called the command: MessengerHelper.sendOverSocket
genesys.min.js:11 MessengerHelper published: onWebSocketMessage
// ... later ...
genesys.min.js:11 Genesys subscribed to Conversations.started
genesys.min.js:11 [Genesys] Subscribed to conversation started event: true
Observation:
No [ Genesys ] Conversation Started message appears in the logs, despite the conversation working.\
1. Authentication completes immediately
2. WebSocket connection opens automatically
3. Conversation starts automatically
4. conversation.started event fires
5. subscription is established (too late - event already fired)
We are writing the logs through the script. please see below code snippet
const subToConv = window.Genesys( CommandType.SUBSCRIBE, GenesysEvent.CONVERSATIONS_STARTED, (data: { time: number }) => { console.debug('[Genesys] Conversation started', data?.time); // <-- THIS LINE setIsConversationStarted(true); } );
UWM Working:
genesys.min.js:11 [GenesysAuth] authState: FAILED
genesys.min.js:11 [Genesys] Messenger is ready
genesys.min.js:11 Genesys subscribed to Conversations.started
genesys.min.js:11 [Genesys] Subscribed to conversation started event: true
// ... user clicks messenger ...
genesys.min.js:11 [Genesys] Messenger opened
genesys.min.js:11 MessagingService called the command: MessengerHelper.openWebSocket
genesys.min.js:11 [Genesys] Conversation started 1750317312294
As you can see, in this case it is successfully getting written in console logs.
My question is the conversation.started already executed in AWM & hence the callback function console.debug('[Genesys] Conversation started', data?.time); // <-- THIS LINE setIsConversationStarted(true); } ); responsible for logging this event never takes place ?
or
- Is this the expected behavior for AWM? Should conversations auto-start immediately upon authentication before custom subscriptions can be established?
- What's the recommended pattern for subscribing to conversation events in AWM? Should we subscribe earlier in the SDK lifecycle, or is there a different event we should use?
- Is there a way to check if a conversation is already active when setting up subscriptions, so we can handle the "already started" case?
What's strange is, even though we did not get the message in the console of conversation.started event , the messenger widget does pops up & we did get connected to the message flow which is evident of the fact that conversation has started.
This makes me feels like the callback arrow function did not write the logs strictly because the code is subscribing to the event which had already occurred.
Any help would be greatly appreciated..
I have also attached UWM & AWM console logs along with the relevant code snippet.
Br,
Sannket
#Integrations#PlatformSDK#WebMessaging------------------------------
Sanket Wetkar
------------------------------