Daily MySQL low-stock restock digest in Slack and Asana
Every weekday at 7am, find low-stock SKUs in your MySQL inventory, file reorder tasks in Asana for the right buyer, and post one ranked digest in Slack.
Build me an agent workflow that runs every weekday at 7am in my local time zone and sweeps my MySQL inventory for restock work, then files real tasks in Asana and posts one ranked digest in Slack.
Trigger: cron, every Monday through Friday at 7am local.
Step 1, pull at-risk SKUs from MySQL. Use the MySQL Custom Query operation. Join my inventory table to the last 14 days of order line items so the agent can compute days-of-cover per SKU (on-hand quantity divided by average daily units sold over the trailing 14 days). Filter to SKUs where on-hand quantity is below the reorder point, or days-of-cover is under 7 days. For each row, also return the supplier name, the buyer or owner named on the supplier row, the trailing 30 days of revenue for that SKU, the on-hand quantity, the reorder point, and the calculated days-of-cover. I will tell you my exact table and column names when wiring this up, so write the query against placeholders like inventory, order_line_items, and suppliers, with sensible joins on sku and supplier_id.
Step 2, rank the results. In the agent step, score each at-risk SKU by how soon it will stock out, weighted by its share of the last 30 days of revenue across all at-risk SKUs. Sort descending. This is the list the rest of the workflow acts on.
Step 3, file Asana tasks for the top items. For each SKU near the top of the ranking, use the Asana Create a Task operation in my Purchasing project. The task name should be something like "Restock SKU 12345 (Widget Co)". The task notes should include the SKU, supplier name, suggested reorder quantity (use a simple lead-time-times-velocity formula, round up to the supplier minimum if I provide one), current on-hand, reorder point, days-of-cover, and the trailing 30 days of revenue as velocity context. Set a due date a couple of business days out. Assign the task to the buyer named on the supplier row by matching their name or email to an Asana user. If the buyer cannot be matched, leave the task unassigned in the Purchasing project.
Step 4, post the digest in Slack. Use the Slack Bot Send a Message operation to post one message in #ops. The message should summarize how many SKUs were queued for restock today, list the top three SKUs inline with supplier, on-hand, days-of-cover, and reorder quantity, and link out to the Asana Purchasing project for the full list. If the at-risk list from step 1 is empty, do not skip the message. Post a one-line all-clear in the same channel instead, something like "Inventory check ran, no SKUs at risk today."
Keep the SQL safe: read-only SELECT, parameterized, no string interpolation of user input, LIMIT the result set so a runaway query cannot dump the whole catalog.
Tunables I want exposed at setup: the cron time and time zone, the days-of-cover threshold, the lead-time used for suggested reorder quantity, the Asana project to file tasks in, and the Slack channel for the digest.
Additional information
What does this prompt do?
- Runs a weekday morning sweep of your MySQL inventory and last two weeks of orders to flag any SKU where on-hand stock is below the reorder point or days-of-cover is under a week.
- Ranks the at-risk SKUs by how soon they will stock out, weighted by recent revenue, so the items that actually matter rise to the top.
- Files an Asana task in your Purchasing project for each top item with the SKU, supplier, suggested reorder quantity, velocity context, and a due date, assigned to the buyer named on the supplier row.
- Posts one ranked digest in Slack with the top three SKUs inline and a link to the rest, or a one-line all-clear when nothing is at risk.
What do I need to use this?
- A MySQL database with an inventory table and an orders or order line items table, plus a buyer or owner name on each supplier.
- An Asana account with a Purchasing project (or any project you want the reorder tasks filed in).
- A Slack workspace and the channel where the morning digest should land, like #ops or #purchasing.
- A rough sense of your reorder point and days-of-cover threshold so the sweep matches how your team already thinks about restock.
How can I customize it?
- Change the schedule, the days-of-cover threshold, or the revenue window the ranking uses if your business is more or less seasonal.
- Point the Asana tasks at a different project, swap the assignee rule, or adjust the suggested reorder quantity formula to match your supplier minimums and lead times.
- Move the digest to a different Slack channel, expand the inline preview past the top three SKUs, or silence the all-clear message on quiet days.
Frequently asked questions
Do I need a specific inventory schema for this to work?
What if no SKUs are at risk on a given morning?
Can it assign the Asana task to the right buyer automatically?
Will this work with a cloud-hosted MySQL like AWS RDS or PlanetScale?
How is this different from the Amazon FBA restock alert?
Stop firefighting stockouts every Monday morning.
Connect MySQL, Asana, and Slack once, and Geni runs the restock sweep before your team logs on.