Using Snippets in

Last Updated -

Note: This feature requires the Pro Plan or above.

What are Snippets?

Snippets are custom text variables that let you manage standard text or messaging with one variable. If you've done some coding, you know how variables work and snippets work in the same way. Snippets act as placeholders for text that can be used in the Support Center, Response themes, Auto-Acknowledgments and Chat Widgets. uses standard snippets throughout the system and you can see them by going to Admin > Content > Snippets. 

Why would I need to use a Snippet?

As stated above, Desk uses standard snippets for certain phrases and text. Let's say you want to refer to your customers as "Users" instead. You can simply update the relevant snippets once and the change will propagate where ever the snippets is used. You can see in this screenshot that there is a Variable name, Default Text and Custom Text. Change the Custom Text to refer to customers as "users".

(We use Liquid technology to create snippets, which is why you see 'Liquid Variable'. For the purposes of understanding Snippets, you don't have to know more than the fact that we use Liquid technology) 

Another benefit to using Snippets is allowing your Admin to change the value of text without having to deal with code. For example, the most common use case for snippets is for translated text on multi-lingual Support Centers. If you've enabled Multi-lingual Support, that allows your users to choose what language to see in the Support Center. In order to make it easier to manage translations for standard phrases, we use standard snippets that have translations (you can translate the default Snippets automatically). So when your user selects a different language, then the right translation for the snippet is displayed in the Support Center.

You will see a language selector and if you choose a different language, the snippets show the translated text. Here is an example of some standard snippets translated into Dutch. If you wanted to change what the Dutch translation says, instead of going to your HTML code, you can just change the text here.

How do I edit a Snippet?

To find the snippet you need, go to Admin > Content > Snippets. You can scroll through the list of snippets or search for the snippet by searching for keywords.

You can change the text value of the snippet by changing the Custom Text. Just click on the text and make your changes. Remember to click on the checkbox next to the text box in order to save your changes! You'll notice that standard snippets have a Default Text so you can always revert back to that. Custom snippets that you create won't have a default text.

If you want to change the translation for a snippet, choose the right language to see that translation.

How do I create a new snippet? 

When viewing snippets in the Admin section under Content > Snippets, you can create your own by clicking the green "+ Add" button at the top-left of the page.  You'll be prompted to enter a variable keyword and the value which should be displayed in its place on the following screen:

Liquid Variable: enter a variable name without spaces - basically the name of your snippet. For example, if you want to add a phrase to let customers to try again later, you could name it 'try_again'.

Custom Text: This is where you put in the actual text you want displayed. So maybe your phrase will be "Sorry for the trouble, please try again". Note if you want to provide a translation to this snippet, you can do that once you create the snippet. Just follow the steps laid out in the section above, "How do I edit a Snippet".

How do I use the new Snippet?

As we said, the system already uses the standard snippets across the system. For example in Auto-Acknowledgement themes. Snippets have a standard format


For example you can see the Auto-Acknowledgement theme uses several standard snippets:

(In this Auto-Acknowledgement, you could change the text of the message by changing the Snippet value, instead of asking your Admin to work with the HTML code.)

If you've created a custom snippet, you have to add that snippet where you want to use it, for example your Support Center. Remember a common use case was to create a new snippet for the Support Center. Let's say you want to encourage your users to provide feedback on your articles by adding some encouragement. Currently this is what you have this

You can create a new custom snippet

Then go to your Advanced Web theme editor and add your snippet variable name

And now your article page has the new text.

Now that you've added that snippet, you can add translations for that phrase and they'll automatically be displayed if the user chooses a different language. And if you ever have to change the text, you don't have to update the HTML code - just change it in the Snippets admin page!

Sometimes you want to format snippets (eg. italize or bold). There is a workaround for that in this article for simple formatting. If  you need more advanced formatting, you can do this with CSS. 

Custom snippets can undoubtedly save you a lot of time by allowing you to pre-populate 'snippets' of text you frequently send to customers. Check out the related articles to learn more.


Related Articles