# flytekit.core.notification

Notifications are primarily used when defining Launch Plans (also can be used when launching executions) and will trigger
the Flyte platform to send emails when a workflow run reaches certain stages (fails or succeeds, etc.).

Each notification type takes a list of {{< py_class_ref flytekit.models.core.execution.WorkflowExecutionPhase >}} and a list of
emails. Even though there are different notification classes in this module, they all just send email. The differentiation
offers semantic meaning to the end-user but do not functionally behave differently. Successful integration with Slack
and Pagerduty is incumbent on those email API being set-up correctly.
## Directory

### Classes

| Class | Description |
|-|-|
| [`Email`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.core.notification/page.md#flytekitcorenotificationemail) | This notification should be used when sending regular emails to people. |
| [`Notification`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.core.notification/page.md#flytekitcorenotificationnotification) |  |
| [`PagerDuty`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.core.notification/page.md#flytekitcorenotificationpagerduty) | This notification should be used when sending emails to the PagerDuty service. |
| [`Slack`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.core.notification/page.md#flytekitcorenotificationslack) | This notification should be used when sending emails to the Slack. |

## flytekit.core.notification.Email

This notification should be used when sending regular emails to people.

```python
from flytekit.models.core.execution import WorkflowExecutionPhase

Email(phases=[WorkflowExecutionPhase.SUCCEEDED], recipients_email=["my-team@email.com"])
```

### Parameters

```python
class Email(
    phases: typing.List[int],
    recipients_email: typing.List[str],
)
```
| Parameter | Type | Description |
|-|-|-|
| `phases` | `typing.List[int]` | |
| `recipients_email` | `typing.List[str]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `email` | `None` |  |
| `is_empty` | `None` |  |
| `pager_duty` | `None` |  |
| `phases` | `None` | A list of phases to which users can associate the notifications. |
| `slack` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    p,
)
```
| Parameter | Type | Description |
|-|-|-|
| `p` |  | |

**Returns:** Notification

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.admin.common_pb2.Notification

## flytekit.core.notification.Notification

### Parameters

```python
class Notification(
    phases: typing.List[int],
    email: flytekit.models.common.EmailNotification,
    pager_duty: flytekit.models.common.PagerDutyNotification,
    slack: flytekit.models.common.SlackNotification,
)
```
| Parameter | Type | Description |
|-|-|-|
| `phases` | `typing.List[int]` | |
| `email` | `flytekit.models.common.EmailNotification` | |
| `pager_duty` | `flytekit.models.common.PagerDutyNotification` | |
| `slack` | `flytekit.models.common.SlackNotification` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `email` | `None` |  |
| `is_empty` | `None` |  |
| `pager_duty` | `None` |  |
| `phases` | `None` | A list of phases to which users can associate the notifications. |
| `slack` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    p,
)
```
| Parameter | Type | Description |
|-|-|-|
| `p` |  | |

**Returns:** Notification

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.admin.common_pb2.Notification

## flytekit.core.notification.PagerDuty

This notification should be used when sending emails to the PagerDuty service.

```python
from flytekit.models.core.execution import WorkflowExecutionPhase

PagerDuty(phases=[WorkflowExecutionPhase.SUCCEEDED], recipients_email=["my-team@email.com"])
```

### Parameters

```python
class PagerDuty(
    phases: typing.List[int],
    recipients_email: typing.List[str],
)
```
| Parameter | Type | Description |
|-|-|-|
| `phases` | `typing.List[int]` | |
| `recipients_email` | `typing.List[str]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `email` | `None` |  |
| `is_empty` | `None` |  |
| `pager_duty` | `None` |  |
| `phases` | `None` | A list of phases to which users can associate the notifications. |
| `slack` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    p,
)
```
| Parameter | Type | Description |
|-|-|-|
| `p` |  | |

**Returns:** Notification

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.admin.common_pb2.Notification

## flytekit.core.notification.Slack

This notification should be used when sending emails to the Slack.

```python
from flytekit.models.core.execution import WorkflowExecutionPhase

Slack(phases=[WorkflowExecutionPhase.SUCCEEDED], recipients_email=["my-team@email.com"])
```

### Parameters

```python
class Slack(
    phases: typing.List[int],
    recipients_email: typing.List[str],
)
```
| Parameter | Type | Description |
|-|-|-|
| `phases` | `typing.List[int]` | |
| `recipients_email` | `typing.List[str]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `email` | `None` |  |
| `is_empty` | `None` |  |
| `pager_duty` | `None` |  |
| `phases` | `None` | A list of phases to which users can associate the notifications. |
| `slack` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    p,
)
```
| Parameter | Type | Description |
|-|-|-|
| `p` |  | |

**Returns:** Notification

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.admin.common_pb2.Notification

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flytekit-sdk/packages/flytekit.core.notification.md
**HTML**: https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.core.notification/
