Method: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowList#create

Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb

#create(friendly_name: nil, configuration: nil, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, task_reservation_timeout: :unset) ⇒ WorkflowInstance

Create the WorkflowInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

    A descriptive string that you create to describe the Workflow resource. For example, ‘Inbound Call Workflow` or `2014 Outbound Campaign`.

  • configuration (String) (defaults to: nil)

    A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](www.twilio.com/docs/taskrouter/workflow-configuration) for more information.

  • assignment_callback_url (String) (defaults to: :unset)

    The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details.

  • fallback_assignment_callback_url (String) (defaults to: :unset)

    The URL that we should call when a call to the assignment_callback_url fails.

  • task_reservation_timeout (String) (defaults to: :unset)

    How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to ‘86,400` (24 hours) and the default is 120.

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 44

def create(
    friendly_name: nil, 
    configuration: nil, 
    assignment_callback_url: :unset, 
    fallback_assignment_callback_url: :unset, 
    task_reservation_timeout: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'Configuration' => configuration,
        'AssignmentCallbackUrl' => assignment_callback_url,
        'FallbackAssignmentCallbackUrl' => fallback_assignment_callback_url,
        'TaskReservationTimeout' => task_reservation_timeout,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    WorkflowInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
    )
end