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

# Scheduled Jobs

> Trigger any agent on a schedule and deliver reports, alerts, or digests to Slack automatically.

## Your agents don't just wait to be asked

Most AI tools are reactive - you ask, they answer. Scheduled Jobs make your agents **proactive**. Set a schedule, point it at any agent, and it fires automatically - running queries, checking metrics, scanning for anomalies, and posting results directly to a Slack channel or DM.

No dashboards to check. No reports to pull. The insight comes to you.

***

## What you can build

<CardGroup cols={2}>
  <Card title="GMV & Revenue Alerts" icon="chart-line">
    If GMV drops more than 10% hour-over-hour, DM the CEO immediately with a breakdown by channel and cohort.
  </Card>

  <Card title="Fraud Monitoring" icon="shield-halved">
    Run a fraud check every hour. If anomalies are detected, post a summary to `#fraud-alerts` with transaction IDs and risk scores.
  </Card>

  <Card title="Daily Business Digest" icon="newspaper">
    Every morning at 8 AM, post yesterday's key metrics - bookings, revenue, churn, NPS - to `#analytics`.
  </Card>

  <Card title="Weekly Engineering Report" icon="code">
    Every Monday, summarize last week's PRs, incidents, and deploy count. Post to `#engineering`.
  </Card>

  <Card title="Inventory Alerts" icon="boxes-stacked">
    Check stock levels every 4 hours. DM the ops lead if any SKU drops below threshold.
  </Card>

  <Card title="Support Queue Health" icon="headset">
    Every 30 minutes during business hours, check ticket queue depth. Alert `#support-ops` if SLA is at risk.
  </Card>
</CardGroup>

***

## How it works

<Steps>
  <Step title="You set up a job">
    Pick an agent, write a prompt, set a schedule, and choose where results go - a Slack channel or a direct message.
  </Step>

  <Step title="The schedule fires">
    At the configured time, SlackHive sends your prompt to the agent - exactly like a Slack message, but automated.
  </Step>

  <Step title="The agent runs">
    The agent executes fully - it can run queries, call APIs, check metrics, compare against thresholds, and reason about the results.
  </Step>

  <Step title="Results posted to Slack">
    The response is posted to the channel or DM you configured. Long reports are organized into a parent message and thread so channels stay readable.
  </Step>
</Steps>

***

## Any agent, any schedule

Jobs are not limited to boss agents. Assign a job to any agent:

| Agent            | Job example                                              |
| ---------------- | -------------------------------------------------------- |
| `@data-analyst`  | Run revenue query every morning, post to `#finance`      |
| `@devops`        | Check error rates every 15 min, DM on-call if spiking    |
| `@fraud-bot`     | Hourly transaction anomaly scan, post to `#fraud-alerts` |
| `@support-agent` | Check ticket backlog every 30 min, alert if queue > 50   |
| `@boss`          | Daily summary across all teams, post to `#general`       |

***

## Creating a job

Go to **Jobs** in the sidebar → **New Job**.

<Steps>
  <Step title="Name the job">
    Give it a clear name - e.g. `Daily Revenue Digest` or `Hourly Fraud Check`.
  </Step>

  <Step title="Choose an agent">
    Select which agent should run this job. Pick the specialist best suited for the task.
  </Step>

  <Step title="Write the prompt">
    Write exactly what you'd say to the agent in Slack. Be specific about what to check, what thresholds matter, and what to include in the response.

    ```
    Check GMV for the last hour vs the same hour yesterday.
    If it's down more than 10%, flag it as urgent and include
    a breakdown by acquisition channel. Otherwise just post
    a one-line summary.
    ```
  </Step>

  <Step title="Set the schedule">
    Use a cron expression or pick a preset:

    | Preset           | Cron           |
    | ---------------- | -------------- |
    | Every hour       | `0 * * * *`    |
    | Every 15 minutes | `*/15 * * * *` |
    | Daily at 8 AM    | `0 8 * * *`    |
    | Weekdays at 9 AM | `0 9 * * 1-5`  |
    | Weekly on Monday | `0 9 * * 1`    |

    <Tip>The UI shows cron expressions in plain English so you can verify the schedule before saving.</Tip>
  </Step>

  <Step title="Set the target - Channel or DM">
    Choose where the agent posts its results.

    <Tabs>
      <Tab title="Post to a Channel">
        Post results publicly to any Slack channel - `#analytics`, `#fraud-alerts`, `#engineering`, etc.

        **How to get the channel ID:**

        1. Open Slack and right-click the channel name in the sidebar
        2. Click **Copy link**
        3. The link looks like: `https://app.slack.com/client/T.../C08ABCD1234`
        4. The channel ID is the part starting with `C` - e.g. `C08ABCD1234`

        Paste it into the **Target** field and select **Channel**.

        <Note>Make sure the agent's Slack bot has been invited to the channel first. If not, invite it with `/invite @agent-name`.</Note>
      </Tab>

      <Tab title="Send a DM">
        Send results as a direct message to any individual - CEO, on-call engineer, finance lead, or yourself.

        **How to get the user ID:**

        1. In Slack, click on the person's name or profile picture
        2. Click **View full profile**
        3. Click the **⋯ More** button (three dots)
        4. Click **Copy member ID**
        5. It looks like: `U012AB3CD45`

        Paste it into the **Target** field and select **DM**.

        The message arrives as a direct message from the agent's Slack bot - clean and personal.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Optionally skip quiet notifications">
    Add a **Skip notification when...** condition when you only want Slack messages for meaningful results.

    ```
    there are no fraud cases to report
    ```

    If the run completes and that condition is true, SlackHive records the run as skipped and does not post a message.
  </Step>
