我正在开发Twilio Taskrouter。
我无法在控制台和Update API上配置skip_if。 https://www.twilio.com/docs/api/taskrouter/worker-presence
我尝试过Update API,响应JSON有skip_if。
但是,控制台JSON没有skip_if。
如何配置skip_if?
谢谢@philnash。 我的代码如下。
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);
}
抱歉,我忘了写期待结果。
之前,执行上面的代码。
{
"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"
}
}
之后,执行上面的代码,结果是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"
}
}
}
但是,我的twilio控制台在执行JSON之前显示。
答案 0 :(得分:1)
TaskRouter PM在这里。我已经更新了此功能的文档,该文档应该回答您的所有问题:
https://www.twilio.com/docs/api/taskrouter/worker-presence
(它不会在任何一个视图中显示在控制台中 - 请参阅文档中的注释)