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 fetch.


232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 232

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


329
330
331
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 329

def delete
   @version.delete('DELETE', @uri)
end

#fetchFlexFlowInstance

Fetch the FlexFlowInstance

Returns:


243
244
245
246
247
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 243

def fetch
  payload = @version.fetch('GET', @uri)

  FlexFlowInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


342
343
344
345
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 342

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

#to_sObject

Provide a user friendly representation


335
336
337
338
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 335

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 (flex_flow.ChannelType) (defaults to: :unset)

    The channel type. One of `web`, `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to Flex widget passes it on to the Task attributes for Tasks created based on this Flex Flow. The Task attributes will be used by the Flex UI to render the respective Task as appropriate (applying channel-specific design and length limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex widget should set the Task Channel to Programmable Chat.

  • 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 (flex_flow.IntegrationType) (defaults to: :unset)

    The software that will handle inbound messages. Integration Type can be: `studio`, `external`, or `task`.

  • 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:


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
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 300

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,
  })

  payload = @version.update('POST', @uri, data: data)

  FlexFlowInstance.new(@version, payload, sid: @solution[:sid], )
end