About This Guide
Prerequisites
API Versions
Fallback Routing Code Sample
Set fallback routing rules in pre-chat forms in case the agent specified for direct-to-agent routing isn’t available when a chat is received.
The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to Messaging for In-App and Web before that date. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in Help.
Important
What if you set up direct-to-agent routing, but the agent you specified to receive the chats isn’t available? If the agent is offline, those chats might be lost.
Luckily, if your organization uses pre-chat forms to gather customer information, you can set up fallback routing options for a button that uses direct-to-agent routing.
This code sample demonstrates how to route chats using another button’s default routing rules if the agent assigned to that button isn’t available. Let’s take a look at this section of code:
1<h1>Pre-chat Form</h1>
2<form method='post' id='prechatForm'>
3 Name: <input type='text' name='liveagent.prechat.name' id='prechat_field' /><br />
4 Email Address: <input type='text' name='liveagent.prechat:Email' /><br />
5 Department: <select name="liveagent.prechat.buttons">
6 <!-- Values are LiveChatButton and/or User IDs. -->
7 <option value="573D01234567890">Route through button 573D01234567890</option>
8 <option value="005D01234567890">Route to agent 005D01234567890</option>
9 <option value="005D01234567890_573D01234567890">Route to agent 005D01234567890
10 with Fallback to button 573D01234567890</option>In this section, we specify that chats originating from the button should be routed to an agent with agent ID 005xx000001Sv1m. If that agent isn’t available, incoming chats are routed based on the default routing rules for the button with button ID 573xx0000000001.
Implement fallback routing rules in pre-chat forms so visitors can chat with another agent with the specified agent isn’t available.