Service Call
Last updated
Last updated
REST APIs are used to Push / Pull data to / from third party systems. Using the Service Call action block, you can directly integrate a third-party system's REST API in a flow.
You can integrate GET, POST or PUT type REST API through Service Call action block from the Bot Builder page.
Here are the steps that you can follow to configure the same:
Add the ‘Service Call’ action block.
Configure your API on the right panel. To configure your API on the Service Call action block, below are the fields that you would be filling values in. If you are a developer, you would feel at home here, for others, you may need to refer to the APIs documentation to find what to fill on the right panel.
Types of Methods: You will first need to select the 'Type of Method' from the drop-down list from the available options. Reply CX currently supports three types of methods, they are:
GET
POST
PUT
Endpoint URL: You will need to provide the absolute URL i.e., starting with HTTP or HTTPS. You can also use the variables in the URL by typing '#' as some of the APIs do not have headers and everything is mentioned in the URL itself.
Headers: 'Request Headers' allows you to authenticate the API based on its tokens. You can also use variables as tokens too by typing '#'. You need to ensure that you add following token in the header:
Body: Under ‘Request Body’ you can define what information needs to be sent or retrieved by calling the API. There are two ways through which the information can be sent or retrieved:
Raw: It is normal JSON format in which the request needs to be passed.
Form: Used to map the fields. You can either provide static value or map with the variables.
Response: You can further store the responses received from the API into the variables which can be further used in the bot flow or bot message. ReplyCX follows the dot pattern to store the responses into the variables. Below are a few of the ways in which the path can be defined.
You can test the API within the block itself as well as define variables and store the responses in them.
Click on 'Test the API' button.
Provide the input in the variable (optional).
Click on ‘Test the API’ again to check the results.
Click on 'Expand Icon' to expand the results.
Click on ‘+’ sign against the field to store the value into the variable.
Define the variable in 'Save the field in this variable'.