Recurring order proposals
Every Monday, finds the products a company buys almost every week but has not ordered yet this week, and puts them on a draft quote with a ticket in the Action Hub. A sales rep reviews the quote and sends it to the customer.
Runs: Outside Propeller · Trigger: Schedule · Difficulty: Medium
What you need
- An n8n account. See Set up n8n.
- A Propeller API key.
- A company attribute that switches the proposal on per company.
How it works
The workflow runs for every company whose attribute RECURRING_ORDER_PROPOSAL is set to yes. It reads the company's orders of the last 13 weeks, only in the statuses listed in PURCHASE_STATUSES.
A product is proposed when the company bought it in at least 4 different weeks and in at least half of the weeks it ordered at all. It is left out when the company already bought it this week or in the last 3 days. The quantity is the median weekly quantity, raised to the product's minimum quantity. No AI is involved: the same order history always gives the same proposal.
Only orderable products with a price for the customer go on the quote. The quote gets the contact who placed the company's latest order, the status in QUOTE_STATUS (default DRAFT_QUOTATION) and remarks that explain why each product is on it. A company that already got a proposal this week is skipped, so running the workflow twice does not double it.
Install it
- In Admin > Attributes, on the Company tab, create an attribute named
RECURRING_ORDER_PROPOSAL. Set it to yes on the Attributes tab of each company that wants a weekly proposal. A text value such asyesorjaworks. See Attributes. - In n8n, import the downloaded JSON as a new workflow.
- Create a header auth credential with your Propeller API key and select it on the GraphQL nodes.
- In the Settings node, set
PURCHASE_STATUSESto every order status that counts as a purchase in your environment,CHANNEL_IDto the channel quotes are created in andASSIGN_TO_ADMIN_USER_IDto the backoffice user who gets the tickets. - Set
DRY_RUNtotrueand run the workflow once manually. The Record Outcome node shows the proposal or the reason per company, without creating anything. - Set
DRY_RUNback tofalseand activate the workflow.
In n8n, create a credential of type Header Auth and fill in its two fields exactly like this:
| Field | What to fill in |
|---|---|
| Name | apiKey |
| Value | Your Propeller API key |
Name is not a title you pick yourself. It has to say exactly apiKey, otherwise the workflow cannot sign in. See Set up n8n for the full steps.
Make it yours
- When a product counts as recurring:
MIN_WEEKS_PRESENT,MIN_WEEK_RATIO,HISTORY_DAYSandRECENT_GRACE_DAYSin Settings. - The quote:
QUOTE_STATUS,MAX_LINESandLANGUAGE(of the product names and remarks:EN, the default, orNL) in Settings. - The week:
TIMEZONEsets when the week starts. The schedule runs on Monday at 07:00.
Limits
A company with more than 2,000 orders in the history window is skipped (MAX_HISTORY_PAGES). A proposal has at most 40 lines.
A run that takes longer than one hour is stopped and shows as canceled in the n8n executions list.
Use it outside n8n
Copy the JSON into an AI assistant and follow Adjust a workflow with an AI assistant.
The workflows and agents in the Agent Hub are free to use and adapt. They are examples, not supported product features, so test them in a staging environment and check the results before using them in production.
Related pages
- Recurring order proposal agent - the same proposal for one company, on request
- Action Hub