Send Scheduled Data Alerts by Email
A team needs to know when a business condition fires: inventory running low, bookings falling behind target, sales dropping week over week. This recipe builds an agent that checks a data product on a schedule and emails the right people only when there’s something to say. It runs in production today at a manufacturer, where parameterized variants of one flow send weekly depletion alerts to dozens of suppliers and staff.
One metered action per run (the SQL Execution tool call); the SMTP send uses a custom tool and isn’t metered. About 13 ACU/week across 50 weekly flows. At 0.25 ACU per metered action; confirm actual spend on the Usage page.
What you’ll use
Section titled “What you’ll use”Prerequisites
Section titled “Prerequisites”- A published data product over the source you want to monitor.
- Warehouse credentials configured for scheduled (non-interactive) runs.
- SMTP server details for the email tool.
Build it
Section titled “Build it”-
Create the agent
Write the prompt around the condition, not the query: “Identify SKUs with fewer than 14 days of stock remaining. If none, reply NO ALERT.” Add the SQL Execution tool scoped to your data product.
-
Add the SMTP tool
Configure recipients (To, CC, and BCC are all supported), subject, and body. Ask for an HTML body if the email contains tables. Charts can be embedded inline with
<img src="cid:asset_id" />using the asset ID from the chart tool, or passed as attachments. -
Wrap it in a flow
Chain the check step and the email step, with the email conditional on the check finding something. For per-segment alerts (per supplier, per region), create one parameterized flow per segment rather than one giant prompt.
-
Schedule it
Set the cadence on the flow’s Schedule tab, for example Mondays at 10:00.
Gotchas
Section titled “Gotchas”- For Microsoft 365, configure the SMTP tool with OAuth 2.0 client credentials (XOAUTH2) rather than basic auth. Basic auth works for providers that still allow it.
- Inline images must be PNG; other formats go as attachments.
- Keep failure notifications on (
notify_on_failureis on by default) and review interaction logs periodically. - Verify the run history after daylight-saving transitions.
- To deliver into Slack without the Slack integration, email the channel’s Slack email address.
Variations
Section titled “Variations”- Weekly digest instead of threshold alert: summarize the metric every run instead of replying NO ALERT.
- Relative conditions: “alert me when sales drop more than 5% week over week.”