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
- 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 andASSIGN_TO_ADMIN_USER_IDto the backoffice user who gets the ticket. - Run the workflow once manually and review the ticket in the Action Hub.
- Activate the workflow. Switch
MODEto'create'once the proposals look right.
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 pair counts:
MIN_COMPANIES,MIN_CONFIDENCEandHISTORY_DAYSin Settings. - The relations:
RELATION_TYPE(ACCESSORIES,ALTERNATIVES,OPTIONS,PARTSorRELATED) andMAX_RELATIONS_PER_PRODUCTin 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.
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
- Cross-sell assistant - an AI agent that proposes relations for one product
- Action Hub