Adding Loggedin user info into Drift chat

In case one wants to add logged in user email into Drift chat:

<script>
    document.addEventListener("DOMContentLoaded", function() {    
        if(window.logged_in_user && window.drift) {
            const email = window.logged_in_user.softr_user_email;
            drift.on('ready', function() {
                drift.api.setUserAttributes({
                    email: email
                });
            });
        }
    });
</script>

I want to do the same thing with HubSpot Chat. Seems we need to use the Hubspot Visitor Identification API (https://developers.hubspot.com/docs/api/conversation/visitor-identification). Has anyone managed this using the built-in Softr integration ?

@erwanp seems hubspot’s version is relying on some backend api too which makes it harder