</Steps>

***

## Channel vs DM - when to use which

| Use case                                               | Channel | DM |
| ------------------------------------------------------ | ------- | -- |
| Team-wide reports (daily digest, weekly summary)       | ✅       |    |
| Public monitoring dashboards (`#fraud-alerts`, `#ops`) | ✅       |    |
| Personal alerts (CEO wants GMV drop notification)      |         | ✅  |
| On-call paging (engineer gets error spike alert)       |         | ✅  |
| Sensitive metrics (revenue, churn - exec-only)         |         | ✅  |
| Cross-team awareness (PM, data, eng all need to know)  | ✅       |    |

<Tip>You can create multiple jobs for the same agent - one that posts to a channel for team visibility, and another that DMs the team lead for immediate personal attention.</Tip>

***

## Writing effective job prompts

The prompt is the most important part. A few principles:

**Be specific about what to check**

```
❌ Check the data
✅ Query bookings for the last 24 hours and compare to the 7-day average
```

**Define what "notable" means**

```
❌ Let me know if anything is wrong
✅ Flag if conversion rate drops below 3% or if any single channel
   drops more than 20% week-over-week
```

**Tell it what to do in each case**

```
✅ If everything looks normal, post a one-line summary.
   If something needs attention, include the specific numbers,
   what changed, and your best hypothesis for why.
```

**Use skip notifications for noisy checks**

```
Prompt: Check failed payments in the last hour and summarize any customer impact.
Skip notification when: there are zero failed payments or no action is needed.
```

This keeps monitoring jobs useful without filling channels with "nothing happened" messages.

**Give it context it might need**

```
✅ Note: Tuesday is always lower due to our weekly maintenance window.
   Don't flag Tuesday dips unless they exceed 30%.
```

***

## Rich Slack formatting

Scheduled jobs aren't limited to plain text. Agents can post **Slack Block Kit** payloads - tables, sections, dividers, buttons - for readable reports.

Ask the agent in your prompt:

```
Post the results as a Slack table: columns for channel, conversions,
week-over-week change. Use Block Kit. Highlight anything down more
than 10% in red emoji.
```

Under the hood the agent emits a `postPayload` with `blocks` - SlackHive delivers it to Slack verbatim. The rendered message has proper columns, section headers, and colored highlights instead of a wall of text.

When to use:

* Daily digest with multiple metrics - tables are much easier to scan
* Fraud alerts with transaction IDs - columns keep fields aligned
* Weekly engineering report - sections with dividers between topics

For simple one-line alerts, plain text is still best. Reserve rich formatting for reports with structure.

### Keep long reports readable

A long report is posted as several messages: the first becomes the channel-visible **parent**, and the rest goes into a thread beneath it. Use the parent for the headline, status, and "what changed"; put detailed tables and evidence in the thread.

If you want exact control over where the thread starts, ask the agent to put this break marker on its own line:

```
{your headline summary}
<!--slackhive:break-->
*Table 1*
| ... |
```

SlackHive removes the marker before posting.

***

## Monitoring job runs

Every job run is logged - status, output, duration, and timestamp - visible in **Jobs → \[job name] → Run History**.

| Status    | Meaning                                                             |
| --------- | ------------------------------------------------------------------- |
| ✅ Success | Agent ran and posted to Slack                                       |
| ⏭ Skipped | Agent ran successfully, but the skip-notification condition matched |
| ❌ Error   | Agent not running, backend error, or Slack API failure              |

<Note>
  If a job fails, the error is logged in run history. Common causes: the agent's Slack app token expired, the agent wasn't running, or the MCP server the agent needed was down.
</Note>

***

## Example: GMV drop alert

Here's a complete setup for a GMV monitoring job:

| Field                      | Value                                                                                                                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**                   | Hourly GMV Alert                                                                                                                                                             |
| **Agent**                  | `@data-analyst`                                                                                                                                                              |
| **Schedule**               | `0 * * * *` (every hour)                                                                                                                                                     |
| **Target**                 | DM → CEO's Slack user ID                                                                                                                                                     |
| **Prompt**                 | Compare GMV for the last hour vs the same hour last week. If it's down more than 15%, send an urgent alert with a breakdown by channel, device type, and acquisition source. |
| **Skip notification when** | GMV is within the normal range and no action is needed                                                                                                                       |

The CEO only gets a DM when something needs attention. When something breaks, they know immediately - with the breakdown already in their pocket.

***

## Who can see and create jobs

| Role                   | Can see jobs               | Can create / edit / delete  |
| ---------------------- | -------------------------- | --------------------------- |
| **Superadmin / Admin** | All jobs                   | ✅                           |
| **Editor**             | Jobs for accessible agents | ✅ (edit-access agents only) |
| **Viewer**             | Jobs for accessible agents | ❌ read-only                 |

Jobs are filtered by the agents a user can access — an editor only sees jobs assigned to agents they own or were granted access to. Viewers see the same filtered list but cannot make changes.

When creating a job, editors can only pick agents they have **Edit** access to. Agents where they only have View or Trigger access won't appear in the agent dropdown.

***

## Next steps

<CardGroup cols={2}>
  <Card title="Creating Agents" icon="robot" href="/agents/creating-agents">
    Build the specialist agents that power your jobs.
  </Card>

  <Card title="MCP Servers" icon="plug" href="/configuration/mcp-servers">
    Connect agents to your data sources so jobs can query real data.
  </Card>
</CardGroup>
