Use queue keys to streamline queue rules
Last Update: Sep 2024 • Est. Read Time: 3 MINYou can use queue keys to make queue rules smarter and easier to manage. This advanced feature allows you to associate a queue with a string identifier, which acts like a shorthand code that can be used to reference the queue. Queue keys can be used to build flexible rules with variables, allowing you to build a single rule that applies to various queues.
In this article, we'll explain how you can use queue keys to build smarter rules that cover multiple similar queues. This requires a bit more upfront effort to set up but lets you manage your queues with less overhead in the long run.
Who can access this feature? | |
User types | Admins can access the Routing page. |
In this article
Add a queue key
You can set the name of the queue key in the settings for your queue.
- Go to Settings > Platform > Routing.
- In the Queues tab, Edit the desired queue.
- Expand the Advanced Configurations section, then enter a queue key name.
Use queue keys to manage similar queues
Here's an example of how using queue keys can be a smarter queue management choice. Let's say you have several queues with a similar purpose but slight variation — like chat conversations in various languages.
If you support 4 languages and you didn't utilize queue keys, you'd generally have to create 4 queue rules, one for each of your supported languages. Each individual language would have to get its own rule with Assign Rule to a Queue set as Queue Display Name.
Before using queue keys:
How queue keys help
Instead of building multiple queue rules, queue keys let you create just 1 rule to route all those chats to their respective queues, with an assignment rule powered by the queue key.
In this example case with language-based chats, start by creating each of your language-based chat queues and use a consistent naming pattern for the key name:
- Queue Display Name: English Chat
Queue Key Name: chat.en - Queue Display Name: Spanish Chat
Queue Key Name: chat.es - Queue Display Name: French Chat
Queue Key Name: chat.fr - Queue Display Name: German Chat
Queue Key Name: chat.de
Next, you'd create your queue rule. To start, the condition would be set to verify that the conversation channel is chat and determine its language.
Then, this queue rule will have the Assign Rule to a Queue setting as Queue Key. The queue key would be defined as chat.{{conversation.defaultLang}}
.
Language is a standard conversation attribute, with the name defaultLang
. This attribute can be accessed in its raw format as conversation.defaultLang
. (You can find the raw formats of attributes in your Klasses settings.)
In this example chat.{{conversation.defaultLang}}
, chat
is included as a string since it's a consistent word in all the queue keys (chat.en
, chat.es
, chat.fr
). The language is a variable and is enclosed with {{ }}
, which will render that value when the queue rule finds the respective queue. For instance, if a conversation arrives where the channel is chat and the language is French, chat.{{conversation.defaultLang}}
would become chat.fr
.
Here's how the queue rule might look using this queue key. Remember, this one rule now covers every language that had to be covered in a separate rule before!
After using queue keys:
If no matching queue key is found based on the conversation's language (for instance, the language is detected as Portuguese and you don't have an active queue with the queue key chat.pt
) the rendered result would just be chat
and no queue would be found. The conversation would then get sent to the default queue.
You can easily use Conversation, Customer, and Message attributes in queue keys. To do this, change the word conversation
to the name of the klass you want to use. For example, customer.locations
or message.preview
.
Reference custom attributes in queue keys
For another example, let's say you have a custom attribute called Contact Reason in the Conversation klass, and have 3 contact reasons: Inquiry, Order, and Post-sale. This raw attribute would look like conversation.custom.contactReasonTree
.
When creating your queue rules, you'd set up the rules with queue key names like email.inquiry
, email.order
, and email.postsale
.
Then, you'd set up a queue rule to route email conversations based on the Contact Reason attribute. As with the earlier example, we've used a variable in the key name email.{{conversation.custom.contactReasonTree}}
to reference the range of available contact reasons.