| jq ".workflow_name" -r) MESSAGE=$(echo $JSON | jq ".message" -r) ATTEMPT_ID=$(echo $JSON | jq ".attempt_id" -r) SESSION_ID=$(echo $JSON | jq ".session_id" -r) SLACK_PAYLOAD=$(cat << EOS payload={"channel": "#digdag_notice", "username": "webhookbot", "attachments": [{"color": "danger", "title": "<!channel>\n[ERROR] $WORKFLOW_NAME", "text": "$MESSAGE", "fields": [{"title": "Session", "value": "https://example.com/sessions/$SESSION_ID", "short": false}, {"title": "Attempt", "value": "https://example.com/attempts/$ATTEMPT_ID", "short": false}]}]} EOS ) PAGERDUTY_PAYLOAD=$(cat << EOS { "routing_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx", "event_action": "trigger", "payload": { "summary": "[ERROR] Digdag $WORKFLOW_NAME", "source": "Digdag", "severity": "error" } } EOS ) set +e echo "[Slack]\n${SLACK_PAYLOAD}" curl -X POST --data-urlencode "${SLACK_PAYLOAD}" https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxxx echo "[PagerDuty]\n${PAGERDUTY_PAYLOAD}" curl -X POST -d "${PAGERDUTY_PAYLOAD}" https://events.pagerduty.com/v2/enqueue set -e