In B2B support, it's common to restrict specific content in your knowledge base or in your contact form depending on who's currently connected to your account.
For example, when supporting multiple companies, you don't want Company A to see Company B's knowledge base articles. Company C might be the only one allowed to see a specific ticket form. Or, perhaps, Company D would like a specific email template.
This article describes how you how you can customize your end-users' knowledge base, email templates, and ticket forms experience and automate this process using single sign-on (SSO).
This article contains the following sections:
Setting up JSON web token to enable single sign-on
To ease the process, we'll use single sign-on to create end users based on the information that you already have in your database. For example, since you know that Mr. Travis Bickle works for the organization BlueBerry, you consider him as a VIP and that information is already available in your database. We'll simply create the user in Zendesk Support on the fly and put it under the correct organization.
We'll then use that organization to restrict access to KB articles and/or tickets forms.
To set up JSON web token to enable SSO
- In Admin Center, click the Account icon () in the sidebar, then select Security > Single sign-on.
- Click Create SSO configuration, then select JSON Web token.
- Set up JSON Web Token between your identity management system and Zendesk.
If you need more information, see by following Enabling JWT single sign-on. - Include the organization attribute in your JWT payload to create the end user in the correct organization each time.
JWT claims hash: {"iat"=>xxx, "jti"=>yyy, "name"=>"Travis Bickle", "email"=>"t.bickle@gmail.com", "external_id"=>"5678", "organization"=>"BlueBerry", "tags"=>"vip", "locale_id"=>"8"}
You can see above an example response for Travis working at BlueBerry with the end-user profile tag vip . So at the moment that end user is connected on your website and clicks on the Support link, for example, we'll create said end-user account in Zendesk Support with the correct information, like this one:
Creating a restricted knowledge base
One the great benefits of the Help Center is to be able to create multiple Knowledge Bases and restrict access to them by the end-user's language, tag, or organization through one Zendesk Support instance. In this example, we'll focus on the organization BlueBerry from Travis.
To restrict knowledge base content
- Create your help center content and add a specific section for BlueBerry to continue with this example.
- Restrict access to that specific section only to people working for BlueBerry.
Now only end-users in the organization BlueBerry will be able to access this content.
We could go even further now and already restrict access based on the end users with the Tag vip , for example. You have a bunch of possibilities within the same Help Center. Let's keep it simple for now.
Customizing the help center theme to hide or show ticket forms
Ticket forms are natively viewable by either all or no end users. Now we'll need to create ticket fields, add them to a form, and use JavaScript to make the form automatically show or hide based on the end user.
To custom your help center theme to hide or show ticket forms
- In Admin Center, click the Objects and rules icon () in the sidebar, then select Tickets > Fields.
-
Create your ticket fields.
Don't forget to set fields to "Editable" so your end users can see them. -
Create at least two ticket forms.
Don't forget to make them viewable by your end users. - We'll now work with the organization name, BlueBerry, the specific BlueBerry ticket form ID, and add some JavaScript to our help center.
For more information, see Hide ticket forms based on a user's organization .
Find the ticket form ID
To find the ticket form ID
- In Admin Center, click the Objects and rules icon () in the sidebar, then select Tickets > Forms.
- Select the appropriate ticket form from your list of ticket forms.
- Find the ID number in the URL after the last slash.
Find the organization name
To find the organization name
- In Support, click the Organizations icon () in the sidebar.
- Browse or search organizations to find the right organization name.
We'll continue with our example, BlueBerry.
Have fun with JavaScript
$(window).load(function() {
var i = 0;
var cZendesk = false; //assume user is not part of the BlueBerry Organization
//reserve space for additional organizations
var checkExist = setInterval(function() {
i++;
if ($("a.nesty-input").length){
clearInterval(checkExist);
$("a.nesty-input").each(function() {
$(this).bind( "click", function() {
for (var c in HelpCenter.user.organizations) {
if (HelpCenter.user.organizations[c].name == "BlueBerry"){
cZendesk = true; //if user is part of the organization called "BlueBerry", then set its variable to true.
}
//reserve space for additional organizations
}
if (!cZendesk){
$("#TICKET_FORM_ID").remove(); //replace the "TICKET_FORM_ID" with the proper id from the dropdown list. Leave the pound sign intact.
}
//reserve space for additional organizations
});
});
}
if (i > 10){
clearInterval(checkExist);
}
}, 100);
});
Important: You will have to edit the code above. Follow these steps:
- Replace "TICKET_FORM_ID" with the actual ticket form ID we found above.
- Replace "BlueBerry" with the actual organization you want the ticket form to show for.
- Copy the code block above.
- Paste the code into the JavaScript section of your Help Center .
- Save your template and publish changes to see the effects.
Customizing the look of outbound emails
This is optional, but you might also want to have a different look and feel of the emails being sent to Travis from BlueBerry compared to emails sent to "regular" customers. You can achieve this using Liquid Markup and triggers.
- In Admin Center, click the Objects and rules icon () in the sidebar, then select Business Rules > Triggers.
- To continue with this example, let's create a trigger with conditions:
- Ticket is Created
- Organization is BlueBerry
- And actions:
- Add Tag blueberry
- You may want to remove your company logo, if you added one, in the email template under Channels > Email .
- Go back to Triggers, spot the default trigger called "Notify requester of received request", and clone it .
- In the conditions, add
-
- Tag contains one of the following values - blueberry
- Scroll down to the actions and modify the email being sent out
This is the original content:
Your request ({{ticket.id}}) has been received and is being reviewed by our support staff.<br /><br />To add additional comments, reply to this email.<br /><br />
This is the new content:
{% capture tags %}
{{ ticket.tags }}
{% endcapture %}
{% if tags contains 'blueberry' %}
<img src="https://LINK/TO/LOGO.png" /></center>
{% endif %}
Your request ({{ticket.id}}) has been received and is being reviewed by our support staff.<br /><br />To add additional comments, reply to this email.<br /><br />
We're using Liquid Markup to capture the tags of the ticket and adding conditions to add different logos based on the tag present in the ticket.
Final result
You can now rely on this customization to automatically create end-users via SSO from your identity management system. You'll know end-users will have access only to the information they should see and nothing else.
Now, let's see what Travis, the end user from BlueBerry, can see compared to another end-user from a different organization.
Before (ticket submission):
After (ticket submission):
Before (knowledge base):
After (knowledge base):
Before (email):
After (email):