Issue
I'm developing Twilio Taskrouter.
I cannot configure skip_if on console and also Update API. https://www.twilio.com/docs/api/taskrouter/worker-presence
I tried Update API, response JSON has skip_if.
But, console JSON has no skip_if.
How do I configure skip_if?
Thank you @philnash. My codes are below.
public function test_retrieveWorkflow()
{
$account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$auth_token = "xxxxxxxxxxxxxxx";
$client = new Client($account_sid, $auth_token);
$workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$workflow_sid = 'WWxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$workflow = $client->taskrouter
->workspaces($workspace_sid)
->workflows($workflow_sid)
->fetch();
$configurations = json_decode($workflow->configuration, true);
$filters = $configurations['task_routing']['filters'];
foreach ($filters as &$filter) {
foreach ($filter['targets'] as &$target) {
$target['skip_if'] = 'workers.available == 0';
}
}
$configurations['task_routing']['filters'] = $filters;
$configurations = json_encode($configurations);
$workflow = $workflow->update(['configuration' => $configurations]);
var_dump($workflow);
}
Sorry,I forgot to write expect result. Before, execute above code.
{
"task_routing": {
"filters": [
{
"targets": [
{
"queue": "WQyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"expression": "task.email==worker.email",
"timeout": "10"
},
{
...
}
],
"filter_friendly_name": "filter by email",
"expression": "1==1"
}
],
"default_filter": {
"queue": "WQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
After, execute above code, result is expected JSON.
{
"task_routing": {
"filters": [
{
"targets": [
{
"queue": "WQyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"expression": "task.email==worker.email",
"timeout": "10",
"skip_if": "workers.available == 0"
},
{
...
}
],
"filter_friendly_name": "filter by email",
"expression": "1==1"
}
],
"default_filter": {
"queue": "WQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
But, my twilio console shows before execute JSON.
Solution
TaskRouter PM here. I've updated the docs for this feature, which should answer all your questions:
https://www.twilio.com/docs/api/taskrouter/worker-presence
(it won't currently show in the console in either view - see note in docs)
Answered By - Al Cook Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.