How to use the twilio/lib/resources/task_router/WorkflowBuilder.WorkflowRuleTarget function in twilio

To help you get started, we’ve selected a few twilio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TwilioDevEd / api-snippets / rest / taskrouter / workflows / list / post / example-1 / example-1.2.x.js View on Github external
};

// 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]
});
github TwilioDevEd / api-snippets / rest / taskrouter / workflows / list / post / example-1 / example-1.2.x.js View on Github external
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
github TwilioDevEd / api-snippets / rest / taskrouter / workflows / list / post / example-1 / example-1.2.x.js View on Github external
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({
github TwilioDevEd / api-snippets / rest / taskrouter / workflows / list / post / example-1 / example-1.2.x.js View on Github external
}
                ],
                "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]
});