Skip to content

Alerting low-margin products via Slack every morning

This use case illustrates a concrete use of the Biron plugin in Zapier. If you are not yet familiar with how it works (authentication, query structure, variable management), please read the Biron × Zapier guide first before continuing.


A Zap that triggers every morning and sends a Slack alert if products sold the previous day show an insufficient margin rate. The goal: immediately detect pricing anomalies or overly aggressive promo codes before they weigh on results.

The Slack message is composed of two parts:

  • A summary message in the channel: number of affected SKUs, broken down by severity level
  • A thread reply: the full detail of each SKU, sorted from most critical to least critical

Schedule → Date calculation → Product query → Formatting → Slack (channel) → Slack (thread)

Configure a Schedule by Zapier block:

  • Frequency: Every Day
  • Time: 9:00 AM

Biron queries require explicit dates. This block dynamically generates yesterday’s date on each run.

Add a Code by Zapier block (Python). Use the following prompt to generate the code, then paste the result into the block:

Role: Python expert for Zapier.
Goal: Create a relative date calculation script.
Calculate the following date, handling calendar edge cases
(leap years, end of month):
- Yesterday
Output: return an "output" dictionary with the date in YYYY-MM-DD format.

Create a table-type chart in Biron with SKU as the dimension and margin rate as the metric. Apply a result filter to keep only rows with a margin rate below 0.45 (45%).

Copy the generated NexusQL and paste it into the Biron Query block in Zapier. Replace the static date with the yesterday variable produced in the previous step.


Biron data must be converted into readable Slack messages. This block produces two distinct texts: a summary and a detail.

SKUs are classified into three categories based on their margin rate:

CategoryThresholdEmoji
CriticalNegative margin rate🔴
LowBetween 0% and 30%🟠
MediumBetween 30% and 45%🟡

Add a Code by Zapier block (Python) and use this prompt to generate the formatting code:

Role: Python expert for Zapier.
Goal: Format data for a Slack alert message.
Available inputs:
- SKU
- Margin rate
Request:
1. Calculate the total number of SKUs provided.
2. Categorize each SKU by its margin rate:
- Critical: negative margin rate
- Low: between 0% and 30%
- Medium: between 30% and 45%
3. Generate a concise Slack-formatted alert message indicating
the total number of affected SKUs and their breakdown by category.
Do not display a category if it contains no SKUs.
4. Generate a second Slack-formatted message listing all affected SKUs,
sorted from most critical to least critical, with for each line:
Category emoji | SKU | Margin rate
Categories are represented by circle emojis: 🔴 Critical, 🟠 Low, 🟡 Medium.

Add a first Slack block and configure:

  • Channel: the channel where the alert should be sent
  • Message Text: the summary message produced by the formatting block

Add a second Slack block to post the full list as a reply to the first message:

  • Channel: the same channel as the previous step
  • Message Text: the detailed message produced by the formatting block
  • Thread: insert the Ts variable from the previous Slack block

Every morning at 9 AM, if any products show an insufficient margin rate, your team receives a structured Slack alert: an immediately readable summary in the channel, and the full detail accessible in thread to avoid cluttering the main feed.

If no product triggers the filter, the Zap produces no message.