X XExecution

X XExecution

Certified

Post execution summary to X

Renders the bundled x.peb template with execution details (id, namespace, link, status, timings) plus custom fields/message, then sends it to X via bearer token or OAuth 1.0a with a 280-character cap.

yaml
type: io.kestra.plugin.x.XExecution

Send an X notification on a failed flow execution using Bearer Token.

yaml
id: failure_alert_x
namespace: company.team

tasks:
  - id: send_x_alert
    type: io.kestra.plugin.x.XExecution
    bearerToken: "{{ secret('X_BEARER_TOKEN') }}"
    executionId: "{{ trigger.executionId }}"
    customMessage: "Production workflow failed - immediate attention required!"  # Keep total text <= 280 chars
    customFields:
      Environment: "Production"
      Team: "DevOps"
      Priority: "High"

triggers:
  - id: failed_prod_workflows
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatus
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespace
        namespace: prod
        prefix: true

Send an X notification using OAuth 1.0a credentials.

yaml
id: success_alert_x
namespace: company.team

tasks:
  - id: send_x_success
    type: io.kestra.plugin.x.XExecution
    consumerKey: "{{ secret('X_CONSUMER_KEY') }}"
    consumerSecret: "{{ secret('X_CONSUMER_SECRET') }}"
    accessToken: "{{ secret('X_ACCESS_TOKEN') }}"
    accessSecret: "{{ secret('X_ACCESS_SECRET') }}"
    executionId: "{{ trigger.executionId }}"
    customMessage: "Deployment completed successfully!"  # Keep total text <= 280 chars
    options:
      readTimeout: PT5S
      headers:
        X-Datacenter: "eu-west-1"

triggers:
  - id: successful_deployments
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatus
        in:
          - SUCCESS
Properties

OAuth access secret

OAuth 1.0a access token secret required when bearer authentication is not used.

OAuth access token

OAuth 1.0a access token required when bearer authentication is not used.

Bearer token

X API bearer token for app-only authentication; overrides OAuth 1.0a credentials when set.

OAuth consumer key

OAuth 1.0a consumer key (API key) used when no bearer token is provided.

OAuth consumer secret

OAuth 1.0a consumer secret (API secret) required when bearer authentication is not used.

Custom fields

Key-value pairs appended to the rendered template output

Custom message

Optional extra text appended to the template output

Default{{ execution.id }}

Execution ID

Execution to include in the template; defaults to the current execution and should be set to {{ trigger.executionId }} when called from a Flow trigger

Options

The options to set to customize the HTTP client

Definitions
connectTimeoutstring

Connection timeout

Time allowed to establish a server connection before failing

connectionPoolIdleTimeoutstring
DefaultPT0S

Connection pool idle timeout

How long an idle connection stays in the pool before closure; defaults to 0s

defaultCharsetstring
DefaultUTF-8

Default charset

Charset used for requests when none is specified; defaults to UTF-8

headersobject

HTTP headers

HTTP headers to include in the request

maxContentLengthintegerstring
Default10485760

Max content length

Maximum response size in bytes; defaults to 10 MB

readIdleTimeoutstring
DefaultPT5M

Read idle timeout

How long a read connection may stay idle before closing; defaults to 5 minutes

readTimeoutstring
DefaultPT10S

Read timeout

Max time allowed for reading data from the server before failing; defaults to 10s

Reference (ref) of the pluginDefaults to apply to this task.

Template variables

Key-value map rendered and injected into the template before sending

Post text body

Direct post text that bypasses the template; must fit within 280 characters

Defaulthttps://api.x.com/2/tweets

Override URL for testing

Optional X API endpoint override; defaults to https://api.x.com/2/tweets