JacqBot
02/18/2025, 1:45 AMFinn
02/18/2025, 5:58 AMBryce
02/18/2025, 2:53 PMKyle
02/18/2025, 8:19 PMKyle
02/18/2025, 8:23 PMdetailed-expl.
To have different assistants handle calls during business hours versus after hours/weekends, you'll need to:
1\. Create two assistants:
- Business Hours Assistant
- After Hours Assistant
2\. Set up a server endpoint that will determine which assistant to use based on the current time
3\. Configure your phone number to use this server URLShubham Bajaj
02/18/2025, 8:24 PMjs
import express from 'express';
const app = express();
app.use(express.json());
const BUSINESS_HOURS = {
timezone: 'Australia/Melbourne',
weekdayStart: '09:00',
weekdayEnd: '17:00',
weekdayAssistantId: 'your-business-hours-assistant-id',
weekendAssistantId: 'your-after-hours-assistant-id'
};
function isBusinessHours() {
const now = new Date();
const melbourne = new Intl.DateTimeFormat('en-US', {
timeZone: BUSINESS_HOURS.timezone,
hour: 'numeric',
minute: 'numeric',
weekday: 'long',
hour12: false
});
const localDateTime = melbourne.format(now);
const isWeekend = localDateTime.includes('Saturday') || localDateTime.includes('Sunday');
if (isWeekend) return false;
const currentTime = localDateTime.split(', ')[1];
return currentTime >= BUSINESS_HOURS.weekdayStart && currentTime <= BUSINESS_HOURS.weekdayEnd;
}
app.post('/assistant-request', (req, res) => {
const response = {
assistantId: isBusinessHours()
? BUSINESS_HOURS.weekdayAssistantId
: BUSINESS_HOURS.weekendAssistantId
};
res.json(response);
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});
2. Configure Your Phone Number
In the Vapi dashboard:
1. Go to Phone Numbers
2. Select your phone number
3. Set the Server URL to your endpoint (e.g., https://your-domain.com/assistant-request)
4. Remove any default assistant/squad assignment
Now, when someone calls:
- During business hours (9 AM - 5 PM Melbourne time, weekdays), they'll get your business hours assistant
- Outside business hours or on weekends, they'll get your after-hours assistantJacqBot
02/19/2025, 2:43 AMJacqBot
02/21/2025, 3:08 AM