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.


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

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


319
320
321
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 319

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

#fetchFlexFlowInstance

Fetch the FlexFlowInstance

Returns:


238
239
240
241
242
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 238

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

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

#inspectObject

Provide a detailed, user friendly representation


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

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

#to_sObject

Provide a user friendly representation


325
326
327
328
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 325

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. Can be: `web`, `facebook`, `sms`, `whatsapp`, `line` or `custom`.

  • 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 webhook if the first attempt fails. Can be an integer between 0 and 3 (inclusive), default is 3. Optional when `integrationType` is `external`, not applicable otherwise.

Returns:


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

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