class Twilio::REST::FlexApi::V1::FlexFlowList
Public Class Methods
Initialize the FlexFlowList
@param [Version] version Version
that contains the resource @return [FlexFlowList] FlexFlowList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 18 def initialize(version) 19 super(version) 20 21 # Path Solution 22 @solution = {} 23 @uri = "/FlexFlows" 24 end
Public Instance Methods
Create the FlexFlowInstance
@param [String] friendly_name A descriptive string that you create to describe
the Flex Flow resource.
@param [String] chat_service_sid The SID of the chat service. @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
`facebook`, `sms`, `whatsapp`, `line` or `custom`.
@param [String] contact_identity The channel contact's Identity. @param [Boolean] enabled Whether the new Flex Flow is enabled. @param [flex_flow.IntegrationType] integration_type The software that will
handle inbound messages. {Integration Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types] can be: `studio`, `external`, or `task`.
@param [String] integration_flow_sid The SID of the Studio
Flow. Required when
`integrationType` is `studio`.
@param [String] integration_url The URL of the external webhook. Required when
`integrationType` is `external`.
@param [String] integration_workspace_sid The Workspace SID for a new Task.
Required when `integrationType` is `task`.
@param [String] integration_workflow_sid The Workflow SID for a new Task.
Required when `integrationType` is `task`.
@param [String] integration_channel 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`.
@param [String] integration_timeout The Task timeout in seconds for a new Task.
Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise.
@param [String] integration_priority The Task priority of a new Task. The
default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise.
@param [Boolean] integration_creation_on_message 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.
@param [Boolean] long_lived 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`.
@param [Boolean] janitor_enabled 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`.
@param [String] integration_retry_count 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.
@return [FlexFlowInstance] Created FlexFlowInstance
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 159 def create(friendly_name: nil, chat_service_sid: nil, channel_type: nil, 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) 160 data = Twilio::Values.of({ 161 'FriendlyName' => friendly_name, 162 'ChatServiceSid' => chat_service_sid, 163 'ChannelType' => channel_type, 164 'ContactIdentity' => contact_identity, 165 'Enabled' => enabled, 166 'IntegrationType' => integration_type, 167 'Integration.FlowSid' => integration_flow_sid, 168 'Integration.Url' => integration_url, 169 'Integration.WorkspaceSid' => integration_workspace_sid, 170 'Integration.WorkflowSid' => integration_workflow_sid, 171 'Integration.Channel' => integration_channel, 172 'Integration.Timeout' => integration_timeout, 173 'Integration.Priority' => integration_priority, 174 'Integration.CreationOnMessage' => integration_creation_on_message, 175 'LongLived' => long_lived, 176 'JanitorEnabled' => janitor_enabled, 177 'Integration.RetryCount' => integration_retry_count, 178 }) 179 180 payload = @version.create('POST', @uri, data: data) 181 182 FlexFlowInstance.new(@version, payload, ) 183 end
When passed a block, yields FlexFlowInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 68 def each 69 limits = @version.read_limits 70 71 page = self.page(page_size: limits[:page_size], ) 72 73 @version.stream(page, 74 limit: limits[:limit], 75 page_limit: limits[:page_limit]).each {|x| yield x} 76 end
Retrieve a single page of FlexFlowInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of FlexFlowInstance
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 105 def get_page(target_url) 106 response = @version.domain.request( 107 'GET', 108 target_url 109 ) 110 FlexFlowPage.new(@version, response, @solution) 111 end
Lists FlexFlowInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] friendly_name The `friendly_name` of the Flex Flow resources to
read.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 39 def list(friendly_name: :unset, limit: nil, page_size: nil) 40 self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries 41 end
Retrieve a single page of FlexFlowInstance
records from the API. Request
is executed immediately. @param [String] friendly_name The `friendly_name` of the Flex Flow resources to
read.
@param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of FlexFlowInstance
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 87 def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 88 params = Twilio::Values.of({ 89 'FriendlyName' => friendly_name, 90 'PageToken' => page_token, 91 'Page' => page_number, 92 'PageSize' => page_size, 93 }) 94 95 response = @version.page('GET', @uri, params: params) 96 97 FlexFlowPage.new(@version, response, @solution) 98 end
Streams FlexFlowInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] friendly_name The `friendly_name` of the Flex Flow resources to
read.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 56 def stream(friendly_name: :unset, limit: nil, page_size: nil) 57 limits = @version.read_limits(limit, page_size) 58 59 page = self.page(friendly_name: friendly_name, page_size: limits[:page_size], ) 60 61 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 62 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb 187 def to_s 188 '#<Twilio.FlexApi.V1.FlexFlowList>' 189 end