The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/livechat/server/hooks/beforeDelegateAgent.js

22 lines
578 B

import { callbacks } from '../../../callbacks';
import { settings } from '../../../settings';
import { Users, LivechatDepartmentAgents } from '../../../models';
callbacks.add('livechat.beforeDelegateAgent', (options = {}) => {
const { department, agent } = options;
if (agent) {
return agent;
}
if (!settings.get('Livechat_assign_new_conversation_to_bot')) {
return null;
}
if (department) {
return LivechatDepartmentAgents.getNextBotForDepartment(department);
}
return Users.getNextBotAgent();
}, callbacks.priority.HIGH, 'livechat-before-delegate-agent');