LoginSignup
8
5

More than 5 years have passed since last update.

Digdag で Slack に通知を送る

Posted at

Digdag で例えば「エラー時に Slack にエラー内容を通知したい」という場合。

http> オペレータは任意の HTTP エンドポイントに JSON を投げつけることが出来るので、これを使えば Slack の Incoming Webhook を叩くことが出来る。

workflow.dig
_export:
  !include : shared/env.dig

# わざとワークフローを失敗させる
+fail_test:
  fail>: "foo!"

_error:
  +notify_to_slack:
    http>: ${SLACK_INCOMING_WEBHOOK_URL}
    method: POST
    content:
      attachments:
        - title: "Workflow failed!"
          text: ${error.message}
          color: danger
    content_format: json
shared/env.dig
SLACK_INCOMING_WEBHOOK_URL: https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX

参考: https://github.com/treasure-data/workflow-examples/tree/master/http/slack

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5