Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
// or utilizing objects
var wb = require('twilio/lib/resources/task_router/WorkflowBuilder');
// sales
var salesTarget = new wb.WorkflowRuleTarget({
queue: salesQueue
});
var salesRule = new wb.WorkflowRule({
expression : "type == 'sales'",
targets : [salesTarget]
});
// marketing
var marketingTarget = new wb.WorkflowRuleTarget({
queue: marketingQueue
});
var marketingRule = new wb.WorkflowRule({
expression : "type == 'marketing'",
targets : [marketingTarget]
});
// support
var supportTarget = new wb.WorkflowRuleTarget({
queue: supportQueue
});
var supportRule = new wb.WorkflowRule({
expression : "type == 'support'",
targets : [supportTarget]
});
var salesRule = new wb.WorkflowRule({
expression : "type == 'sales'",
targets : [salesTarget]
});
// marketing
var marketingTarget = new wb.WorkflowRuleTarget({
queue: marketingQueue
});
var marketingRule = new wb.WorkflowRule({
expression : "type == 'marketing'",
targets : [marketingTarget]
});
// support
var supportTarget = new wb.WorkflowRuleTarget({
queue: supportQueue
});
var supportRule = new wb.WorkflowRule({
expression : "type == 'support'",
targets : [supportTarget]
});
// default
var defaultTarget = new wb.WorkflowRuleTarget({
queue: everyoneQueue
});
// put all together
var taskRouting = new wb.TaskRoutingConfiguration({
filters : [salesRule, marketingRule, supportRule],
default_filter : defaultTarget
var marketingRule = new wb.WorkflowRule({
expression : "type == 'marketing'",
targets : [marketingTarget]
});
// support
var supportTarget = new wb.WorkflowRuleTarget({
queue: supportQueue
});
var supportRule = new wb.WorkflowRule({
expression : "type == 'support'",
targets : [supportTarget]
});
// default
var defaultTarget = new wb.WorkflowRuleTarget({
queue: everyoneQueue
});
// put all together
var taskRouting = new wb.TaskRoutingConfiguration({
filters : [salesRule, marketingRule, supportRule],
default_filter : defaultTarget
});
var config = new wb.WorkflowConfiguration({
taskRouting: taskRouting
});
// convert to json
configuration = config.toJSON();
client.workspace.workflows.create({
}
],
"expression":"type == \"support\""
}
],
"default_filter":{
"queue": everyoneQueue
}
}
};
// or utilizing objects
var wb = require('twilio/lib/resources/task_router/WorkflowBuilder');
// sales
var salesTarget = new wb.WorkflowRuleTarget({
queue: salesQueue
});
var salesRule = new wb.WorkflowRule({
expression : "type == 'sales'",
targets : [salesTarget]
});
// marketing
var marketingTarget = new wb.WorkflowRuleTarget({
queue: marketingQueue
});
var marketingRule = new wb.WorkflowRule({
expression : "type == 'marketing'",
targets : [marketingTarget]
});