Skip to main content

Contract margin guard

Audits your product-level price agreements against current cost and flags the ones selling below a margin floor, so input-cost creep does not quietly eat your margin. It runs automatically every week.

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

Scope: product discounts only

This workflow checks product-specific discount lines. Discounts set on a category or a price group are out of scope and are not audited. If your catalogue is priced mainly by category, most agreements will not be checked.

What you need

  • An n8n account. See Set up n8n.
  • A Propeller API key that can read pricing and create tickets.
  • The Action Hub, where the tickets land.

How it works

Every Monday at 06:00 the workflow reads your price sheets, the discount lines on them (the agreement lines) and a representative customer for each sheet. For every active, product-specific line it asks the platform what that customer actually pays and what the product costs, then computes the margin as (price - cost) / price.

Lines below the floor (15% by default) are grouped by price sheet, worst margin first. The workflow creates one Action Hub ticket per flagged sheet, naming the customer, how many lines are thin and the worst SKU with its price, cost and margin. The ticket links to the customer so an account manager can open it and renegotiate.

It skips sheets that already have an open margin ticket, so you never get duplicates. It also creates at most 15 tickets per run.

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 every HTTP Request node.
  3. In the Flag & Build Tickets node, set FLOOR to your margin floor and DEFAULT_ADMIN_USER_ID to the user who should get the tickets.
  4. Run the workflow once manually and check the Action Hub.
  5. 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

  • The margin floor: change FLOOR in the Flag & Build Tickets node.
  • The per-run cap: MAX_TICKETS_PER_RUN (default 15) limits how many tickets one run creates.
  • Out of scope: category and price-group discounts are not audited. Adding them means expanding each category into its products with an authoritative category query, a larger change rather than a config tweak.
  • When it runs: the Schedule Trigger runs weekly. Change it to run more or less often.
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.