Enabling authenticated visitors in Web Widget (Classic)

Return to top

33 Comments

  • Remi
    Zendesk Customer Care

    @Good day BAKO,

    Thank you for your post, hope all is well on your end today!

    To answer your questions : 
    1 - I'm no Explore expert, but I don't believe you will be able to build a report based on whether the user is authenticated or not, for the reason that authentication isn't a recorded state / nor an attribute, therefore, Explore will have no way to pull this data from Support/Chat dataset.

    Which leads to your second question
    2 - Same as above, End-user authentication isn't "recorded" in any API or attribute.

    Thus, one answer to both of your questions as a "best solution" would be simply to pass a Tag via our API for Chat Widget when your user is authenticated.

    So basically, build your code and logic to apply/build the JWT, wait for the JWT to be passed to our endpoint and then, once confirmed, in parallel push/add a Tag such as "user_authenticated" via this Chat API > chat:addTags, which will be passed to the Chat session through the widget.

     

    This means, then, you can build your Report in Explore based on these tags, as we will know they only exist for authenticated users.

    Same for your Trigger, you can then use the "Contains at least one of the following" tag "user_authenticated" as a condition, which means your Trigger will fire only for authenticated users. 

    Hope this helps! Have a lovely rest of your day and a great weekend as well.

    Best regards,

    0
  • Adam Dreier

    The key takeaway here though is once I had everything working and configured you need to make sure that the token does not have quotes around it, Please update this documentation because res.text() in the res for javascript creates a string and causes a 400 response from the API. You need to tell devs that the token needs to be wrapped in a JSON.parse(jwt) to remove the quotes or else it wont work.

    0
  • Nova Dawn
    Zendesk Documentation Team
    Thanks Adam, great catch! I've updated the article accordingly across all languages.
    1

Please sign in to leave a comment.

Powered by Zendesk