The HTTP request integration allows you to send arbitrary HTTP requests to third-party servers. This allows you to integrate Smartbot with your website, CRM or online store.
Please note that in order to submit requests to any site, you must verify that you are the owner of the site. The easiest way: write to Smartbot Pro technical support.
To set up an http request, let's create an appropriate block on the script screen. This can be done through the right additional menu ("integration" section), or by right-clicking on a free area.
The new block will appear on the screen, and its menu will automatically open on the right.
If you are integrating with an existing service, then you can find all the necessary information to configure this step in the official API documentation for this service, or contact the developers of your site.
A brief reference on the step fields:
- Request type (http method): GET/POST/...
- URL address: the page (endpoint) that Smartbot should access, you can immediately specify query query parameters, for example: https://some.site/some_endpoint?key1=value1&key2=value2
- Request body: payload, can be given in three different formats:
- Form: the body of the request is a form (list of key-value pairs), the request will be sent with a header Content-Type: application/x-www-form-urlencoded (unless this header is explicitly set differently)
- JSON: The request body is a JSON document. The request will be sent with the header Content-Type: application/json (unless this header is explicitly set differently)
- Text: data is sent as-is, no additional headers are added
- Headers: additional information, such as authorization data: Authorization: Bearer [token]
Below, after setting the request parameters, variables are set in which the server response will be saved:
- Response Body: The data sent by the server in response. If Content-Type is application/json, then the type of this variable will be Dictionary, otherwise String
- Response status: number, such as 200, 400, or 500 you can check the response status to see if the request completed successfully
- Response headers: the server can also send some additional information in the form of headers, they will be stored in a Dictionary type variable
By default, all this data is stored in temporary variables: %body%, %status% and %headers% respectively.