Enabling authenticated visitors in the Chat widget

Return to top


  • Steve Hull

    This is missing a critical piece, which is code that waits for `$zopim` to be defined. We are getting `Uncaught ReferenceError: $zopim is not defined` on this line. I'm not sure if waiting for DOM content to be loaded would be sufficient or if there's something else we should do to ensure the zendesk js has successfully loaded.

    Scripts I've worked with in the past (eg, Google Analytics) have you push operations into a queue that is then worked off when the library is loaded. Is something like that available for zendesk js?

  • Greg Katechis
    Zendesk Developer Advocacy
    Hi Steve! This article doesn't cover the specifics of adding the script to your page. In the article that does cover it, we mention that you should make sure that it's loaded before running any functions that depend on it. You can read about that here.
  • Dev

    Is there any update on the possibility to call clearAll without needing to reload the page for Single Page Applications? Maybe if we know why it's not possible to authenticate the use again, we can do something about it without refreshing

  • Mateusz Anglart

    regarding the Documentation Code Examples you have lots of syntax errors in PHP example. What is the reason for '#' in every variable of payload? 

  • Francis Casino
    Zendesk Customer Care
    Hello Mateusz,
    Using # before variable names in the payload is not a standard syntax in PHP. It appears to be specific to the way the documentation or code examples are formatted. It's possible that the # symbol is used as a placeholder or annotation to indicate where you should substitute your own values.
    In PHP, variables are typically declared without the # symbol. For example, you would declare a variable like this:
    phpCopy code
    $variableName = 'Some value';
    If you're encountering code examples in Zendesk's documentation with # before variable names, it's likely meant to be a visual cue for you to replace #variableName with the actual variable name you intend to use. Here's how you would replace it:
    phpCopy code
    $variableName = 'Some value';

    The use of # in this context doesn't have any special meaning in PHP; it's more for instructional or illustrative purposes to guide you on where to insert your own values.
  • 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 .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.

  • Nova Dawn
    Zendesk Documentation Team
    Closing out this ticket as it is an exact replica of what has already been solved in this ticket: https://support.zendesk.com/agent/tickets/12163866

Please sign in to leave a comment.

Powered by Zendesk