Automation library · E-commerce

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.

MediumCalls a model: Mistral

18 stepsMedium: a working afternoon
1Branch: places the flow splits
0Loops or waits
3Services it connects to

The flow

Starts it 1Model 4Logic 6Service 7

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

  1. 1Run inventory check every 6 hoursSchedule triggerStarts it
  2. 2Tool: Get supplier catalogTool WorkflowModel
  3. 3Tool: Check budget availabilityTool WorkflowModel
  4. 4Mistral AI language modelLm Chat Mistral CloudModel
  5. 5Query ERP for low stock itemsPostgresService
  6. 6Generate optimized purchase orders with Mistral AIAgentModel
  7. 7Fetch 90-day sales velocity dataPostgresService
  8. 8Parse and validate AI responseCodeLogic
  9. 9Combine stock and sales dataMergeLogic
  10. 10Route based on approval criteriaIfLogic
  11. 11Calculate sales velocity and stockout riskCodeLogic
  12. 12Insert approved POs into ERP databasePostgresService
  13. 13Flag for manager approvalSetLogic
  14. 14Update inventory with pending ordersPostgresService
  15. 15Group purchase orders by supplierCodeLogic
  16. 16Email purchase order to supplierEmail SendService
  17. 17Create audit log for compliancePostgresService
  18. 18Send summary notification to SlackSlackService

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.