SlackIncomingWebhook

SlackIncomingWebhook

Certified

Send a Slack message using an Incoming Webhook.

yaml
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
yaml
id: slack_incoming_webhook
namespace: company.team

tasks:
  - id: send_slack_message
    type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    messageText: "Hello from the workflow {{ flow.id }}"

yaml
id: unreliable_flow
namespace: company.team

tasks:
  - id: fail
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.plugin.core.runner.Process
    commands:
      - exit 1

errors:
  - id: alert_on_failure
    type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}" # https://hooks.slack.com/services/xzy/xyz/xyz
    messageText: "Failure alert for flow {{ flow.namespace }}.{{ flow.id }} with ID {{ execution.id }}"

yaml
id: slack_incoming_webhook
namespace: company.team

tasks:
  - id: send_slack_message
    type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    payload: |
      {
        "blocks": [
          {
            "type": "header",
            "text": {
              "type": "plain_text",
              "text": "Workflow completed: {{ flow.id }}"
            }
          },
          {
            "type": "divider"
          },
          {
            "type": "section",
            "fields": [
              {
                "type": "mrkdwn",
                "text": "*Namespace:*
{{ flow.namespace }}"
              },
              {
                "type": "mrkdwn",
                "text": "*Execution ID:*
{{ execution.id }}"
              },
              {
                "type": "mrkdwn",
                "text": "*Status:*
{{ execution.state }}"
              },
              {
                "type": "mrkdwn",
                "text": "*Start time:*
{{ execution.startDate }}"
              }
            ]
          },
          {
            "type": "context",
            "elements": [
              {
                "type": "mrkdwn",
                "text": "Triggered by Kestra"
              }
            ]
          }
        ]
      }

yaml
id: rocket_chat_notification
namespace: company.team
tasks:
  - id: send_rocket_chat_message
    type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
    url: "{{ secret('ROCKET_CHAT_WEBHOOK') }}"
    payload: |
      {
        "alias": "Kestra TEST",
        "avatar": "https://avatars.githubusercontent.com/u/59033362?s=48",
        "emoji": ":smirk:",
        "roomId": "#my-channel",
        "text": "Sample",
        "tmshow": true,
        "attachments": [
          {
            "collapsed": false,
            "color": "#ff0000",
            "text": "Yay!",
            "title": "Attachment Example",
            "title_link": "https://rocket.chat",
            "title_link_download": false,
            "fields": [
              {
                "short": false,
                "title": "Test title",
                "value": "Test value"
              },
              {
                "short": true,
                "title": "Test title",
                "value": "Test value"
              }
            ]
          }
        ]
      }
Properties
Min length1
Definitions
connectTimeoutstring
connectionPoolIdleTimeoutstring
DefaultPT0S
defaultCharsetstring
DefaultUTF-8
headersobject
SubTypestring
maxContentLengthintegerstring
Default10485760
readIdleTimeoutstring
DefaultPT5M
readTimeoutstring
DefaultPT10S