Skip to main content

Recurring order proposal agent

Shows the products the company you are viewing buys almost every week but has not ordered yet this week, and creates a draft quote for them when you answer yes. This is the on-demand version of Recurring order proposals.

Runs: Embedded in Propeller · Trigger: Button · Difficulty: Easy

What you need​

  • An n8n account. See Set up n8n.
  • A Propeller API key.
  • Owner access on the Configuration role to create the agent.

How it works​

When you run the agent on a company page, the workflow 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, and not 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 reply lists the products and asks whether to create a draft quote. Answer yes and the agent creates the quote for the contact who placed the company's latest order, with the status in QUOTE_STATUS (default DRAFT_QUOTATION). Answer no and nothing happens. When there is nothing to propose, the agent says why.

Install it​

  1. In n8n, import the downloaded JSON as a new workflow.
  2. On the Webhook node, set a basic auth credential (a username and password you choose) and copy the production URL.
  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 and CHANNEL_ID to the channel quotes are created in.
  5. Activate the workflow.
  6. Go to Admin > Agents and create an agent with Trigger Button and Interaction Mode Multi Turn. Under Types, pick SALES_HUB_COMPANY. Paste the webhook URL and the same basic auth values. See AI Agents.
  7. Open a company, click the Workflows button and run the agent to test it.
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.

Placement matters

An agent type is the page where the agent appears. Stick to the types listed in the install steps: the workflow depends on the data that page sends along, so placing the agent on other pages may not work.

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 and the answers: QUOTE_STATUS, MAX_LINES and LANGUAGE (of the answers, product names and quote remarks: EN, the default, or NL) in Settings.

Limits​

A company with more than 2,000 orders in the history window gets no proposal (MAX_HISTORY_PAGES). A proposal has at most 40 lines.

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.