Contents
- Introduction
- Scenario Builder Application
- Scenario Blocks
- Accept
- Add to Calling List
- Answer
- Attached Data
- Collect Digits
- Comment
- Connect Call
- Connect Chat
- DB Execute
- Exception Handler
- Exit
- 1 Fetch URL
- Find Agent
- Get Next Record
- Get Statistics
- Get User Configuration
- Goto
- If
- Internal Message
- Log
- Menu
- Play Prompt
- Record
- Request Callback
- Request Input
- Request Skill or Service
- RightNow Create Object
- RightNow Screen Pop
- RightNow Search
- RightNow Select Account
- RightNow Update
- Salesforce.com Delete
- Salesforce.com Insert
- Salesforce.com Screenpop
- Salesforce.com Search
- Salesforce.com Update
- Save Survey Response
- Self-Service Provided
- Search Directory
- Send Message
- Set Agent State
- Set Disposition
- Set Priority
- Set Prompt Language
- Set Variable
- Start Another Scenario
- Stop Prompt
- Voicemail
- Wait
- Web Screen Pop
- Zendesk Create Object
- Zendesk Screen Pop
- Zendesk Search
- Zendesk Select Account
- Zendesk Update Object
- Variables and Expressions
- Voice Segment Types
- Scenario Example
Fetch URL
The Fetch URL scenario block fetches web content, including JSON-formatted data, from a specified URL, using a specified method and parses it into scenario variables. Both HTTP and HTTPS protocols are supported, as well as basic authentication.
Conditional Exits
The Fetch URL block may take one of two conditional exits: Failed or No Data.
- The Failed conditional exit is taken if an error occurred during the HTTP method execution. See HTTP Response Codes below for details.
- The No Data conditional exit is executed if no data is returned in the body of the HTTP response.
Settings
Title text
Title text is the name of the instance of the block, displayed in the flowchart.
Request type
Request type is the type of method to be used to fetch web content from the specified URL. Request types are defined in the pull-down menu.
Select from the following request types, or write in another method manually:
- GET (default)
- POST
- HEAD
- PUT
- DELETE
- CONNECT
- OPTIONS
- TRACE
URL to fetch
URL to fetch is the HTTP/HTTPS URL of the web content to get. Query string parameters are specified separately.
URL parameters
These are the URL parameters to be URL encoded and appended into URL. Scenario variables can be used by inserting them as $(varname). Click add to define URL parameters, type in the name, and type in the value.
Content Type
Content type is the type of data to be submitted in request body. The setting is displayed only if request type POST is selected.
Select application/json for a JSON data structure, or select application/x-www-form-urlencoded for a URI-encoded data in the body of the message.
Body
Body is the data to be submitted in the request body. The setting is displayed only if request type POST is selected.
Body is the data to be submitted. The format of the data must correspond to the Content Type above. Scenario variable substitutions are allowed.
Username
Username is the request authentication username. Variable substitutions are allowed.
Password
Password is the request authentication password. Variable substitutions are allowed.
Initial path in the result JSON
If the response body contains JSON, this setting can be used to save into scenario variables a specific part of the data. Example: myobject.node.list[4]. The default is "none"; the path starts from the root of the returned JSON.
Scenario variable prefix for JSON data
This string will be used as the name of the variable to receive parsed JSON data. Note that if the initial path above points to an array, depending on the value of the GetNext option below, this variable would either contain the array or its first (an subsequent) elements.
Use GetNext block to loop through data
This box is selected if the JSON response data (at the initial path) is an array. The scenario variable will be set to the first element of the array and GetNext block could be used to iterate over the array elements, setting scenario variable to the next element.
Note: If you enable this option, the behavior of the Fetch URL block will be the same as it was for Bright Pattern Contact Center version 3.13 and earlier.
Response Data Handling
In all cases, the response data is limited to 50 KB.
If the response data is not JSON-encoded, it could be accessed as string via the $(integrationResultBody) scenario variable described below.
If the response data is JSON, the following will happen:
- It will be parsed.
- If the "GetNext" option is enabled and the item the initial path is pointing to is a regular, non-associative array:
- The scenario variable will be set to the first item of the array.
- The GetNext block could be used to initialize the variable to the next and subsequent items.
- Otherwise, the scenario variable will be set to the item to which the initial path is pointing.
Possible syntax for the initial path setting and the access to the data saved in the scenario variable is as follows:
- item.subitem
- item[index]
- item[attr1=value].attr2
- combinations (e.g., item.subitem.array[index].value.array[attr=x].value)
HTTP Response Codes
The status code and the body of the received HTTP response will be stored in local variables $(integrationResultCode) and $(integrationResultBody), respectively. For troubleshooting purposes, you may use the EMail or Internal Message block to obtain content of responses indicating a failed attempt. For more information, see the description of variable $(integrationResultBody).
For backward compatibility reasons, the code and the body of the received HTTP response are also stored in local variables $(fetchURLResultCode) and $(fetchURLResultBody).
The possible values of the $(fetchURLResultCode) variable are as follows:
- 0: 200 OK response (i.e., a successful HTTP request response)
- -1: 200 OK response, but unable to parse the body into recordset
- -2: 200 OK response, but body length exceeds 50 KB
- -3: Unable to connect to HTTP server or other connection errors
- Other: Actual non-200 response code
HTTP Redirect Response Handling
The Fetch URL block handles 3xx Hypertext Transfer Protocol (HTTP) response codes in the following way.
When the following codes are received, the block retries the request to the provided redirect URL using the GET request method:
- 301 Moved Permanently
- 302 Found
- 303 See Other (since HTTP/1.1)
When the following codes are received, the block retries the request to the provided redirect URL using the originally specified request method:
- 307 Temporary Redirect (since HTTP/1.1)
- 308 Permanent Redirect (RFC 7538)
When the following status codes are received, the conditional exit Failed will be selected:
- 300 Multiple Choices
- 304 Not Modified (RFC 7232)
- 305 Use Proxy (since HTTP/1.1)
- 306 Switch Proxy