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. 👀
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