Class: Twilio::REST::FlexApi::V1::FlexFlowContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ FlexFlowContext

Initialize the FlexFlowContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Flex Flow resource to update.



215
216
217
218
219
220
221
222
223
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 215

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/FlexFlows/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the FlexFlowInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 227

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchFlexFlowInstance

Fetch the FlexFlowInstance

Returns:



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 239

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    FlexFlowInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



339
340
341
342
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 339

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.FlexApi.V1.FlexFlowContext #{context}>"
end

#to_sObject

Provide a user friendly representation



332
333
334
335
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 332

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.FlexApi.V1.FlexFlowContext #{context}>"
end

#update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset) ⇒ FlexFlowInstance

Update the FlexFlowInstance

Parameters:

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

    A descriptive string that you create to describe the Flex Flow resource.

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

    The SID of the chat service.

  • channel_type (ChannelType) (defaults to: :unset)
  • contact_identity (String) (defaults to: :unset)

    The channel contact’s Identity.

  • enabled (Boolean) (defaults to: :unset)

    Whether the new Flex Flow is enabled.

  • integration_type (IntegrationType) (defaults to: :unset)
  • integration_flow_sid (String) (defaults to: :unset)

    The SID of the Studio Flow. Required when ‘integrationType` is `studio`.

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

    The URL of the external webhook. Required when ‘integrationType` is `external`.

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

    The Workspace SID for a new Task. Required when ‘integrationType` is `task`.

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

    The Workflow SID for a new Task. Required when ‘integrationType` is `task`.

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

    The Task Channel SID (TCXXXX) or unique name (e.g., ‘sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`.

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

    The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when ‘integrationType` is `task`, not applicable otherwise.

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

    The Task priority of a new Task. The default priority is 0. Optional when ‘integrationType` is `task`, not applicable otherwise.

  • integration_creation_on_message (Boolean) (defaults to: :unset)

    In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging.

  • long_lived (Boolean) (defaults to: :unset)

    When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to ‘false`.

  • janitor_enabled (Boolean) (defaults to: :unset)

    When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to ‘false`.

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

    The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when ‘integrationType` is `studio` or `external`, not applicable otherwise.

Returns:



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 275

def update(
    friendly_name: :unset, 
    chat_service_sid: :unset, 
    channel_type: :unset, 
    contact_identity: :unset, 
    enabled: :unset, 
    integration_type: :unset, 
    integration_flow_sid: :unset, 
    integration_url: :unset, 
    integration_workspace_sid: :unset, 
    integration_workflow_sid: :unset, 
    integration_channel: :unset, 
    integration_timeout: :unset, 
    integration_priority: :unset, 
    integration_creation_on_message: :unset, 
    long_lived: :unset, 
    janitor_enabled: :unset, 
    integration_retry_count: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'ChatServiceSid' => chat_service_sid,
        'ChannelType' => channel_type,
        'ContactIdentity' => contact_identity,
        'Enabled' => enabled,
        'IntegrationType' => integration_type,
        'Integration.FlowSid' => integration_flow_sid,
        'Integration.Url' => integration_url,
        'Integration.WorkspaceSid' => integration_workspace_sid,
        'Integration.WorkflowSid' => integration_workflow_sid,
        'Integration.Channel' => integration_channel,
        'Integration.Timeout' => integration_timeout,
        'Integration.Priority' => integration_priority,
        'Integration.CreationOnMessage' => integration_creation_on_message,
        'LongLived' => long_lived,
        'JanitorEnabled' => janitor_enabled,
        'Integration.RetryCount' => integration_retry_count,
    })

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