Triggers


Overview


A trigger helps you to integrate chat bot with different services through REST API's. Trigger support various HTTP parameters which helps you to build the appropriate request headers and body. Trigger also provides to capture HTTP status, parse the same, add validation logic and parse the response through a simple UI interface. Trigger supports both JSON and XML response formats. Triggers can easily be integrated with your conversation.

Example:
If you have designed a chat bot to support vehicle insurance. You could then collect the required information from the end user, send it to your REST API to compute the premium and show the premium back to end user. End user then can confirm and initiate the payment for the selected insurance.

Create New Trigger


Trigger is accessible from Bot Studio -> My Conversations -> Trigger tab. Here user can create, modify and delete triggers.

Click on "Add New Trigger" button to launch the Create New Trigger dialog.

Trigger Name


Trigger name should be easy to identify and reuse while creating other conversation. Trigger name could be combination of Service you are trying to access coupled with purpose of the REST API.

Example:

  • PaymentService-RegMobileNumber
  • PaymentService-OTPAuth
  • PaymentService-ProcessPayment
  • InsuranceCompany-MotorInsurace-CalculatePreminum
  • InsuranceCompany-MotorInsurace-SendSoftCopy

Trigger Description


Enter a short description regarding the trigger.

Method Type


GET, POST, PUT, PATCH, DELETE methods are supported

Response Type


XML and JSON response types are supported

API/Service URL/URI


Enter the complete path of API/Service URL/URI that you want this trigger to consume.

Header


Header is a set of Key / Value pairs that you can use to add the required HTTP headers. Currently headers only support string values.

Example:

  • Key: Content-Type
  • Value: text/xml

Body


Example:
You can use input parameters {{DateOfPurchase}} from the conversation in request body that holds value for the Registration Date taken from the user.

Status


Status tab would be used to compare the status information inside the response body. So if we have keys which determine if the operation has succeeded. Then we can add those Key-Value pairs to do the comparison. The values out here are the hardcoded string values which would be used for comparison.

Example:

  • Key: QuoteResponse.StatusMessage
  • Value: Success

Status Fail Message Key


If the status validation fails, then the failure message key value would be printed in the chat bot interface.
Example: QuoteResponse.StatusMessage key has been provided to indicate the status message returned by the trigger, which would be used if the validation under the "STATUS" tab fails.

Validation


Inside the validation tab add all the key-value pairs. Keys are to be mapped to the output keys of the response payload and Values are to be mapped to the Mapping key variables from the conversations. Minimum Validation, indicates what is the minimum validation that you would like the system to carry out to determine if the validation has succeeded. So if you have a case where you want any 2 values to be validated out of 3 output keys, then you can add validation for all the 3 output keys and set the minimum validation to 2.

Example:
If you would like to validate the Insured Name in the response then

  • Output Key: QuoteResponse.MotorDetails.MotorOutputResponse.InsuredFullName
  • Value: InsuredFullName (This is the variable name from the conversation which holds the value for the insured full name)

Response Keys


Response keys, help you to store and consume the value of different keys from response payload. Here you will add multiple key-value pairs of Output keys (Keys traverse path from the output response) with Mapping keys (Variable name under which the values would be stored and consumed within a conversation).

Searching and Sorting Trigger


Enter the name of the trigger in the Search field and click on the search icon.

Sort Trigger


Triggers can be sorted by different attributes like Date, Name, Last used etc.

Option Description
Name Trigger are sorted by name in descending order
Date Trigger are sorted by date in descending order
Name (Ascending) Trigger are sorted by name in ascending order
Date (Ascending) Trigger are sorted by date in ascending order
Last Used Trigger are sorted by the last usage of the trigger in any conversations

Modify Trigger


Trigger can be deleted by clicking on the delete button in front of the trigger name

Delete Trigger


Intent can be deleted by clicking on the Trigger name or by clicking on the delete button in front of the trigger name

Warning: User is able to delete a trigger only if it is not getting consumed by any conversation. To delete a trigger, user must remove it from the conversations where it is being used and then perform the delete action.