Botsplash Chat Widget Routing Configuration
This guide explains how to configure the Botsplash Chat Widget to route visitors to different engagement flows using routing keys and the built-in routing engine.
Overview
Botsplash provides flexible routing capabilities to direct visitors to appropriate chat flows based on various criteria. Routing can be configured through:
- Static Routing Keys - Hardcoded in the widget script
- Dynamic Admin Routing - Configured in Botsplash Admin panel
- Custom Property Routing - Passed through visitor data
Static Routing with routingKey
Basic Implementation
Use the routingKey parameter in BOTSPLASH_APP_PARAMS to direct visitors to specific flows:
<script type="text/javascript">
window.BOTSPLASH_APP_PARAMS = {
"routingKey": "ROUTING_KEY1",
"visitor": {
"visitorType": 2,
"firstName": "FIRST_NAME",
"lastName": "LAST_NAME",
"email": "EMAIL",
"phoneNumber": "PHONE_NUMBER",
"clientVisitorId": "EMPLOYEE_UNIQUE_ID_OR_EMAIL",
"custom": {
"routingKey": "PERSISTENT_ROUTING_KEY"
}
}
};
window.BOTSPLASH_APP_ID="d279964e-7f83-452a-a776-4ea85d0b2763";
(function(){d=document;s=d.createElement("script");s.src="https://chatcdn.botsplash.com/x.js";s.async=true;d.getElementsByTagName("head")[0].appendChild(s);})();
</script>
Routing Key Options
Primary Routing Key
window.BOTSPLASH_APP_PARAMS = {
"routingKey": "support_flow" // Direct routing to support flow
}
Persistent Custom Routing Key
window.BOTSPLASH_APP_PARAMS = {
"visitor": {
"custom": {
"routingKey": "vip_customer_flow" // Stored in visitor profile
}
}
}
Dynamic Routing Examples
Use Case Examples
Insurance Company
// Auto insurance quotes
window.BOTSPLASH_APP_PARAMS = {
"routingKey": "auto_insurance_quotes",
"visitor": {
"custom": {
"insurance_type": "auto",
"lead_source": "google_ads",
"vehicle_type": "sedan"
}
}
}
Mortgage Company
// First-time homebuyer
window.BOTSPLASH_APP_PARAMS = {
"routingKey": "quick_quote",
"visitor": {
"custom": {
"loan_type": "conventional",
"credit_score_range": "excellent",
"property_state": "CA"
}
}
}
Application Configured Dynamic Routing
Botsplash Administrator configured Routing Engine
For advanced routing without code changes, use Botsplash Dashboard → Routing to configure rules based on:
Web Chat Routing Criteria:
- Domain - Route based on website domain
- Page URL - Route based on specific page paths
- Query String Parameters - Route based on URL parameters (?source=google)
- Page Referrer - Route based on referring website
- Visitor Information - Route based on visitor data (name, email, phone)
- Visitor State - Route based on geographic location
- Extended Attributes - Route based on custom visitor properties
- Assigned Agent - Route to specific agent
- Device Type - Route based on mobile, desktop, tablet
- US Eastern Calendar Time - Route based on business hours/dates
Example Routing Rules:
Rule 1: If domain = "support.company.com" → Route to "Technical Support Flow"
Rule 2: If page URL contains "/pricing" → Route to "Sales Team"
Rule 3: If query param "source=google_ads" → Route to "Marketing Qualified Lead Flow"
Rule 4: If query param "job_post" exists → Route to "Recruiting Department"
Rule 5: If visitor state = "CA" AND device = "mobile" → Route to "Mobile CA Support"
Rule 6: If time = "Business Hours" → Route to "Live Agent", else "After Hours Bot"
Multi-Channel Routing
Beyond Web Chat
For SMS, Social Media, and other channels, additional routing attributes include:
SMS Channel Routing:
- Agent/Team - Route to specific team
- Phone Number - Route based on incoming number
- Keywords - Route based on message content
- Time-based Rules - Route based on message timing
Social Media Channel Routing:
- Platform (Facebook, Instagram, WhatsApp)
- Account/Page ID - Route based on social media account
- Message Type (public post, private message)
- Assigned Agent/Team - Maintain agent consistency
Example Multi-Channel Configuration:
// For channels beyond web chat
{
"routingKey": "omnichannel_support",
"agentId": "agent_id_123",
"teamId": "support_team_1",
"visitor": {
...
}
}
Best Practices
1. Routing Key Naming Convention
Use descriptive, hierarchical naming:
- department_product_inquiry
- sales_premium_account
- support_technical_billing
- marketing_campaign_spring2024
2. Testing Routing Rules
Test routing configurations in a staging environment:
// Add debug information
window.BOTSPLASH_APP_PARAMS = {
"routingKey": "test_routing_key",
"visitor": {
"custom": {
"debug_mode": "true",
"test_scenario": "homepage_visitor",
"expected_flow": "general_inquiry"
}
}
};
Troubleshooting
Common Issues:
- Routing Key Not Applied
- Verify routing key spelling in Admin panel
- Check browser console for JavaScript errors
- Ensure BOTSPLASH_APP_PARAMS is set before widget loads
- Fallback to Default Flow
- Check if routing rules in Admin are properly configured
- Verify visitor data meets routing criteria
- Test routing rules with different visitor profiles
For advanced routing configurations or troubleshooting, contact Botsplash support with your specific routing requirements and current setup details.