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

# Slack Notifications

> Tag test owners in Slack when tests fail

When tests fail, you can tag owners in the Slack notification. Ownership rules are defined in a `.empiricalrun/OWNERS.yaml` file in your test repo.

## Setup

Create `.empiricalrun/OWNERS.yaml` in the root of your test repository.

## Format

```yaml theme={null}
rules:
  - match: { tag: "@payments" }
    owners:
      - slack: "U04ABCDEF"
```

Each rule has a `match` condition and a list of `owners` to mention.

## Matching

### By tag (exact match)

```yaml theme={null}
- match: { tag: "@payments" }
  owners:
    - slack: "U04ABCDEF"       # Alice
    - slack: "S07XYZ"          # #payments-team group
    - slack: "A08APPID"        # Slack app bot
```

### By file path (exact)

```yaml theme={null}
- match: { file: "tests/checkout.spec.ts" }
  owners:
    - slack: "U04ABCDEF"
```

### By directory (glob)

```yaml theme={null}
# All tests under tests/checkout/
- match: { file: "tests/checkout/**" }
  owners:
    - slack: "U04ABCDEF"
```

### By filename pattern (wildcard)

```yaml theme={null}
# All spec files directly in tests/api/
- match: { file: "tests/api/*.spec.ts" }
  owners:
    - slack: "U04ABCDEF"
```

<Note>`*` matches within a single directory, `**` matches across directories.</Note>

### All tests (catch-all)

```yaml theme={null}
- match: { file: "**" }
  owners:
    - slack: "U04ONCALL"
```

## Owner format

Use the Slack member ID, enterprise user ID, user group ID, or app ID directly:

* **User**: `U04ABCDEF` (find via Slack profile → Copy member ID)
* **Enterprise user**: `W04ABCDEF`
* **User group**: `S07XYZ` (find via Slack admin → User groups)
* **App**: `A08APPID` (find in the Slack app details URL)

The full mention syntax (`<@U04ABCDEF>`, `<!subteam^S07XYZ>`) is also supported.

App IDs mention the app's bot user, which must be in the channel.

## Behavior

* Rules are evaluated top-down; a test can match multiple rules
* All matched owners are mentioned (deduplicated)
* If `OWNERS.yaml` is missing or invalid, notifications are sent without mentions
