Webhook
Webhook is a method utilized by applications to supply real-time information to other apps. Such a process usually delivers data immediately as and when it occurs. Webhook Trigger enables users to receive callouts whenever a service provides the option of distributing signals to a user-defined URL.
Categories: Helpers
Type: webhook/v1
Actions
Response to Webhook Request
Name: responseToWebhookRequest
Converts the response to the webhook request.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| responseType | Response Type | STRING OptionsJSON, RAW, BINARY, REDIRECT, NO_DATA | The type of the response. | false |
| headers | Headers | OBJECT Properties{} | The headers of the response. | false |
| body | Body | OBJECT Properties{} | The body of the response. | true |
| body | Body | STRING | The body of the response. | true |
| body | Redirect URL | STRING | The redirect URL. | true |
| body | Body | FILE_ENTRY | The body of the response. | true |
| statusCode | Status Code | INTEGER | The status code of the response. | false |
Example JSON Structure
{
"label" : "Response to Webhook Request",
"name" : "responseToWebhookRequest",
"parameters" : {
"responseType" : "",
"headers" : { },
"body" : {
"extension" : "",
"mimeType" : "",
"name" : "",
"url" : ""
},
"statusCode" : 1
},
"type" : "webhook/v1/responseToWebhookRequest"
}Output
The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.
What the Caller Receives
This action sets the HTTP response for the Await Workflow and Respond trigger. With the other Webhook triggers, ByteChef sends the response before the workflow runs, so this action has no effect on the response.
ByteChef sends the response when the workflow run is complete. The table shows the response for each Response Type. For all types except Redirect, the Headers that you configure are added to the response.
| Response Type | Status | Content-Type | Body |
|---|---|---|---|
| JSON | Status Code (default 200) | application/json | The Body object as JSON. If the body contains a file, the file is replaced with a URL that downloads it. |
| Raw | Status Code (default 200) | text/plain | The Body text. |
| Binary | Status Code (default 200) | The MIME type of the file, or application/octet-stream if it is unknown | The content of the file. |
| Redirect | 302 Found | None | Empty. The Location header contains the Redirect URL. |
| No Data | Status Code (default 200) | None | Empty. |
Notes for Postman and Bruno
- Binary: Postman and Bruno show images and PDFs as a preview. To save the file, use Save response to file in Postman, or the save option in the Bruno response pane.
- Redirect: Postman and Bruno follow redirects automatically. To see the
302 Foundresponse and itsLocationheader, turn off redirect following in the settings of the request. - Redirect: The Redirect URL must be a relative path, such as
/thank-you, or a URL on the same host as ByteChef. For other URLs, ByteChef returns400 Bad Requestwith the bodyInvalid redirect URL. - Status Code: The Redirect type always uses
302 Found. The Status Code property has no effect.
Example
A Response to Webhook Request step with these settings:
- Response Type: Raw
- Status Code:
202 - Headers:
X-Request-Source=bytechef - Body:
Order received
returns this response:
HTTP/1.1 202 Accepted
Content-Type: text/plain
X-Request-Source: bytechef
Order receivedTriggers
Auto Respond
Name: autoRespondWithHTTP200
The webhook trigger replies immediately to any incoming webhook request and then runs the workflow. By default the reply is an empty HTTP 200 response; it can also be a redirect, JSON, raw text or no data. The request is not validated.
Type: STATIC_WEBHOOK
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| responseType | Response Type | STRING OptionsDEFAULT, REDIRECT, JSON, RAW, NO_DATA | The response sent to the caller right away, before the workflow runs. Default sends an empty HTTP 200 response. | false |
| redirectUrl | Redirect URL | STRING | The http or https URL the caller is redirected to, on any host. It can use workflow inputs, but not the incoming request. | true |
| body | Body | OBJECT Properties{} | The JSON body of the response. | true |
| body | Body | STRING | The body of the response. Set a Content-Type header to send HTML. | true |
| headers | Headers | OBJECT Properties{} | The headers of the response. Location and Set-Cookie are not allowed. | false |
| statusCode | Status Code | INTEGER | The status code of the response. Redirect status codes (3xx) are not allowed. | false |
Output
{
"headers" : { },
"method" : "POST",
"parameters" : { },
"body" : { }
}JSON Example
{
"label" : "Auto Respond",
"name" : "autoRespondWithHTTP200",
"parameters" : {
"responseType" : "",
"redirectUrl" : "",
"body" : "",
"headers" : { },
"statusCode" : 1
},
"type" : "webhook/v1/autoRespondWithHTTP200"
}Webhook Trigger Execution Modes
Use the static workflow webhook trigger URL for this trigger type. This URL becomes available only after the workflow is published and deployed. Any request sent to this endpoint immediately receives a response, by default an empty HTTP 200 OK, and the workflow is triggered without validating the incoming request. See Respond Immediately to send a redirect or another response.
Respond Immediately
Use the Response Type property to choose what the caller gets right away. The workflow starts after ByteChef has built and checked the response.
| Response Type | Response |
|---|---|
| Default | Empty 200 OK. |
| Redirect | 302 Found to the Redirect URL. The URL must be an http or https address, on any host, or a relative path. |
| JSON | The Body as JSON, with the Headers and Status Code you set. |
| Raw | The Body as text. Add a Content-Type header, such as text/html, to send another format. A page sent with your own Content-Type runs in a browser sandbox: its scripts and forms don't run. |
| No Data | An empty body with the Headers and Status Code you set. |
The response is built only from the trigger properties and the workflow inputs, never from the incoming request. For example, set Redirect URL to ${contactPageUrl} to send each customer to their own page. A JSON, Raw or No Data response needs a Status Code from 100 to 599, and can't use a 3xx status code or a Location, Refresh or Set-Cookie header. Use Redirect to send the caller to another page.
If the response can't be built, for example because the Redirect URL uses a workflow input that has no value, the caller gets 500 Internal Server Error and the workflow does not run.
A HEAD request gets an empty 200 OK and does not start the workflow. The test URL in the workflow editor always answers with an empty 200 OK.
Example: a "Rate this ticket" link in an email points to <static workflow webhook trigger URL>?ticket=123&rating=4. With Response Type set to Redirect and Redirect URL set to https://www.example.com/thank-you, the customer lands on the thank-you page at once, and the workflow reads ticket and rating from parameters in the trigger output.
Testing with Postman or Bruno
For the URLs, body formats and trigger output, see Testing Webhooks with Postman or Bruno.
Request
| Setting | Value |
|---|---|
| Method | POST or GET |
| URL | The static workflow webhook trigger URL |
| Required headers | None. Add Content-Type if you send a body. |
| Body | Optional. Use any format. |
Response
ByteChef sends the response before the workflow runs. The response does not show the result of the workflow.
| Situation | Status | Body |
|---|---|---|
| The request is received | 200 OK, or the configured response | Empty, or the configured response. The workflow starts. |
| The configured response can't be built | 500 Internal Server Error | Empty. The workflow does not run. |
The request uses HEAD | 200 OK | Empty. The workflow does not run. |
| The workflow is disabled | 410 Gone | {"detail": "Workflow is disabled."}. The workflow does not run. |
| A step of the workflow fails | The response above | The response was sent before the step ran. |
A 200 OK response does not confirm that the workflow ran. To see the result, open Executions in ByteChef.
Validate and Respond
Name: validateAndRespond
Upon receiving a webhook request, it goes through a validation process. Once validated, the webhook trigger responds to the sender with an appropriate HTTP status code.
Type: STATIC_WEBHOOK
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| csrfToken | CSRF Token | STRING | If set, the X-Csrf-Token HTTP header value passed by the client must match this token. Leave empty to accept requests without the header. | false |
| responseType | Response Type | STRING OptionsDEFAULT, REDIRECT, JSON, RAW, NO_DATA | The response sent to the caller right away, before the workflow runs. Default sends an empty HTTP 200 response. | false |
| redirectUrl | Redirect URL | STRING | The http or https URL the caller is redirected to, on any host. It can use workflow inputs, but not the incoming request. | true |
| body | Body | OBJECT Properties{} | The JSON body of the response. | true |
| body | Body | STRING | The body of the response. Set a Content-Type header to send HTML. | true |
| headers | Headers | OBJECT Properties{} | The headers of the response. Location and Set-Cookie are not allowed. | false |
| statusCode | Status Code | INTEGER | The status code of the response. Redirect status codes (3xx) are not allowed. | false |
Output
{
"headers" : { },
"method" : "POST",
"parameters" : { },
"body" : { }
}JSON Example
{
"label" : "Validate and Respond",
"name" : "validateAndRespond",
"parameters" : {
"csrfToken" : "",
"responseType" : "",
"redirectUrl" : "",
"body" : "",
"headers" : { },
"statusCode" : 1
},
"type" : "webhook/v1/validateAndRespond"
}Webhook Trigger Execution Modes
Use the Static workflow webhook trigger URL for this trigger type. This URL becomes available only after the workflow is published and deployed. If the CSRF Token property is set, incoming requests are first validated by checking the token sent in the X-Csrf-Token HTTP header. If the property is empty, every request is accepted. If validation succeeds, the workflow is executed and the sender receives an HTTP 200 OK response, or the response set with the Response Type property. It works the same way as in Auto Respond.
Testing with Postman or Bruno
For the URLs, body formats and trigger output, see Testing Webhooks with Postman or Bruno.
Request
| Setting | Value |
|---|---|
| Method | POST or GET |
| URL | The static workflow webhook trigger URL |
| Headers | X-Csrf-Token: the value of the CSRF Token property. Required only when the property is set. Add Content-Type if you send a body. |
| Body | Optional. Use any format. |
Response
ByteChef checks the token, then sends the response. The workflow runs after the response is sent, so the response does not show the result of the workflow.
| Situation | Status | Body |
|---|---|---|
| The token is correct, or the CSRF Token property is empty | 200 OK, or the configured response | Empty, or the configured response. The workflow starts. |
| The token is correct or not required, but the configured response can't be built | 500 Internal Server Error | Empty. The workflow does not run. |
The CSRF Token property is set, and the X-Csrf-Token header is missing or its value is incorrect | 400 Bad Request | Empty. The workflow does not run. |
| The workflow is disabled | 410 Gone | {"detail": "Workflow is disabled."}. The token is not checked and the workflow does not run. |
| A step of the workflow fails | The response above | The response was sent before the step ran. |
If you get 400 Bad Request, make sure that:
- The request has an
X-Csrf-Tokenheader. - The value is the same as the CSRF Token property, including uppercase and lowercase letters, with no extra spaces.
- The deployed version of the workflow has the token that you send. If you change the token in the editor, publish and deploy the workflow again.
The test URL checks the token in the same way when the property is set. A request with a missing or incorrect token returns 400 Bad Request and is not recorded as sample output.
Await Workflow and Respond
Name: awaitWorkflowAndRespond
You have the flexibility to set up your preferred response. After a webhook request is received, the webhook trigger enters a waiting state for the workflow's response.
Type: STATIC_WEBHOOK
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| csrfToken | CSRF Token | STRING | If set, the X-Csrf-Token HTTP header value passed by the client must match this token. Leave empty to accept requests without the header. | false |
| timeout | Timeout (ms) | INTEGER | The incoming request will time out after the specified number of milliseconds. The max wait time before a timeout is 5 minutes. | false |
Output
{
"headers" : { },
"method" : "POST",
"parameters" : { },
"body" : { }
}JSON Example
{
"label" : "Await Workflow and Respond",
"name" : "awaitWorkflowAndRespond",
"parameters" : {
"csrfToken" : "",
"timeout" : 1
},
"type" : "webhook/v1/awaitWorkflowAndRespond"
}Webhook Trigger Execution Modes
Use the Static workflow webhook trigger URL for this trigger type. This URL becomes available only after the workflow is published and deployed. If the CSRF Token property is set, incoming requests are first validated by checking the token sent in the X-Csrf-Token HTTP header. If the property is empty, every request is accepted. After successful validation, the workflow starts executing, and the HTTP response is sent when the workflow run is complete. Add the Webhook/Response to Webhook Request action to the workflow to define the exact response body, status code and headers returned to the sender.
Testing with Postman or Bruno
For the URLs, body formats and trigger output, see Testing Webhooks with Postman or Bruno.
Request
| Setting | Value |
|---|---|
| Method | POST or GET |
| URL | The static workflow webhook trigger URL |
| Headers | X-Csrf-Token: the value of the CSRF Token property. Required only when the property is set. Add Content-Type if you send a body. |
| Body | Optional. Use any format. |
Response
The HTTP connection stays open while the workflow runs. ByteChef sends the response when all steps of the workflow are complete, not when the Response to Webhook Request step runs. Steps after Response to Webhook Request also make the response wait. ByteChef waits at most the Timeout (ms) value, or 5 minutes if it is empty. Values longer than 5 minutes are reduced to 5 minutes.
| Situation | Status | Body |
|---|---|---|
| The workflow runs a Response to Webhook Request step | The Status Code of that step | The body and headers of that step. See Response to Webhook Request. |
| The workflow has no Response to Webhook Request step | 200 OK | The outputs of the workflow as JSON. If the workflow has no outputs, the body is empty. |
The CSRF Token property is set, and the X-Csrf-Token header is missing or its value is incorrect | 400 Bad Request | Empty. The workflow does not run. |
| A step of the workflow fails | 500 Internal Server Error | A JSON error object. The detail field contains the error message of the step that failed. |
| The workflow is disabled | 410 Gone | {"detail": "Workflow is disabled."} |
If the workflow runs more than one Response to Webhook Request step, for example in different branches, the last step that runs sets the response.
The test URL checks the token in the same way when the property is set: a missing or incorrect token returns 400 Bad Request. It does not wait for the workflow and does not apply Response to Webhook Request, so a request with a correct token returns 200 OK with an empty body. To test the response, use the static workflow webhook trigger URL.
Example
Configure the trigger with the CSRF Token my-secret-token. Add a Response to Webhook Request step with Response Type set to JSON, Status Code set to 201, and this Body:
{
"received": "${trigger_1.body.orderId}",
"status": "accepted"
}Send this request:
curl -i -X POST "https://<your-bytechef-host>/webhooks/<id>" \
-H "Content-Type: application/json" \
-H "X-Csrf-Token: my-secret-token" \
-d '{"orderId": 1001}'The response is:
HTTP/1.1 201 Created
Content-Type: application/json
{"received":1001,"status":"accepted"}Additional Instructions
Testing Webhooks with Postman or Bruno
Each Webhook trigger listens on a URL. You can use any HTTP client, such as Postman, Bruno or curl, to send a request to it. This section describes what to send. See the section for each trigger above for the response that you get.
Which URL to Use
| URL | Where to find it | What it does |
|---|---|---|
| Webhook test URL | In the workflow editor, open the trigger, go to the Output tab and click Test. The URL is shown under Action Required. | Records the request as the sample output of the trigger. The workflow does not run. If the trigger has a CSRF Token, the token is checked: a missing or incorrect token returns 400 Bad Request and the request is not recorded. Otherwise, the response is 200 OK with an empty body. |
| Static workflow webhook trigger URL | After you publish and deploy the workflow, go to Projects, expand the project, select its Deployments tab (outside the Development environment, go to Project Deployments), find the workflow and click the Copy static workflow webhook trigger url icon. | Runs the deployed workflow. The response depends on the trigger type. |
The production URL has the form https://<your-bytechef-host>/webhooks/<id>. The test URL has the form https://<your-bytechef-host>/webhooks/<id>/test/environments/<environmentId>. Always copy the URL from ByteChef. Do not build it manually.
The test URL records a request only while the trigger waits for test data (after you click Test, before you click Cancel). Use the test URL first, so that the next steps of the workflow can use the fields of your sample request.
HTTP Methods
| Method | Result |
|---|---|
POST | Runs the trigger. Use this method for requests that have a body. |
GET | Runs the trigger. The query string parameters are available in parameters. |
HEAD | Does not run the workflow. Returns 200 OK, except when the workflow is disabled and uses the Await Workflow and Respond trigger: then it returns 410 Gone. |
PUT, PATCH, DELETE | Not supported. The server returns 405 Method Not Allowed. |
Headers
- Content-Type: Tells ByteChef how to read the body. Postman and Bruno set it automatically when you select a body type.
- X-Csrf-Token: Required for the Validate and Respond trigger and the Await Workflow and Respond trigger when their CSRF Token property is set. If the property is empty, the header is not checked. The value must be the same as the value in the CSRF Token property of the trigger. The value is case-sensitive. The header name is not.
- All other headers are sent to the workflow in the
headersoutput.
Body Formats
The Content-Type header controls how ByteChef reads the body:
| Postman / Bruno body type | Content-Type | Value of body in the trigger output |
|---|---|---|
| raw → JSON / JSON | application/json | The parsed JSON object or array. |
| raw → XML / XML | application/xml | The parsed XML, as an object. |
| x-www-form-urlencoded / Form URL Encoded | application/x-www-form-urlencoded | An object with one key for each form field. Numbers and booleans are converted from text. Keys such as customer[name] or customer.name become nested objects. |
| form-data / Multipart Form | multipart/form-data | An object with one key for each form field. File fields become file objects that the next steps can use. |
| binary / File | application/pdf, application/octet-stream, other application/* | A file object that contains the uploaded content. |
| raw → Text / Text | text/plain, other text/* | The body as a string. |
| none / No Body | (none) | body is not included. |
An empty JSON or XML body is treated as no body, so body is not included. A JSON or XML body that cannot be parsed returns 400 Bad Request, and the detail field of the response describes the error.
Trigger Output
All three triggers give the same output to the next steps of the workflow:
{
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-Csrf-Token": "my-secret-token"
},
"parameters": {
"source": "postman"
},
"body": {
"orderId": 1001,
"status": "paid"
}
}method: The HTTP method of the request.headers: The request headers, with the names spelled as the client sent them. A header with one value is a string. A header with more than one value is a list.parameters: The query string parameters. A parameter with one value is a string. A parameter with more than one value is a list.body: The request body, in the format that the table above shows.
In the next steps, refer to these fields with expressions such as ${trigger_1.body.orderId} or ${trigger_1.parameters.source}.
Example Request
Configure Postman or Bruno as follows:
- Set the method to
POST. - Paste the webhook URL from ByteChef. To add query parameters, append them, for example
?source=postman. - On the Headers tab, add
X-Csrf-Tokenif the trigger requires it. - On the Body tab, select raw → JSON in Postman or JSON in Bruno, and enter the body:
{
"orderId": 1001,
"status": "paid"
}- Click Send.
The same request with curl:
curl -i -X POST "https://<your-bytechef-host>/webhooks/<id>?source=postman" \
-H "Content-Type: application/json" \
-H "X-Csrf-Token: my-secret-token" \
-d '{"orderId": 1001, "status": "paid"}'The -i option shows the response status and headers. Use it to compare the response with the tables for each trigger.
How is this guide?
Last updated on
Webflow
Webflow is a web design and development platform that allows users to build responsive websites visually without writing code.
WhatsApp is a free-to-use messaging app offering end-to-end encrypted chat, voice, and video communication, along with document and media sharing, available on multiple platforms.