Trigger Webhook

Trigger Webhook

Certified

Trigger a Flow via an authenticated webhook URL.

Exposes an endpoint .../executions/webhook/{Namespace}/{flowId}/{key} that accepts GET/POST/PUT to start a Flow without signing in. The required key is its only protection: store it as a secret and reference it with {{ secret('...') }}.

Request data is available as trigger.body, trigger.headers, and trigger.parameters. It is untrusted input: pass it to script tasks through env, never inside commands, beforeCommands, script, or interpreter, where it would be run as code. A binary body is base64-encoded on trigger.body, unless fetchType is set to STORE to stream it into Kestra's internal storage and expose it as trigger.uri instead. A multipart/form-data body is available as trigger.parts (files, always stored in Kestra's internal storage) and trigger.formFields. Supports wait/returnOutputs to block and return Flow outputs, and configurable response status, headers, body, and content type. Conditions are allowed except MultipleCondition.

Responses: 401 (invalid signature), 404 (not found), 200 (triggered), 204 (conditions not met), 422 (inputs could not be rendered).

yaml
type: io.kestra.plugin.core.trigger.Webhook

Verify a GitHub-style webhook signature before starting the flow.

yaml
id: signed_webhook
namespace: company.team

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Received a verified webhook"

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: "{{ secret('WEBHOOK_KEY') }}"
    signature:
      header: X-Hub-Signature-256
      algorithm: HMAC_SHA256
      secret: "{{ secret('GITHUB_WEBHOOK_SECRET') }}"
      prefix: "sha256="

Add a webhook trigger to the current flow with its key read from the WEBHOOK_KEY secret; the webhook will be available at the URI /api/v1/{tenant}/executions/webhook/{namespace}/{flowId}/{key}, where {key} is the value of that secret.

yaml
id: webhook_flow
namespace: company.team

tasks:
  - id: log_hello_world
    type: io.kestra.plugin.core.log.Log
    message: Hello World! 🚀

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: "{{ secret('WEBHOOK_KEY') }}"

Add a trigger matching specific webhook event condition. The flow will be executed only if the condition is met.

yaml
id: condition_based_webhook_flow
namespace: company.team

tasks:
  - id: log_hello_world
    type: io.kestra.plugin.core.log.Log
    message: Hello World! 🚀

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: "{{ secret('WEBHOOK_KEY') }}"
    when: "{{ trigger.body.hello == 'world' }}"

Webhook with text/plain response for Microsoft Graph validation handshakes. When a service like Microsoft Graph validates the webhook endpoint, it sends a validationToken that must be echoed back as plain text. responseBody returns it as soon as the execution is created, without waiting for the flow to finish.

yaml
id: microsoft_graph_webhook
namespace: company.team

tasks:
  - id: log_request
    type: io.kestra.plugin.core.log.Log
    message: "Microsoft Graph called the webhook"

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: "{{ secret('WEBHOOK_KEY') }}"
    responseContentType: "text/plain"
    responseBody: "{{ trigger.parameters.validationToken[0] ?? 'notification processed' }}"

Return a custom response for a Meta webhook verification request.

yaml
id: meta_webhook
namespace: company.team

tasks:
  - id: process_event
    type: io.kestra.plugin.core.log.Log
    message: "Received Meta webhook event"

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: 4wjtkzwVGBM9yKnjm3yv8r
    responseCode: 200
    responseHeaders:
      Content-Type: text/plain
    responseBody: "{{ trigger.parameters['hub.challenge'][0] ?? 'EVENT_RECEIVED' }}"

Receive a file uploaded as multipart/form-data. Each file part is available under trigger.parts, its content stored in Kestra's internal storage and reachable through its uri, and the parts that are not files under trigger.formFields.

yaml
id: upload_webhook
namespace: company.team

tasks:
  - id: log_upload
    type: io.kestra.plugin.core.log.Log
    message: "Received {{ trigger.parts[0].filename }} ({{ trigger.parts[0].size }} bytes, {{ trigger.parts[0].contentType }}), note: {{ trigger.formFields.note[0] }}"

  - id: measure_upload
    type: io.kestra.plugin.core.storage.Size
    uri: "{{ trigger.parts[0].uri }}"

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: "{{ secret('WEBHOOK_KEY') }}"

Receive a payload that is not a form - a large JSON export, or a binary file sent as the request body - without carrying it through the execution. fetchType: STORE streams the body into Kestra's internal storage and exposes its URI as trigger.uri instead of its content as trigger.body. Note that a condition on the trigger can no longer read the body.

yaml
id: stored_body_webhook
namespace: company.team

tasks:
  - id: measure_body
    type: io.kestra.plugin.core.storage.Size
    uri: "{{ trigger.uri }}"

