Best way of getting session id on front-end side

Hello Dears,

I need the most appropriate way of getting session id on front-end side.
Afterwards I have to pass it into another system using twc extension script.

So far, I succeeded to get sessionId from browser session storage only by using the following code line: sessionStorage.getItem(‘twc_sessionId’)

However, I am not sure this is the best way of doing it and I count on your expert advice.
Using _.getSessionId, etc. did not work.
Probably there is a way to get session id from the engine as well, but I am not aware of such method.

Your help is much appreciated :slight_smile:



You can obtain the session ID of the Teneo dialog session with the following TWC extension:

window.TeneoWebChat.on('engine_response', ({responseDetails}) => {
    const sessionId = responseDetails.sessionId;
     // Use sessionId here:

You can see more on our TWC API here: