Skip to main content

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​

  1. 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 as yes or ja works. See Attributes.
  2. In n8n, import the downloaded JSON as a new workflow.
  3. Create a header auth credential with your Propeller API key and select it on the GraphQL nodes.
  4. In the Settings node, set PURCHASE_STATUSES to every order status that counts as a purchase in your environment, CHANNEL_ID to the channel quotes are created in and ASSIGN_TO_ADMIN_USER_ID to the backoffice user who gets the tickets.
  5. Set DRY_RUN to true and run the workflow once manually. The Record Outcome node shows the proposal or the reason per company, without creating anything.
  6. Set DRY_RUN back to false and activate the workflow.
Filling in your API key

In n8n, create a credential of type Header Auth and fill in its two fields exactly like this:

FieldWhat to fill in
NameapiKey
ValueYour 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_DAYS and RECENT_GRACE_DAYS in Settings.
  • The quote: QUOTE_STATUS, MAX_LINES and LANGUAGE (of the product names and remarks: EN, the default, or NL) in Settings.
  • The week: TIMEZONE sets 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.

Good to know

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.