triggers:
  - id: webhook
    type: io.kestra.plugin.core.trigger.Webhook
    key: "{{ secret('WEBHOOK_KEY') }}"
    fetchType: STORE
Properties
Min length1
Max length256

The unique key that will be part of the URL.

The key is used for generating the webhook URL.

::alert{type="warning"} Make sure to keep the webhook key secure. It protects your endpoint from bad actors and must be considered as a secret. You can use a random key generator to create the key. ::

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

DefaultFETCH
Possible Values
NONEFETCHSTORE

What the trigger does with the body of the webhook request.

  • FETCH: the body reaches the flow on the body output. A JSON body is deserialized, a binary one is base64-encoded. This is the default, and how a webhook has always behaved.
  • STORE: the body is streamed into Kestra's internal storage as it is received, and the flow reaches it through the uri output. Nothing of it travels through the execution, so this is the option to use for a large or binary payload - but note that a condition on the trigger can no longer read the body.
  • NONE: the body is read off the connection and dropped. Use it for a caller whose payload the flow does not need.

This only concerns the body of a request. The file parts of a multipart/form-data request are always stored in the internal storage and exposed on parts, whatever this property is set to, as a file part has no meaningful representation inside an execution.

The inputs to pass to the triggered flow

Custom response body.

Body returned to the webhook caller instead of the default execution metadata or flow outputs. The value can use expressions from the execution context. Set wait to true when an expression uses task or flow outputs. The body is sent to anyone who calls the webhook, so it should not contain secrets.

Custom response code.

If set, the webhook response code will use this response code instead of the default 200. Set wait to true when the expression uses task or flow outputs.

Possible Values
application/jsontext/plain

Custom response content type.

If set, the webhook response will use this content type instead of the default application/json. This is useful for webhook validation handshakes that require specific content types (e.g., Microsoft Graph Change Notifications require text/plain responses).

SubTypestring

Custom response headers.

Headers returned to the webhook caller. Values can use expressions from the execution context. Set wait to true when an expression uses task or flow outputs.

Defaultfalse

Send outputs of the flows as response for webhook caller.

Requires wait to be true.

Verify the HMAC signature of the raw request body.

When configured, missing or invalid hexadecimal signatures return 401 before an execution is created. Verification supports FETCH, STORE and NONE without buffering stored bodies. Signed multipart/form-data requests are rejected because their original bytes are unavailable after multipart parsing. This validates payload integrity, but does not prevent replay of a signed request.

Definitions
header*string

The request header containing the hexadecimal signature.

secret*string

The shared signing secret.

Use a secret expression such as {{ secret('GITHUB_WEBHOOK_SECRET') }}.

algorithmstring
DefaultHMAC_SHA256
Possible Values
HMAC_SHA1HMAC_SHA256HMAC_SHA512

The HMAC algorithm used by the sender.

prefixstring

The optional required prefix before the hexadecimal signature.

For GitHub SHA256 signatures, use sha256=.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Defaultfalse

Wait for the flow to finish.

If set to true the webhook call will wait for the flow to finish and return the flow outputs as response. If set to false the webhook call will return immediately after the execution is created.

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

The full body for the webhook request

We try to deserialize the incoming request as JSON (array or object). If we can't deserialize, the full body will be available as a string. A binary body - one whose content type is neither text, JSON, XML, form-urlencoded, YAML nor CSV - is base64-encoded, as base64 is how bytes travel through the text-based trigger variables. Use the content-type request header to tell a base64-encoded body apart from a plain text one. Only set for a trigger whose fetchType is FETCH, and not for a multipart/form-data request, which is available as parts and formFields.

SubTypearray

The headers for the webhook request

SubTypearray

The parameters for the webhook request

SubTypearray

The form fields of a multipart/form-data webhook request

Only set for a multipart/form-data request; holds the parts that are not files.

The file parts of a multipart/form-data webhook request

Only set for a multipart/form-data request. The content of each part is stored in Kestra's internal storage, and the part carries its URI.

Definitions
contentTypestring

The content type of the part

Not set if the caller did not send one for this part.

filenamestring

The name of the uploaded file

namestring

The form field name of the part

sizeinteger

The size of the part content in bytes

uristring

The URI of the part content in Kestra's internal storage

The content of the part is streamed to the internal storage as it is received, so that a file of any size reaches the flow intact and without travelling through the execution. It is stored under the execution the webhook call creates, and purged with it.

The URI of the body of the webhook request in Kestra's internal storage

Only set for a trigger whose fetchType is STORE. The body is streamed to the internal storage as it is received, so that a payload of any size reaches the flow intact and without travelling through the execution. It is stored under the execution the webhook call creates, and purged with it.