如何在 Twilio Taskrouter 工作流上配置 skip_if

How do I configure skip_if on Twilio Taskrouter Workflow

我正在开发 Twilio Taskrouter。

我无法在控制台上配置 skip_if,也无法更新 API。 https://www.twilio.com/docs/api/taskrouter/worker-presence

我尝试更新 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。

TaskRouter 私信这里。我已经更新了此功能的文档,它应该可以回答您的所有问题:

https://www.twilio.com/docs/api/taskrouter/worker-presence

(它目前不会在任一视图的控制台中显示 - 请参阅文档中的注释)