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.



205
206
207
208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 205

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



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

def delete

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

#fetchFlexFlowInstance

Fetch the FlexFlowInstance

Returns:



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

def fetch

    payload = @version.fetch('GET', @uri)
    FlexFlowInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



313
314
315
316
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 313

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

#to_sObject

Provide a user friendly representation



306
307
308
309
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 306

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:



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 255

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