Source: https://datafa.st/docs/cli-alerts
Markdown source: https://datafa.st/docs/cli-alerts.md
Description: Create, update, delete, and view alert history for your websites using the DataFast CLI.

# CLI — Alerts

Manage email alerts that fire when a goal is reached. Requires a `dft_` admin token.

Run `datafast alerts` to choose a command interactively. Commands prompt for the website or alert when omitted, and every picker includes `Cancel`. You can also press `Ctrl+C` to exit.

## List alerts

```sh
datafast alerts
datafast alerts list
datafast alerts list <websiteId>
```

## Get a single alert

```sh
datafast alerts get <websiteId> <alertId>
```

## Create an alert

Run without flags for an interactive prompt (name, goal, optional custom email template):

```sh
datafast alerts create <websiteId>
```

Or pass flags to skip the prompts:

```sh
# Minimal — fires when the "purchase" goal is hit
datafast alerts create <websiteId> --name "New sale" --goal "purchase"

# With a custom email subject and message
datafast alerts create <websiteId> --name "New sale" --goal "purchase" \
  --subject "🎉 New sale!" --message "Someone just converted"

# Create in disabled state
datafast alerts create <websiteId> --name "New sale" --goal "purchase" --disabled
```

## Update an alert

```sh
# Rename
datafast alerts update <websiteId> <alertId> --name "Renamed alert"

# Change the goal it watches
datafast alerts update <websiteId> <alertId> --goal "signup"

# Enable / disable
datafast alerts update <websiteId> <alertId> --enabled
datafast alerts update <websiteId> <alertId> --disabled
```

## Delete an alert

```sh
datafast alerts delete <websiteId> <alertId>

# Skip the confirmation prompt
datafast alerts delete <websiteId> <alertId> --yes
```

## Alert history

See a log of past alert triggers for a website:

```sh
datafast alerts history <websiteId>
```
