Apache Airflow Slack Provider
raw JSON → 9.9.0 verified Thu Apr 23 auth: no python install: stale
The Apache Airflow Slack provider package enables interaction with Slack, offering operators and hooks to send messages, upload files, and integrate with Slack workflows. It includes `SlackOperator` for the Slack API and `SlackWebhookOperator` for incoming webhooks. The current version is 9.9.0, and provider packages typically release independently of core Airflow, often aligning with Airflow's major releases or critical bug fixes.
pip install apache-airflow-providers-slack Common errors
error ModuleNotFoundError: No module named 'airflow.providers.slack' ↓
cause The 'apache-airflow-providers-slack' package is not installed or not accessible in the environment.
fix
Ensure the package is installed by running 'pip install apache-airflow-providers-slack'.
error slack_sdk.errors.SlackApiError: The request to the Slack API failed. The server responded with: {'ok': False, 'error': 'ratelimited'} ↓
cause The Slack API rate limit has been exceeded due to too many requests in a short period.
fix
Implement retry logic with exponential backoff to handle rate limits, and ensure the application adheres to Slack's rate limiting guidelines.
error ImportError: cannot import name 'SlackAPIPostOperator' from 'airflow.providers.slack.operators.slack' ↓
cause The 'SlackAPIPostOperator' has been deprecated or removed in the current version of the 'apache-airflow-providers-slack' package.
fix
Update the import statement to 'from airflow.providers.slack.operators.slack_api import SlackAPIPostOperator' or use the updated class name as per the latest documentation.
error AttributeError: module 'airflow.providers.slack.hooks.slack' has no attribute 'SlackHook' ↓
cause The 'SlackHook' class has been moved or renamed in the 'apache-airflow-providers-slack' package.
fix
Update the import statement to 'from airflow.providers.slack.hooks.slack_api import SlackHook' to reflect the new module structure.
error TypeError: __init__() got an unexpected keyword argument 'token' ↓
cause The 'token' parameter is not accepted in the constructor of the 'SlackHook' class.
fix
Remove the 'token' argument from the 'SlackHook' initialization and configure the Slack API token through Airflow's connection settings.
Warnings
breaking Prior to Airflow 2.0, Slack operators and hooks were part of `airflow.contrib`. With the introduction of provider packages, all Slack-related components were moved to `airflow.providers.slack`. Importing from `airflow.contrib.operators.slack_operator` or `airflow.contrib.hooks.slack_hook` will lead to `ModuleNotFoundError` in Airflow 2.0+. ↓
fix Update all import statements to use the new provider path: `from airflow.providers.slack...`.
gotcha Operators like `SlackWebhookOperator` and `SlackOperator` rely on correctly configured Airflow Connections. A common mistake is using the wrong connection type (e.g., `Generic` instead of `HTTP` for webhooks, or `Generic` instead of `Slack` for the Slack API) or placing the token/URL in the wrong field (e.g., `Host` for a webhook URL, `Password` for a Slack token). ↓
fix For `SlackWebhookOperator`, create an `HTTP` connection and place the full webhook URL in the 'Host' field. For `SlackOperator`, create a `Slack` connection and place the Slack API token (e.g., `xoxb-YOUR_TOKEN`) in the 'Password' field.
gotcha When using `SlackOperator` (which interacts with the Slack API directly), insufficient bot token scopes (permissions) are a frequent cause of `slack_sdk.errors.SlackApiError`. ↓
fix Ensure your Slack App's bot token has the necessary OAuth scopes. For example, `chat:write` for sending messages, `files:write` for uploading files, or specific channel read/write scopes, and install the app to the relevant workspace/channels.
gotcha `SlackWebhookOperator` uses Slack's incoming webhooks, which are simpler but have limitations compared to the full Slack API. It does not support features like uploading files, advanced user/channel lookups, or directly interacting with Slack APIs requiring OAuth. For these advanced use cases, `SlackOperator` (or `SlackHook` directly) should be used. ↓
fix If advanced Slack API features are needed, switch to `SlackOperator` or interact with `SlackHook` directly. `SlackWebhookOperator` is best suited for simple message posting.
breaking The `apache-airflow-providers-slack` package, through its dependency on `slack_sdk`, uses `aiohttp` for asynchronous operations. A `ModuleNotFoundError` for `aiohttp` indicates this dependency is missing from the environment. ↓
fix Install the `aiohttp` package: `pip install aiohttp`. If installing `apache-airflow` with extras, ensure `pip install "apache-airflow[slack]"` is used, as it should include `aiohttp` as a dependency.
Install compatibility stale last tested: 2026-04-23
runtime status import time mem disk
3.10-alpine — — —
3.10-slim — — —
3.11-alpine — — —
3.11-slim — — —
3.12-alpine — — —
3.12-slim — — —
3.13-alpine — — —
3.13-slim — — —
3.9-alpine — — —
3.9-slim — — —
Imports
- SlackOperator wrong
from airflow.contrib.operators.slack_operator import SlackOperatorcorrectfrom airflow.providers.slack.operators.slack_operator import SlackOperator - SlackWebhookOperator wrong
from airflow.contrib.operators.slack_webhook_operator import SlackWebhookOperatorcorrectfrom airflow.providers.slack.operators.slack_webhook import SlackWebhookOperator - SlackHook
from airflow.providers.slack.hooks.slack import SlackHook - SlackWebhookHook
from airflow.providers.slack.hooks.slack_webhook import SlackWebhookHook
Quickstart last tested: 2026-04-24
from airflow.providers.slack.operators.slack_webhook import SlackWebhookOperator
from airflow.models.dag import DAG
from datetime import datetime
# IMPORTANT: For this DAG to send messages, an Airflow Connection named 'slack_webhook_default'
# must be configured. It should be an 'HTTP' connection type, with your Slack Incoming Webhook URL
# placed in the 'Host' field (e.g., https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX).
# For local testing without sending actual messages, you can create a dummy HTTP connection.
with DAG(
dag_id='slack_webhook_quickstart',
start_date=datetime(2023, 1, 1),
schedule=None, # This DAG runs manually
catchup=False,
tags=['slack', 'example'],
) as dag:
send_message_to_slack = SlackWebhookOperator(
task_id='send_message_to_slack',
slack_webhook_conn_id='slack_webhook_default',
message="Hello from Airflow! This is a test message from the quickstart DAG. :airflow:",
channel="#general" # Specify the Slack channel (optional, overrides default webhook channel)
)