Respond to Webhook
Sets the HTTP response that the caller of a Webhook trigger receives: status code, headers and body. Use it to build small APIs, return a computed result, or answer a form submission.
It only has an effect when the Webhook trigger's Respond setting is Using a Respond to Webhook step (see Response modes). The caller's request stays open until this step runs, up to the trigger's Response timeout.
With a Form Trigger set to Show the workflow's answer, the person who sent the form sees
this step's body (text, or JSON with message / redirectUrl); a status of 400 or more shows it as a problem above
the form. See Show the workflow's answer. After a Form Trigger the step
shows on the canvas as Respond to form (same step, display only; a name you give it is shown instead).
Properties
| Property | Required | Default | Description |
|---|---|---|---|
| Status code | No | 200 | HTTP status, 100–599 |
| Content type | No | — | e.g. application/json, text/html, text/csv |
| Headers (JSON object) | No | — | Extra response headers as a JSON object, e.g. {"X-Request-Id": "abc"} |
| Body | No | — | The response body, in a multi-line field: Enter adds a line break, and line breaks are sent as typed. Supports expressions |
All fields support expressions.
How the body is sent
| Body | Sent as |
|---|---|
| An expression that returns an object or array | JSON (application/json unless you set another JSON content type) |
| Text, with a content type | The text, with that content type |
| Text, without a content type | text/plain — set Content type to application/json if your text is JSON |
| Empty | No body, just the status code |
With a JSON content type (application/json, application/problem+json, …) the body must be JSON. Data you insert
inside a JSON string is escaped for you, so quotes and line breaks in it keep the body valid. The editor warns when
the body isn’t valid JSON, and the step fails with The body isn’t valid JSON (line …, position …) instead of sending
a broken answer. To send text, set the content type to text/plain.
Content-Type, Content-Length, Transfer-Encoding and Connection can't be set through Headers; use
Content type for the content type.
Output
The step passes the response it built downstream, so the workflow can continue after responding:
{
"statusCode": 201,
"headers": { "Location": "/orders/42" },
"body": { "id": 42, "status": "created" },
"contentType": "application/json"
}
Example — a small JSON API
- Webhook trigger, method
POST, Respond: Using a Respond to Webhook step. - HTTP Request Create order calls your backend with
{{ $trigger.body }}. - Respond to Webhook:
- Status code:
201 - Content type:
application/json - Body:
{{ { id: $nodes['Create order'].responseBody.id, status: 'created' } }}
- Status code:
- Further steps (send email, update CRM) run after the caller already has the response.
curl -X POST https://api.blokkio.com/api/webhook/<token> \
-H "Content-Type: application/json" \
-d '{"sku": "A-1", "qty": 2}'
# HTTP/1.1 201 Created
# {"id":42,"status":"created"}
Notes
- The first Respond to Webhook step that completes answers the request. Later ones still run but can't change the response.
- If the run finishes without reaching a Respond to Webhook step, the caller gets
500. If the step isn't reached within the response timeout, the caller gets504and the run carries on. - In the other response modes (respond immediately, or with the last step's output) this step has no effect on the HTTP response.
- Invalid settings — a status outside 100–599, or headers that aren't a JSON object — fail the step.