Querying store performance in natural language from Slack
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.
What we’re building
Section titled “What we’re building”A Zap that triggers when a user adds a specific reaction to a Slack message. The Zap retrieves the message, queries pre-existing Biron charts to get store performance data, then submits the question to an LLM which replies directly in thread.
Preparing Biron charts in advance allows the context provided to the LLM to focus on structured, controlled data — which significantly reduces the risk of hallucinations.
Zap architecture
Section titled “Zap architecture”Slack (reaction) → Date calculation → Store query → Store × product family query → Formatting → LLM → Slack (thread)Trigger — Slack “New Reaction Added”
Section titled “Trigger — Slack “New Reaction Added””Add a Slack → New Reaction Added block and configure:
- Channel: the channel where the Zap will be active
- Reaction: the emoji reaction that triggers the Zap
Date calculation
Section titled “Date calculation”Biron queries require explicit dates. This block generates them dynamically 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 dates, handling calendar edge cases(leap years, end of month):- Start of previous week- End of previous week- Start of current week- Today
Output: return an "output" dictionary with all dates in YYYY-MM-DD format.Store query
Section titled “Store query”Create a table-type chart in Biron per store with the following metrics, then copy the NexusQL and paste it into the Biron Query block. Replace the static dates with the variables produced in the previous step.
| Metric | Current week | W-1 comparison |
|---|---|---|
| Product Revenue excl. VAT | ✓ | ✓ |
| Product Margin excl. VAT | ✓ | ✓ |
| Product Margin Rate after Discounts | ✓ | ✓ |
| Number of Invoiced Orders | ✓ | ✓ |
| Number of Distinct Customers | ✓ | ✓ |
Store × product family query
Section titled “Store × product family query”Same principle: create a Biron chart per store and product family, copy the NexusQL, paste it into a second Biron Query block and replace the dates.
| Metric | Current week | W-1 comparison |
|---|---|---|
| Product Revenue excl. VAT | ✓ | ✓ |
| Product Margin excl. VAT | ✓ | ✓ |
| Number of Products Sold | ✓ | ✓ |
Formatting for the LLM
Section titled “Formatting for the LLM”Biron data must be converted into structured JSON before being submitted to the LLM. This block produces two distinct JSON objects, one per query.
Add a Code by Zapier block (Python) and use this prompt to generate the code:
Role: Python expert for Zapier.Goal: Format data for LLM consumption.
Available inputs:Store query:- [List the dimensions and metrics retrieved here]Store × product family query:- [List the dimensions and metrics retrieved here]
Request:Produce two JSON objects optimized for LLM consumption,one for each input query.LLM — Gemini
Section titled “LLM — Gemini”Add the Gemini block and fill in two inputs:
System instructions — the immutable agent framework, to copy as-is:
### ROLEYou are the company's Expert Data Analyst. Your mission is to extractprecise information from the provided dataset to answer a questionposted on Slack.
### CRITICAL INSTRUCTIONS1. ANALYSIS: Carefully examine whether the provided data contains a direct answer or the elements needed to calculate it.2. TRUTH: NEVER make assumptions. If information is missing, do not attempt to estimate.3. CONCISENESS: Your response should be concise in general, but long enough to be complete.4. TONE: Professional, factual, and direct. No unnecessary pleasantries.5. OUTPUT: The response must be in Slack message format with appropriate formatting.
### MANDATORY RESPONSE PROTOCOL- IF the answer is present: give the result clearly.- IF the data is insufficient or the question is off-topic, respond exactly: "I am not able to process the question with the data currently available. My scope covers store performance analysis for the week."- IF the question is about your scope, respond: "My scope covers store performance analysis for the week."User prompt — to build dynamically by linking Zapier variables:
### DATASET (CONTEXT)Global values for each store:[Insert Store JSON]
Values per store × product family:[Insert Store × Family JSON]
### USER QUESTION[Insert the content of the Slack message that triggered the Zap]Reply — Slack (thread)
Section titled “Reply — Slack (thread)”Add a Slack block and configure to post the LLM’s response in thread on the original message:
- Channel: the same channel as the trigger
- Message Text: the response produced by the Gemini block
- Thread: insert the
Tsvariable from the triggering message
Expected result
Section titled “Expected result”When a user adds the configured reaction to a message in the channel, the Zap analyzes the question, queries the store performance data, and replies directly in thread with a structured analysis — without leaving Slack.
If the question is outside the scope of the available data, the LLM explicitly says so rather than approximating.