Trigger Trigger

yaml
type: "io.kestra.plugin.core.http.Trigger"

Trigger a flow based on an HTTP response

Examples

Send a Slack alert if the price is below a certain threshold. The flow will be triggered every 30 seconds until the condition is met. Then, the stopAfter property will disable the trigger to avoid unnecessary API calls and alerts.

yaml
id: http_price_alert
namespace: company.team

tasks:
  - id: send_slack_alert
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    payload: |
      {
        "channel": "#price-alerts",
        "text": "The price is now: {{ json(trigger.body).price }}"
      }

triggers:
  - id: http
    type: io.kestra.plugin.core.http.Trigger
    uri: https://fakestoreapi.com/products/1
    responseCondition: "{{ json(response.body).price <= 110 }}"
    interval: PT30S
    stopAfter:
      - SUCCESS

Trigger a flow if an HTTP endpoint returns a status code equals to 200

yaml
id: http_trigger
namespace: company.team

tasks:
  - id: log_response
    type: io.kestra.plugin.core.log.Log
    message: '{{ trigger.body }}'

triggers:
  - id: http
    type: io.kestra.plugin.core.http.Trigger
    uri: https://api.chucknorris.io/jokes/random
    responseCondition: "{{ response.statusCode == 200 }}"
    stopAfter:
      - SUCCESS

Properties

responseCondition

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️
  • Default: {{ response.statusCode < 400 }}

The condition on the HTTP response to trigger a flow which can be any expression that evaluates to a boolean value.

The condition will be evaluated after calling the HTTP endpoint, it can use the response itself to determine whether to start a flow or not. The following variables are available when evaluating the condition:

  • response.statusCode: the response HTTP status code
  • response.body: the response body as a string
  • response.headers: the response headers

Boolean coercion allows 0, -0, null and '' to evaluate to false, all other values will evaluate to true.

The condition will be evaluated before any 'generic trigger conditions' that can be configured via the conditions property.

uri

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The fully-qualified URI that points to the HTTP destination

body

  • Type: string
  • Dynamic: ✔️
  • Required:

The full body as a string

conditions

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

List of conditions in order to limit the flow trigger.

contentType

  • Type: string
  • Dynamic: ✔️
  • Required:

The request content type

encryptBody

  • Type: boolean
  • Dynamic:
  • Required:
  • Default: false

If true, the HTTP response body will be automatically encrypted and decrypted in the outputs if encryption is configured

When true, the encryptedBody output will be filled, otherwise the body output will be filled

formData

  • Type: object
  • Dynamic: ✔️
  • Required:

The form data to be send

headers

  • Type: object
  • SubType: string
  • Dynamic: ✔️
  • Required:

The headers to pass to the request

interval

  • Type: string
  • Dynamic:
  • Required:
  • Default: 60.000000000
  • Format: duration

Interval between polling.

The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.

method

  • Type: string
  • Dynamic:
  • Required:
  • Default: GET
  • Possible Values:
    • OPTIONS
    • GET
    • HEAD
    • POST
    • PUT
    • DELETE
    • TRACE
    • CONNECT
    • PATCH
    • CUSTOM

The HTTP method to use

options

The HTTP request options

sslOptions

The SSL request options

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 body of the response.

Kestra will by default store the task output using this property. However, if the encryptBody property is set to true, kestra will instead encrypt the output and store it using the encryptedBody output property.

code

  • Type: integer
  • Required:

The status code of the response.

encryptedBody

The encrypted body of the response.

If the encryptBody property is set to true, kestra will automatically encrypt the output before storing it, and decrypt it when the output is retrieved in a downstream task.

formData

  • Type: object
  • Required:

The form data to be sent in the request body

When sending a file, you can pass a list of maps (i.e. a list of key-value pairs) with a key 'name' and value of the filename, as well as 'content' key with the file's content as value (e.g. passed from flow inputs or outputs from another task).

headers

  • Type: object
  • SubType: array
  • Required:

The headers of the response.

uri

  • Type: string
  • Required:
  • Format: uri

The URL of the current request.

Definitions

java.nio.charset.Charset

Properties

io.kestra.plugin.core.http.HttpInterface-RequestOptions

Properties

basicAuthPassword
  • Type: string
  • Dynamic: ✔️
  • Required:

The password for HTTP basic authentication.

basicAuthUser
  • Type: string
  • Dynamic: ✔️
  • Required:

The username for HTTP basic authentication.

connectTimeout
  • Type: string
  • Dynamic:
  • Required:
  • Format: duration

The time allowed to establish a connection to the server before failing.

connectionPoolIdleTimeout
  • Type: string
  • Dynamic:
  • Required:
  • Default: 0.0
  • Format: duration

The time an idle connection can remain in the client's connection pool before being closed.

defaultCharset
  • Type: Charset
  • Dynamic:
  • Required:
  • Default: UTF-8

The default charset for the request.

followRedirects
  • Type: boolean
  • Dynamic:
  • Required:
  • Default: true

Whether redirects should be followed automatically.

logLevel
  • Type: string
  • Dynamic:
  • Required:
  • Possible Values:
    • ALL
    • TRACE
    • DEBUG
    • INFO
    • WARN
    • ERROR
    • OFF
    • NOT_SPECIFIED

The log level for the HTTP client.

maxContentLength
  • Type: integer
  • Dynamic:
  • Required:
  • Default: 10485760

The maximum content length of the response.

proxyAddress
  • Type: string
  • Dynamic: ✔️
  • Required:

The address of the proxy server.

proxyPassword
  • Type: string
  • Dynamic: ✔️
  • Required:

The password for proxy authentication.

proxyPort
  • Type: integer
  • Dynamic:
  • Required:

The port of the proxy server.

proxyType
  • Type: string
  • Dynamic:
  • Required:
  • Default: DIRECT
  • Possible Values:
    • DIRECT
    • HTTP
    • SOCKS

The type of proxy to use.

proxyUsername
  • Type: string
  • Dynamic: ✔️
  • Required:

The username for proxy authentication.

readIdleTimeout
  • Type: string
  • Dynamic:
  • Required:
  • Default: 300.000000000
  • Format: duration

The time allowed for a read connection to remain idle before closing it.

readTimeout
  • Type: string
  • Dynamic:
  • Required:
  • Default: 10.000000000
  • Format: duration

The maximum time allowed for reading data from the server before failing.

io.kestra.core.models.tasks.common.EncryptedString

Properties

type
  • Type: string
  • Dynamic:
  • Required:
value
  • Type: string
  • Dynamic:
  • Required:

io.kestra.plugin.core.http.HttpInterface-SslOptions

Properties

insecureTrustAllCertificates
  • Type: boolean
  • Dynamic:
  • Required:

Whether to disable checking of the remote SSL certificate.

Only applies if no trust store is configured. Note: This makes the SSL connection insecure and should only be used for testing. If you are using a self-signed certificate, set up a trust store instead.

Was this page helpful?