Accessing User Data in HelpDocs

You can pass user data to HelpDocs in either JWT auth or Shared Password as SSO. If you haven't already passed the data, check out the relevant article for more instructions. 👀

Taylor Sloane
Updated by Taylor Sloane

You can pass user data to HelpDocs in either JWT auth or Shared Password as SSO. If you haven't already passed the data, check out the relevant article for more instructions 👀

Accessing Data

In your knowledge base you can access params from user_data by reading the hd_user_data cookie and decoding the JSON body.

Let's assume you've passed us this data for a user through JWT auth or Shared Password as SSO:

{
"name": "Taylor",
"user_id": 1
}

Then you can use a snippet a little like this one to access the data:

var user_data = {};
try {
user_data = JSON.parse(Cookies.get('hd_user_data'));
} catch (e) {
console.log('Error parsing user data');
}
console.log(user_data.name); // "Taylor"
console.log(user_data.user_id); // 1

You can include the above snippet in places like your live chat integration to identify your users, or in Settings > Code > Javascript.

What did you think of this doc?

Restricting your HelpDocs with Custom JWT SSO

Using JWT Studio

Get in touch

This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply.