Webhook Webhook

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

Trigger a flow from a webhook.

Webhook trigger allows you to create a unique URL that you can use to trigger a Kestra flow execution based on events in another application such as GitHub or Amazon EventBridge. In order to use that URL, you have to add a secret key that will secure your webhook URL.

The URL will then follow the following format: https://{your_hostname}/api/v1/executions/webhook/{namespace}/{flowId}/{key}. Replace the templated values according to your workflow setup.

The webhook URL accepts GET, POST and PUT requests.

You can access the request body and headers sent by another application using the following template variables:

  • {{ trigger.body }}
  • {{ trigger.headers }}.

The webhook response will be one of the following HTTP status codes:

  • 404 if the namespace, flow or webhook key is not found.
  • 200 if the webhook triggers an execution.
  • 204 if the webhook cannot trigger an execution due to a lack of matching event conditions sent by other application.

A webhook trigger can have conditions but it doesn't support conditions of type MultipleCondition.

Examples

Add a webhook trigger to the current flow with the key 4wjtkzwVGBM9yKnjm3yv8r, the webhook will be available at the URI /api/v1/executions/webhook/{namespace}/{flowId}/4wjtkzwVGBM9yKnjm3yv8r.

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: 4wjtkzwVGBM9yKnjm3yv8r

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: 4wjtkzwVGBM9yKnjm3yv8r
    conditions:
      - type: io.kestra.plugin.core.condition.ExpressionCondition
        expression: "{{ trigger.body.hello == 'world' }}"

Properties

key

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️
  • Max length: 256

The unique key that will be part of the URL.

The key is used for generating the URL of the webhook.

conditions

  • Type: array
  • SubType: Condition
  • Dynamic:
  • Required:

List of conditions in order to limit the flow trigger.

stopAfter

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

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

Outputs

body

  • Type: object
  • Required: ✔️

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 as string will be available.

headers

  • Type: object
  • SubType: array
  • Required: ✔️

The headers for the webhook request.

parameters

  • Type: object
  • SubType: array
  • Required: ✔️

The parameters for the webhook request.

Definitions

Was this page helpful?