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?
Asked
Active
Viewed 84 times
1 Answers
2
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();

philnash
- 70,667
- 10
- 60
- 88
-
I am accepting the answer as a workaround. We are using `WorkflowRuleTarget` class for building the configuration and finally serializing to string. So a field for *skip_if* in `WorkflowRuleTarget` class would be the ideal solution. Hopefully the java SDK will be updated in future release. – Nick Jul 10 '19 at 09:10