Reroute conversations from the default queue
Last Update: Nov 2024 • Est. Read Time: 4 MINIn Queues and Routing, your default queue acts as a catch-all for conversations that do not match any of your queue rules. It has a queue priority of 1 and cannot be edited or deleted.
In some cases, automations — like business rules, workflows, or APIs — might run after a conversation has already been routed, and those automations are critical for the conversation landing in the right queue. In this scenario, you can use a workflow to clear the queue assignment on conversations that go to the default queue and requeue them.
Who can access this feature? | |
User types | Admins and users with permissions to access workflows and API keys. |
In this article
- Prerequisites
- Create an API key
- Create the workflow
- Add the workflow JSON
- Add the API key to the workflow
- Customize the workflow
Prerequisites
Before following this guide, you should already be comfortable with the basics of using workflows. Workflows overview
We also recommend being familiar with creating API keys and adding workflow variables.
Create an API key
First, you'll need to set up the API key to use with the workflow.
- Create an API key.
- When setting up your new API key, assign it with the roles
org.permission.conversation.update
andorg.user.conversation.write
. - Then, keep the token in a secure location to use later in this guide.
Create the workflow
Next, you'll set up the workflow to reroute conversations.
- Go to Settingsand select Platform > Workflows.
- Select Add Workflow > Custom Workflow.
- The New Workflow modal will appear. Fill out the Workflow Title. You can leave the Description field blank because the code snippet below will provide this for you.
- Leave the callable workflow option turned off.
- Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.
Add the workflow JSON
Then, Use the Workflow Editor to paste in the workflow JSON code provided below. This JSON will take care of most of the workflow creation.
- In the Workflow Editor, open the Workflow Optionsmenu and select Edit Workflow JSON.
- A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.
- Copy the below code block, and paste it into the JSON text field in your Workflow Editor. Then, select Update to save the changes to the workflow and dismiss the JSON editor.
{ "description": "", "name": "reroute-conversations-from-default-queue", "steps": [ { "transitions": [ { "target": "6g9Dokv3y", "condition": { "op": "neq", "values": [ "/#steps.1.status", "done" ] }, "meta": { "name": "Conversation is Open or Snoozed" } } ], "errorCases": [], "id": "TSL_jNt24" }, { "transitions": [], "errorCases": [], "id": "6g9Dokv3y", "action": "kustomer.rest-api.json", "params": { "uri": "https://api.kustomerapp.com/v1/conversations/{{steps.1.id}}", "method": "PATCH", "data": { "queue": { "id": null }, "assignedUsers": [] }, "headers": { "Authorization": "Bearer", "Content-Type": "application/json" }, "json": true }, "meta": { "displayName": "Unset Queue to Reroute Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "TSL_jNt24", "condition": { "op": "dne", "values": [ "/#steps.1.assignedUsers.0", "" ] }, "meta": { "name": "Conversation is Unassigned" } } ], "errorCases": [], "id": "i6HWiIZeM" } ], "trigger": { "transitions": [ { "target": "i6HWiIZeM", "condition": { "op": "contains", "values": [ "/#steps.1.queue", null ] }, "meta": { "name": "Conversation Routed to Default Queue" } } ], "eventName": "kustomer.conversation.update", "id": "1", "appVersion": "kustomer-^1.9.2" } }
The workflow will look like this:
Add the API key to the workflow
- Reopen the Workflow Optionsmenu and select Workflow Variables.
- Add the saved token from the API key you created earlier as a workflow variable. Name the workflow variable as desired and add the token in the Value field.
- Save the variable, select Close to exit the workflow editor, and save the updated workflow.
Customize the workflow
- In Step 4 of the workflow, select the key icon in the REST API JSON action step to access the workflow variable saved, and copy the workflow variable.
- Add a single space after Bearer in the Headers section, and paste the copied value which is the API token needed for authorization. Set the JSON (boolean) field to true.
- In the first condition called Conversation Routed to Default Queue, select the Default Queue as the queue that the conversation should be in.
- If there are any other changes to the workflow that you'd like to make, do so now. When you're finished, Save all and other workflow changes, and use the toggle to activate the workflow.