Network¶
HTTP Request¶
Sends one HTTP request per item. Output: statusCode, headers, body.
Inputs: main · Outputs: main
| Parameter | Type | Description |
|---|---|---|
Methodmethod |
text | What the request does. |
URL (required)url |
text | Address of the request, e.g. https://api.example.com/orders/{{ $json.id }}. Supports expressions. |
CredentialcredentialId |
credential (Basic Auth, Bearer Token, API Key Header, OAuth2 Client Credentials) | Signs in at the server: user and password, a token, an API key header or OAuth2 client credentials. |
Query parametersquery |
key/value pairs | Added to the URL as ?name=value, e.g. status → open; values are encoded. |
Bodybody |
JSON | What to send: JSON such as { "name": "{{ $json.name }}" }, or text. Only when Method is post or put or patch or delete. Supports expressions. |
Content typecontentType |
text | Kind of the body, e.g. application/json or text/plain. Only when Method is post or put or patch or delete. In Advanced. Supports expressions. |
Headersheaders |
key/value pairs | Request headers, e.g. Accept → application/json. In Advanced. |
Response formatresponseFormat |
one of: auto, json, text |
How the answer is read into body. auto: JSON when the server says so, text otherwise.json: Read the answer as JSON.text: Keep the answer as text, e.g. HTML or CSV.In Advanced. Default: auto. |
Fail on HTTP error statusfailOnHttpError |
true/false | Stop with an error when the server answers 400 or higher; off: the item goes on with the statusCode. In Advanced. Default: true. |
Pause between requests (ms)delayMs |
integer | Waits this long before each request but the first, e.g. 1000 for the rate limit of an API; 0 = no pause. In Advanced. Default: 0. |
Example: Read an order from an API
One request per item; the answer replaces the item: statusCode, headers and body.
Parameters:
{
"method": "GET",
"url": "https://api.example.com/orders/{{ $json.id }}"
}
Input:
[
{
"id": 17
}
]
Output:
[
{
"statusCode": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"id": 17,
"customer": "Anna",
"status": "paid"
}
}
]
Example: Send an item as JSON
POST with a body built from the item, e.g. to create a ticket in another system.
Parameters:
{
"method": "POST",
"url": "https://api.example.com/tickets",
"body": {
"title": "{{ $json.subject }}",
"priority": "high"
}
}
Input:
[
{
"subject": "Parcel never arrived"
}
]
Output:
[
{
"statusCode": 201,
"headers": {
"Content-Type": "application/json; charset=utf-8",
"Location": "/tickets/981"
},
"body": {
"id": 981,
"title": "Parcel never arrived",
"priority": "high"
}
}
]
Respond to Webhook¶
Answers the webhook call that started the execution (Webhook Trigger with 'Using respond node'). The items pass through, so the workflow can continue after responding.
Inputs: main · Outputs: main
| Parameter | Type | Description |
|---|---|---|
Respond withrespondWith |
one of: firstItem, allItems, customBody, noBody |
What the caller gets back. firstItem: The JSON of the first item.allItems: A list with the JSON of all items.customBody: The body below, e.g. { "ok": true }.noBody: Only the status code, no content.Default: firstItem. |
Bodybody |
JSON | JSON or an expression, evaluated for the first item, e.g. {{ { ok: true, id: $json.id } }}. Only when Respond with is customBody. Supports expressions. |
Status codestatusCode |
integer | HTTP status of the answer, e.g. 200 OK, 201 Created, 400 Bad Request. Default: 200. |
Headersheaders |
key/value pairs | Response headers; a Content-Type other than JSON sends a text body as is, e.g. text/html. In Advanced. |
Example: Confirm an order to the caller
The webhook caller gets { "ok": true, "id": 17 } with status 201. The items pass on, so the workflow can go on after answering.
Parameters:
{
"respondWith": "customBody",
"body": "{{ { ok: true, id: $json.id } }}",
"statusCode": 201
}
Input:
[
{
"id": 17,
"customer": "Anna"
}
]
Output:
[
{
"id": 17,
"customer": "Anna"
}
]
Send Email¶
Sends one email per item over SMTP, optionally with the item's attachments.
Inputs: main · Outputs: main
| Parameter | Type | Description |
|---|---|---|
SMTP credential (required)credentialId |
credential (SMTP) | The SMTP server and login used to send the mail. |
Fromfrom |
text | Sender, e.g. Orders <orders@example.com>; empty: the sender of the credential. In Advanced. Supports expressions. |
To (required)to |
text | Recipients, separated by commas, e.g. {{ $json.email }}. Supports expressions. |
Cccc |
text | Copy to these addresses, separated by commas. In Advanced. Supports expressions. |
Bccbcc |
text | Hidden copy to these addresses, separated by commas. In Advanced. Supports expressions. |
Subject (required)subject |
text | e.g. Your order {{ $json.id }}. Supports expressions. |
Texttext |
text | The message as plain text. Supports expressions. |
HTMLhtml |
text | The message as HTML, sent next to the text or alone. In Advanced. Supports expressions. |
Attachmentsattachments |
list of text | Names of the item's attachments to send, e.g. data; * sends all. |
Example: A confirmation per order, with the invoice attached
One mail per item. The item goes on with sentEmail, e.g. to log or store the message id.
Parameters:
{
"to": "{{ $json.email }}",
"subject": "Your order {{ $json.id }}",
"text": "Hello {{ $json.customer }},\nthank you for your order. The invoice is attached.",
"attachments": [
"data"
]
}
Input:
[
{
"id": 17,
"customer": "Anna",
"email": "anna@example.com",
"$binary": {
"data": {
"fileName": "invoice-17.pdf",
"mimeType": "application/pdf"
}
}
}
]
Output:
[
{
"id": 17,
"customer": "Anna",
"email": "anna@example.com",
"sentEmail": {
"messageId": "<a1b2c3@pipe>",
"to": "anna@example.com",
"subject": "Your order 17"
},
"$binary": {
"data": {
"fileName": "invoice-17.pdf",
"mimeType": "application/pdf"
}
}
}
]