Search code examples
twiliotwilio-taskrouter

Skip Timeout expression field not available in Twilio Java Helper Library


I am trying to create a Workflow using Twilio Java SDK (7.40.0). I have the requirement to set the 'Skip Timeout expression' (https://www.twilio.com/docs/taskrouter/worker-presence) as part of the Routing step. But i am unable to find a field for setting the 'Skip Timeout expression' in WorkflowRuleTarget class. How do i set this field?


Solution

  • Twilio developer evangelist here.

    When creating a workflow through the API the configuration should be presented as a JSON string (see the example below, from the docs). skip_if is part of the configuration, so should just be part of that JSON.

        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Workflow workflow = Workflow.creator(
                "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                "Sales, Marketing, Support Workflow",
                "{\"task_routing\": {\"filters\": [{\"expression\": \"type=='sales'\", \"targets\": [{\"queue\": \"WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}]}, {\"expression\": \"type=='marketing'\", \"targets\": [{\"queue\": \"WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}]}, {\"expression\": \"type=='support'\", \"targets\": [{\"queue\": \"WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}]}], \"default_filter\": {\"queue\": \"WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}}}")
            .setAssignmentCallbackUrl(
                URI.create("http://example.com"))
            .setFallbackAssignmentCallbackUrl(
                URI.create("http://example2.com"))
            .setTaskReservationTimeout(30)
            .create();