Method: Twilio::REST::Studio::V2::FlowContext::ExecutionList#create

Defined in:
lib/twilio-ruby/rest/studio/v2/flow/execution.rb

#create(to: nil, from: nil, parameters: :unset) ⇒ ExecutionInstance

Create the ExecutionInstance

Parameters:

  • to (String) (defaults to: nil)

    The Contact phone number to start a Studio Flow Execution, available as variable ‘Twilio::REST::Studio::V2::FlowContext::ExecutionList.{contact{contact.channel{contact.channel.address}`.

  • from (String) (defaults to: nil)

    The Twilio phone number to send messages or initiate calls from during the Flow’s Execution. Available as variable ‘Twilio::REST::Studio::V2::FlowContext::ExecutionList.{flow{flow.channel{flow.channel.address}`. For SMS, this can also be a Messaging Service SID.

  • parameters (Object) (defaults to: :unset)

    JSON data that will be added to the Flow’s context and that can be accessed as variables inside your Flow. For example, if you pass in ‘Parameters=\"name\":\"Zeke\"`, a widget in your Flow can reference the variable `Twilio::REST::Studio::V2::FlowContext::ExecutionList.{flow{flow.data{flow.data.name}`, which returns \"Zeke\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string.

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 42

def create(
    to: nil, 
    from: nil, 
    parameters: :unset
)

    data = Twilio::Values.of({
        'To' => to,
        'From' => from,
        'Parameters' => Twilio.serialize_object(parameters),
    })

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