HTTP Request (http_request)
The http_request function sends HTTP requests to external APIs and services. It's the foundational block for integrations — CRM, databases, and other connections are built on top of it.
Parameters
| Parameter | Description | Required |
|---|---|---|
url |
API endpoint address | Yes |
method |
HTTP method (GET, POST) | No (default: GET) |
headers |
Request headers (JSON) | No |
body |
Request body (JSON, POST only) | No |
save_as |
Variable name to store the response | No |
Examples
GET Request
Fetching data from an external API:
url: https://api.example.com/users/123
method: GET
save_as: user_data
After execution, the result is available as {=user_data=}.
POST Request
Sending data:
url: https://api.example.com/orders
method: POST
headers: {"Content-Type": "application/json", "Authorization": "Bearer {=api_token=}"}
body: {"name": "{=tgData.from.first_name=}", "message": "{=message=}"}
save_as: order_result
Using Variables
Variables can be used in the URL, headers, and body:
url: https://api.example.com/users/{=tgData.from.id=}
headers: {"Authorization": "Bearer {=token=}"}
Working with Responses
The response is saved to the specified variable. If the response is JSON, access nested fields with dot notation:
{=user_data.name=}
{=user_data.email=}
{=order_result.status=}
Integrations Built on HTTP Request
Pre-configured integrations are available for popular services: