# Automate inventory replenishment and purchase orders: n8n workflow

> Started by a clock, and works across Email, Postgres and Slack. It hands the judgement calls to Mistral.

Source: https://millionrounds.com/workflow/automate-inventory-replenishment-and-purchase-orders (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [E-commerce](https://millionrounds.com/workflows?category=E-commerce#library)

# Automate inventory replenishment and purchase orders

Started by a clock, and works across Email, Postgres and Slack. It hands the judgement calls to Mistral. 18 steps, 1 branch: a working afternoon to understand properly.

Medium Calls a model: Mistral

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomate-inventory-replenishment-and-purchase-orders)

**18 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 1 Model 4 Logic 6 Service 7

The steps in the order they run, from what starts it.

- 1 **Run inventory check every 6 hours** Schedule trigger *Starts it*
- 2 **Tool: Get supplier catalog** Tool Workflow *Model*
- 3 **Tool: Check budget availability** Tool Workflow *Model*
- 4 **Mistral AI language model** Lm Chat Mistral Cloud *Model*
- 5 **Query ERP for low stock items** Postgres *Service*
- 6 **Generate optimized purchase orders with Mistral AI** Agent *Model*
- 7 **Fetch 90-day sales velocity data** Postgres *Service*
- 8 **Parse and validate AI response** Code *Logic*
- 9 **Combine stock and sales data** Merge *Logic*
- 10 **Route based on approval criteria** If *Logic*
- 11 **Calculate sales velocity and stockout risk** Code *Logic*
- 12 **Insert approved POs into ERP database** Postgres *Service*
- 13 **Flag for manager approval** Set *Logic*
- 14 **Update inventory with pending orders** Postgres *Service*
- 15 **Group purchase orders by supplier** Code *Logic*
- 16 **Email purchase order to supplier** Email Send *Service*
- 17 **Create audit log for compliance** Postgres *Service*
- 18 **Send summary notification to Slack** Slack *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 18, with 1 branch
- **Size:** Medium: a working afternoon
- **Connects to:** Email, Postgres, Slack
- **Model:** Mistral

## Questions

What does it need to run?

An n8n account, plus your own Email, Postgres and Slack accounts, and a key for Mistral. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

Yes. It calls Mistral. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 18 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 18 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomate-inventory-replenishment-and-purchase-orders)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Email](https://millionrounds.com/workflows?service=Email#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)[Slack](https://millionrounds.com/workflows?service=Slack#library)

## Workflows like it

Also e-commerce, with the same services where possible, closest in size first.

- [**Generate Shopify review outreach drafts with Apify and Hunter** 18 steps · calls a model · Apify, Gmail](https://millionrounds.com/workflow/generate-shopify-review-outreach-drafts-with-apify-and-hunte)
- [**Monitor Shopify low-stock items with OpenAI and Google Sheets** 18 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/monitor-shopify-low-stock-items-with-openai-and-google-sheet)
- [**Calculate Shopify variant prices from Google Sheets with Slack** 18 steps · Google Sheets, Slack](https://millionrounds.com/workflow/calculate-shopify-variant-prices-from-google-sheets-with-sla)
- [**Cart abandonment pro automation with Google Sheets and Slack** 18 steps · Email, Google Sheets](https://millionrounds.com/workflow/cart-abandonment-pro-automation-with-google-sheets-and-slack)
- [**Detect WooCommerce order fraud and send alerts to Slack** 18 steps · Slack, WooCommerce](https://millionrounds.com/workflow/detect-woocommerce-order-fraud-and-send-alerts-to-slack)
- [**Generate AI inventory reorder recommendations from Airtable** 17 steps · calls a model · Airtable, Asana](https://millionrounds.com/workflow/generate-ai-inventory-reorder-recommendations-from-airtable)
