Skip to content

Latest commit

 

History

History
56 lines (46 loc) · 2.14 KB

chime_notifier_howto_guide.rst

File metadata and controls

56 lines (46 loc) · 2.14 KB

How-to Guide for Chime notifications

Introduction

Chime notifier (:class:`airflow.providers.amazon.aws.notifications.chime.ChimeNotifier`) allows users to send messages to a Chime chat room setup via a webhook using the various on_*_callbacks at both the DAG level and Task level

You can also use a notifier with sla_miss_callback.

Note

When notifiers are used with sla_miss_callback the context will contain only values passed to the callback, refer :ref:`sla_miss_callback<concepts:sla_miss_callback>`.

Example Code:

from datetime import datetime
from airflow import DAG
from airflow.operators.bash import BashOperator
from airflow.providers.amazon.aws.notifications.chime import send_chime_notification

with DAG(
    dag_id="mydag",
    schedule="@once",
    start_date=datetime(2023, 6, 27),
    on_success_callback=[
        send_chime_notification(chime_conn_id="my_chime_conn", message="The DAG {{ dag.dag_id }} succeeded")
    ],
    catchup=False,
):
    BashOperator(
        task_id="mytask",
        on_failure_callback=[
            send_chime_notification(chime_conn_id="my_chime_conn", message="The task {{ ti.task_id }} failed")
        ],
        bash_command="fail",
    )