> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.rebase.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Alerts

> Send alerts to Email, Slack or Teams

{/*
Inspired by: 
https://docs.ray.io/en/latest/serve/getting_started.html
https://modal.com/docs/guide/webhooks
https://docs.zenml.io/stacks-and-components/component-guide/alerters
*/}

[Try in Colab Notebook →](tet)

Using **Rebase Alerts**, you can be notified via email or Slack based on
data validators, pipeline crashes or other custom triggers. An alert is
sent as:

```python
import rebase as rb

rb.alert(title="Red alert", text="This is an alert!")
```

## Using `rebase.alert()`

<ParamField body="title" type="string" required>
  A short description of the alert, for example "Data out of bounds".
</ParamField>

<ParamField body="text" type="string" required>
  A longer, more detailed description of why the alert got triggered.
</ParamField>

<ParamField body="level" type="AlertLevel">
  A flag specifying how important the alert is. Must be one of `AlertLevel.INFO`,
  `AlertLevel.WARNING`, or `AlertLevel.ERROR`. `AlertLevel`is imported from `rebase`.
</ParamField>

<ParamField body="buffer_time" type="integer" default={300}>
  Number of seconds to add as buffer time between two alerts with the same title.
  This allows to reduce alert spam.
</ParamField>

## Example

This is a simple example of an alert that is created when the production falls
below 80% of the theoretical production. In order to avoid alert spam, we set the

```python
import rebase as rb
from rebase import AlertLevel

if production < 0.8*theoretical_production:
    rb.alert(
        title="Low production",
        text=f"Production {prod} is below the acceptable threshold {0.8*theoretical_production}",
        level=AlertLevel.WARNING,
        buffer_time=300
    )
```

`rebase.alert()`
