Web request
The Web Request block is a fundamental component to connect the BOT with 3rd party applications via HTTP/HTTPS requests.
Web Request action supports many HTTP methods and allows to invoke REST APIs, sending and receiving data in text and JSON formats. You can use the flow attributes as data, put them in the JSON payload or in the headers. You can also assign data coming from your API requests back to flow attributes, in both text and JSON format.
Let's take a look at the Web Request anatomy:
The Web Request, when invoked, automatically executes the HTTP request using the settings that you see in the picture above. The result is automatically assigned to the “result” attribute (you can remove all the response attributes and rename them as you prefer).
The other important part of Web Request is the Body section. Here you setup the content to send to your API endpoint. Remember to always set the proper "Content-type" header based on the body content format.
It is always possible to use flow attributes within the request fields:
You can get back your data in text or JSON format. These two are, at the moment, the only supported formats available. The data type is automatically decoded depending on the response content-type.
In case of JSON content type, you access JSON response fields by using the “.” notation (e.g., myJSONUser.firstName or myJSONUser.lastName).