Alert Task – SOAP API Request
In this article, we see how to configure an API Request for a SOAP service, as part of an Alert Task. Learn more about Alert tasks here.
SOAP API Request Overview
For a task with the Connection Type specified as Webservice and the Connection Mode set to SOAP you need to define:
- Authentication – If required for your alert task, you need to define the authentication to access the API, for example, using basic authorization, OAuth, or API Key as mentioned here.
- WSDL URL – Define the URL that contains your WSDL data. When the URL is retrieved, you can choose from a list of Available Operations based on the WSDL, and then customize the user input fields, Learn more.
- Access Using a connector – Specify if your Bots Platform is installed on-premises and you want to user the Kore.ai Connector agent. Learn more.
- Response Sample – Define key/value pairs that you expect to receive in the task payload. The keys that you provide are available as drop-down choices for handling the data to display to the end-user. Learn more.
- Preview Website Link Content in Post – The website preview content displayed in the task notification message. Learn more.
Click Save to save the API request settings.
Define the WSDL URL
- On the API Request tab, expand the WSDL URL section.
-
To begin the task configuration for a SOAP request, enter the URL for your SOAP WSDL in the WSDL URL field.
-
Click Get WSDL Description. A list of the available operators defined in the WSDL is displayed.
- Click Select for the SOAP request that you want to use for your task. Kore.ai automatically populates one or more Alert Task Fields if necessary for user input.
Customize SOAP Alert Task Fields
You can customize the default input fields provided by Kore.ai after you select one or more of the Available Operations from your WSDL.
To customize the default Alert Task Fields, click Edit for the Alert Task Field that you want to customize.
The Set up Alert Task Field dialog is displayed as shown in the following illustration.
To define end-user fields for a task, follow the steps below:
- Specify the values for the parameters in the Set up Alert Task Field dialog as described in the following table.
FIELD NAME
|
DESCRIPTION
|
Field Title
|
The title of the task input field displayed in the end-user interface, for example, Country.
|
Help Hint
|
The help text displayed below the task setting the title to describe the task, for example, Enter the Country Name you want the Weather for.
|
Field Key
|
A read-only key that represents the end-user input value that you want to collect, for example, country.
|
Field Type
|
Specifies the type of task input field displayed in the end-user interface to collect user input for the request object to assign to the Key value. The default setting is Textbox, but can be customized to any one of the following:
- Date – Displays the Format field where you can select the date format syntax for the end-user to define when the task is configured for their account. In the Select Date Format drop-down list, select one of the following:
- dd-MM-YYYY – For example, 16-05-1999
- MM-dd-YYYY – For example, 05-16-1999
- dd-MM-YY – For example, 16-05-99
- YYYY-MM-dd – For example, 1999-05-16
URL – Displays a text box for the end-user to enter a URL including field validation for a correct URL syntax. In the Placeholder field, enter the help hint displayed in the text box, for example, Enter the URL for the website here.
Textbox – Displays a text box for the end-user to enter text as the task input field, typically just a few words. In the Placeholder field, enter the help hint displayed in the text field, for example, Type in the name you want to embroider.
Password – Displays a text box for the user to enter a password for the web service.
Static Dropdown – Displays a drop-down list of choices to the end-user. Click Add Option to begin adding the list of items to display to the end-user with the following parameters:
- Option Name – The name of the option displayed to the end-user.
- Option Value – The value the represents the Option Name returned to the application.
- Default Value – Select the default value for the option when more than one option is defined.
- Searchable – Select to enable dynamic search and display as the end-user enters text in this field, or if no matches, allow free-form entry.
Click Save. To add additional items, click Add Option again. Edit or remove options in the Actions column for options.
Dynamic Dropdown – Displays a drop-down list dynamically populated at runtime based on the response from a URL for your Bot, for example, a list of projects for a JIRA task notification. Define the following properties for a dynamically populated dropdown.
- Use Separate WDSL – Add the WDSL URL, then click Get WDSL Description. You can then follow the same steps mentioned below.
- Available Operations – If you don't use a separate WDSL,you can select a pre-existing operation. To do so, click Select in the Action column.
- Endpoint Content Type – The content type expected from the specified endpoint URL. One of: JSON, RSS, XML, URL Encoded JSON, CCV, Text, or Twitter Encoded JSON.
- Endpoint Method – You can choose one of the following:
- GET – Specifies an HTTP Request GET method for the task field.
- POST – Specifies an HTTP Request POST method for the task field.
- Response Path – The path in the response that contains the desired drop-down list values, for example, data.
- Option Label Key – The key for the label of the drop-down option, for example, name.
- Option Value Key – The key for the value of the drop-down option, for example, id.
- Searchable – Select to enable dynamic search and display as the end-user enters text in this field, or if no matches, allow free-form entry.
Textarea – Displays a text area box for the end-user to enter text as the task input, typically for several sentences. In the Placeholder field, enter the help hint displayed inside the text area.
Type Ahead – Displays a dynamically populated drop-down list of choices to the end-user at runtime when the user enters three or more characters that match the search results based on the response from the URL defined for the task. For example, a list of projects for a JIRA task notification message. Define the following properties for a dynamically populated drop-down.
- Use Separate WDSL – Add the WDSL URL, then click Get WDSL Description. You can then follow the same steps mentioned below.
- Available Operations – If you don't use a separate WDSL,you can select a pre-existing operation. To do so, click Select in the Action column.
- Endpoint Content Type – The content type expected from the specified endpoint URL. One of: JSON, RSS, XML, URL Encoded JSON, CCV, Text, Twitter Encoded JSON, Multipart/Form-data, or Multipart/Related.
- Endpoint Method – One of:
- GET – Specifies an HTTP Request GET method for the task field.
- POST – Specifies an HTTP Request POST method for the task field.
- Response Path – The path in the response that contains the desired drop-down list values, for example, data.
- Label Key – The key for the label of the drop-down option, for example, name.
- Option Value Key – The key for the value of the drop-down option, for example, id.
Email – Displays a text box for the end-user to input an email address. In the Placeholder field, enter the helpful hint to display to the end-user inside the text box.
Date & Time – Displays a text box for the end-user to input a date with time. In the Format field, enter the expected date or time format to display to the end-user in the date text box. In the Select Date Format drop-down list, select the date with time format.
Time Zone – Displays a drop-down list of time zones based on the operating system settings.
Location – Displays a text box for the end-user to enter a geographical location, for example, Orlando, FL, or 32801.
Nested Form – Displays end-user input fields in a nested format below the parent input field. Specify the following fields for a nested form input field:
- Array Element Type – Select the data type of the parent input form element.
- Add Nested Form Field – Click to add one or more nested form fields.
File Upload – Displays end-user control to search for, and select a file to upload. When clicked, enter the File Upload Payload Key. When the File Upload Payload Key is defined, in the File Upload Payload Field Value drop-down list, select one of the following types:
- File Name
- File Size
- File Content Type
|
Data Type
|
Select one of these user input types:
- String – Users can input any sequence of numbers, letters, or special characters.
- Number – Users can input a number. No special characters are allowed.
- Boolean – User can input a Boolean value of true or false.
- Email – User can input a valid email address.
- Object – Data from a Bot can be received as JSON objects, for example, as location details defined as:
“location” : {
“lat” : 17.4374614,
“lng” : 78.4482878
}
where you can refer to the properties in a request chain or task request as location.lat, and location.lng.
- Array – Users can pass a comma-separated list of values to the Bot. For example, in Google Calendar, multiple attendees with data can be passed as:
“attendees”: [“user1”, “user2”, “user3”]When selected, specify the Type for the array of end-user input as one of:
- String
- Number
- Boolean
- Email
- Array
- Date
- Date – Users can type a complete date or select it from a date picker.
|
Placeholder
|
The text displayed below the input textbox to help the user define the field. This field is only displayed for some Field Types.
|
Visibility
|
Specify if the task input field should be visible or hidden from the end-user.
The Visibility field can also be set to Custom field where data is captured from the user but not used as a query parameter or payload field. For example, with a JIRA bot, posting a comment on a ticket using an @mention tag as shown below:
“@Mike, please look into this issue”
The JIRA API to Post a comment requires one query field and one payload field as:
- Issue ID
- Comment
With the Visibility field set to Custom, you can capture the user information for the user mentioned as @Mike using the JIRA API to fetch data to append to the comment field value, but not to use as payload field or query field.
The default Visibility field setting is Visible.
|
Mandatory
|
Select if the end-user must define this setting to save the task settings configuration.
|
Untranspose the Key |
Select to disable key transposition by Kore.ai. By default, Kore.ai transposes a key/value pair, for example, "parameter":"value" is transposed by Kore.ai to "parameter:{value:"actualValue"} . When selected, keys are not transposed by Kore.ai and passed in the response as received.
|
- Click Add & Continue to save the alert task field for the API request.
- Create another alert task field, or click Add & Exit to save the alert task field for the API request.
- Close the dialog.
Access Using a Connector
To get started with defining access using a connector for a task, follow these steps:
- On the API Request tab, expand the Access using a connector section.
-
In the Access Using A Connector field, select Yes to enable access for Kore.ai Bots using the Kore.ai Connector agent.
This option is only visible if a Kore.ai Connector agent is configured and enabled in your enterprise on-premises network. For more information, see Using the Kore.ai Connector.
Add the Response Sample
In the Response Sample section, you can enter or paste examples of the key-value pairs that you expect to receive in the task payload. When you define the response sample, the keys specified in the Response Sample section are available as drop-down choices for handling the output data.
To add the sample response, follow the steps below:
- On the API Request tab, expand the Sample Response section.
- Enter your Response Sample that contains the key-value pairs from your JSON response payload.
-
Do one of the following:
-
To format the view of the response as a JSON structure with indentation as shown in the following illustration, click the Formatted icon.
-
To format the view of the response in serialized compact form as shown in the following illustration, click the Unformatted icon.
Website Preview Content
Some web services send links to preview media as part of the payload response. In this section, you can enable or disable preview links, and define the path to the links in the payload.
By default, website preview links are disabled. The following illustration is an example of the Preview Website Link Content in Post section, when Yes is selected.
When enabled, define the path to the preview links in the payload in the Path to the Link (toPreview) field, if the path is not in the root of the payload.
For example, in the following code example from an RSS payload, the path to the preview is… “item”: “title”: “U.S. to Boost Refugee Intake by 30,000 by 2017”, “guid”: { “-isPermaLink”: “false”, “#text”: “SB12418904751422433479504581245034032986752” }, “link”: “http://www.wsj.com/articles/john-kerry-says-u-s-to-admit-30-000-more-refugees-in-next-2-years-1442768498?mod=fox_australian”
When Preview website link content in Post is enabled, select preview objects such as:
- Preview Title – Displays the title of the website content.
- Preview Description – Displays the description of the website content.
- Preview Media(Video) – Enables display of video links from the website content.
- Preview Media(Image) – Enables display of image links from the website content.