Skip to main content

Cross-sell relations from order history

Once a month, finds products that different companies buy together in one order and proposes them as cross-sell relations in a ticket. When you trust the proposals, switch it to create the relations itself.

Runs: Outside Propeller · Trigger: Schedule · Difficulty: Medium

What you need​

  • An n8n account. See Set up n8n.
  • A Propeller API key.

How it works​

On the first of every month the workflow reads the orders of the last 180 days, only in the statuses listed in PURCHASE_STATUSES. Product A gets a relation to product B when:

  • at least 3 different companies bought A and B in one order, and
  • at least 20% of the orders with A also had B.

Each product gets at most 5 new relations, the strongest first. Pairs that already have a relation (also between their clusters), variants of the same cluster and products that are no longer orderable are left out. No AI is involved: the counts decide.

With MODE set to 'propose' (the default) the workflow creates one ticket in the Action Hub with the proposed relations. With MODE set to 'create' it creates them as RELATED relations and the ticket lists what was created.

Install it​

  1. In n8n, import the downloaded JSON as a new workflow.
  2. Create a header auth credential with your Propeller API key and select it on the GraphQL nodes.
  3. In the Settings node, set PURCHASE_STATUSES to every order status that counts as a purchase in your environment and ASSIGN_TO_ADMIN_USER_ID to the backoffice user who gets the ticket.
  4. Run the workflow once manually and review the ticket in the Action Hub.
  5. Activate the workflow. Switch MODE to 'create' once the proposals look right.
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 pair counts: MIN_COMPANIES, MIN_CONFIDENCE and HISTORY_DAYS in Settings.
  • The relations: RELATION_TYPE (ACCESSORIES, ALTERNATIVES, OPTIONS, PARTS or RELATED) and MAX_RELATIONS_PER_PRODUCT in Settings.
  • Large orders: orders with more than 30 product lines are left out (MAX_LINES_PER_ORDER), because they pair everything with everything.

Limits​

The newest 20,000 orders of the window are read (MAX_PAGES). A run creates at most 500 relations (MAX_CREATE); the rest follow in the next run. The ticket lists the strongest 30.

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.