# flyte.notify

Task Notifications API for Flyte 2.0

Send notifications when tasks reach specific execution phases.
Supports Email, Slack, Teams, and custom Webhooks.

Quick Start:
    ```python
    import flyte
    import flyte.models
    import flyte.notify as notify

    @flyte.task(
        trigger=flyte.Trigger(
            name="daily_report",
            automation=flyte.Cron("0 0 * * *"),
            notifications=[
                notify.Email(
                    on_phase=flyte.models.ActionPhase.FAILED,
                    recipients=["oncall@example.com"]
                ),
                notify.Slack(
                    on_phase=flyte.models.ActionPhase.SUCCEEDED,
                    webhook_url="https://hooks.slack.com/...",
                    message="Daily report completed! {run.url}"
                )
            ]
        )
    )
    def daily_report():
        # Your task logic here
        pass
    ```

Available Notification Types:
    - Email: Send email notifications
    - Slack: Send Slack messages (with optional Block Kit)
    - Teams: Send Microsoft Teams messages (with optional Adaptive Cards)
    - Webhook: Send custom HTTP requests (most flexible)

Supported Phases:
    - SUCCEEDED: Task completed successfully
    - FAILED: Task failed
    - TIMED_OUT: Task timed out
    - ABORTED: Task was aborted

Template Variables:
    All notification messages support template variables:
    - {task.name}: Task name
    - {run.name}: Run ID/name
    - {run.phase}: Current run phase
    - {run.error}: Error message (if failed)
    - {run.duration}: Run duration
    - {run.timestamp}: ISO 8601 timestamp
    - {run.url}: URL to run details page
    - {project}: Flyte project name
    - {domain}: Flyte domain name
## Directory

### Classes

| Class | Description |
|-|-|
| [`Email`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/email/page.md) | Send email notifications. |
| [`NamedDelivery`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/nameddelivery/page.md) | Use a pre-configured delivery channel by name. |
| [`NamedRule`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/namedrule/page.md) | Reference a pre-defined notification rule by name. |
| [`Notification`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/notification/page.md) | Base notification class. |
| [`Slack`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/slack/page.md) | Send Slack notifications with optional Block Kit formatting. |
| [`Teams`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/teams/page.md) | Send Microsoft Teams notifications with optional Adaptive Cards. |
| [`Webhook`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/webhook/page.md) | Send custom HTTP webhook notifications (most flexible option). |

## Subpages

- [Email](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/email/page.md)
  - Parameters
- [NamedDelivery](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/nameddelivery/page.md)
  - Parameters
- [NamedRule](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/namedrule/page.md)
  - Parameters
- [Notification](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/notification/page.md)
  - Parameters
- [Slack](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/slack/page.md)
  - Parameters
- [Teams](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/teams/page.md)
  - Parameters
- [Webhook](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/webhook/page.md)
  - Parameters

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/packages/flyte.notify/_index.md
**HTML**: https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.notify/
