Dagster Slack

0.29.0 · active · verified Sat Apr 11

The `dagster-slack` library provides a Slack client resource for integrating Slack notifications and messaging capabilities into Dagster data pipelines. It enables users to send messages to Slack channels from ops, assets, schedules, and sensors, facilitating real-time communication about pipeline status and events. The current version is 0.29.0, and it follows the frequent release cadence of the broader Dagster ecosystem.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define a `SlackResource` with a Slack bot token (loaded from an environment variable) and then use it within a Dagster asset to post a message to a specified Slack channel. A Slack App and bot token are required for this to function.

import os
from dagster import Definitions, EnvVar, asset
from dagster_slack import SlackResource

@asset
def send_slack_message(slack: SlackResource):
    """An asset that sends a message to Slack."""
    channel = os.environ.get('SLACK_CHANNEL', '#general') # Ensure channel exists
    slack.get_client().chat_postMessage(channel=channel, text=":wave: Hello from Dagster!")

defs = Definitions(
    assets=[send_slack_message],
    resources={
        "slack": SlackResource(token=EnvVar("MY_SLACK_TOKEN"))
    },
)

view raw JSON →