How to Email a Daily Retail Store Performance Report for Pharmacy Managers
Build a Spojit workflow that runs every morning at open, gathers front-of-store sales and OTC retail numbers from Shopify and your point-of-sale system, computes the totals, and emails pharmacy managers a short plain-language digest.
What This Integration Does
Pharmacy retail managers usually start the day by logging into two or three separate systems to see how the front of store performed: the online store, the in-store point-of-sale (POS), and a stock screen for low over-the-counter (OTC) items. This workflow does that gathering for them. At opening time, Spojit pulls yesterday's front-of-store orders from Shopify and from your POS REST API, adds up the totals, ranks the busiest OTC categories, counts the items running low, and sends one tidy email so a manager can scan the numbers with their first coffee instead of clicking through dashboards.
A Schedule trigger fires the run on a fixed cron, so no one has to start it. A Parallel node fans out to both sales systems at once, math tools turn raw line items into totals and percentages, and a Connector node in Agent mode runs an agent that writes a few sentences of plain-language commentary. A Send Email node delivers the digest. The workflow only ever touches retail performance metrics: sales figures, category names, and stock counts. No clinical or patient data is read or sent. Each run is independent and stateless, so re-running it for the same day simply rebuilds the same report; nothing is written back to the stores.
Prerequisites
- A Shopify connection for your front-of-store online shop, with read access to orders and inventory. See the Shopify connector article for setup.
- An API key or token for your in-store POS system's REST API, reached through the http connector. Most pharmacy POS platforms have no native Spojit tile, so you call them honestly over HTTP. See how to connect to any REST API.
- The recipient manager email addresses added to your organization allowlist under Settings -> General -> Email recipients. See configuring the email allowlist.
- The IANA timezone your store opens in (for example
Australia/Sydney) so the report covers the correct trading day.
Step 1: Start with a Schedule trigger at opening time
On the canvas, add a Trigger node and set its type to Schedule. Schedule triggers use a 5-field Unix cron plus a timezone. To run at 7:00 every weekday morning, enter the cron 0 7 * * 1-5 and set the timezone to your store's zone, for example Australia/Sydney. The trigger output is simply { scheduledAt }, which you can use to stamp the report with the run time. If you have stores in two regions, add a second schedule to the same trigger rather than building a second workflow. For background, see setting up a schedule trigger.
Step 2: Fan out to both sales systems with a Parallel node
Add a Parallel node after the trigger. Parallel runs its branches concurrently, so the online store and the POS are queried at the same time rather than one after the other. Create two branches:
- Branch A - Shopify front-of-store orders. Add a Connector node in Direct mode on the shopify connector and pick the
list-orderstool. Filter to yesterday's completed orders by passing acreated_at_minandcreated_at_maxcovering the prior trading day, and request only the fields you need (totals and line items). Bind the output to a variable such asshopifyOrders. - Branch B - POS retail sales. Add a Connector node on the http connector and use the
http-gettool to call your POS reporting endpoint, passing your token in the header. Bind the output toposSales.
http-get
URL: https://api.your-pos.example.com/v1/sales/daily?date=2026-06-20&store=front
Headers:
Authorization: Bearer {{ env.POS_API_KEY }}
Accept: application/json
Because each branch reaches a different system, swap in your real POS host and query parameters. The Parallel node completes only when both branches finish. See using parallel nodes and the HTTP Requests connector article.
Step 3: Reshape both sources into one clean shape
The two systems return different JSON. Add a Transform node after the Parallel node to merge them into one predictable structure the rest of the workflow can read. Pull the order totals and line items out of {{ shopifyOrders }} and the POS register lines out of {{ posSales }}, and emit a single object with a flat lineItems array (each item carrying an amount and a category) plus a list of OTC stock levels. If you prefer tool-by-tool reshaping, the json connector tools pick, merge, and get can extract and combine fields without writing it all in one node. Bind the result to combined.
Step 4: Compute totals, top categories, and low-stock counts with math tools
Add a Connector node in Direct mode on the math connector to turn the combined line items into numbers a manager cares about. Use one math tool per figure:
sumover the line-item amounts in{{ combined.lineItems }}for the day's total front-of-store sales, thencurrencyto format it as money.averagefor the average basket value, androundto tidy it.percentageto express each OTC category's share of the day's takings, so you can rank the top sellers.
For low stock, read the inventory you pulled from Shopify with the get-inventory-levels tool (add it as another Direct-mode Connector node on the shopify connector if you did not include it in Step 2), then count how many OTC items fall below your reorder threshold. A Transform node or the array connector's filter plus length tools give you that count cleanly. Bind the figures to a variable such as metrics.
sum
values: {{ combined.lineItems[*].amount }}
currency
value: {{ sumResult }}
currency: AUD
Step 5: Write the plain-language summary with a Connector node in Agent mode
Add a Connector node and switch it to Agent mode. Agent mode runs an agent that reads your computed numbers and writes a short, readable digest instead of you hand-templating sentences. In the prompt, hand it the figures and ask for three or four sentences a busy manager can skim. To keep the output predictable for the email, set a Response Schema so the node returns structured JSON.
Prompt:
You are summarizing yesterday's front-of-store retail performance for a
pharmacy manager. Using only these numbers, write 3 to 4 plain sentences:
total sales {{ metrics.totalSales }}, average basket {{ metrics.avgBasket }},
top OTC categories {{ metrics.topCategories }}, low-stock items
{{ metrics.lowStockCount }}. Mention only retail and stock figures.
Response Schema:
{ "headline": "string", "summary": "string" }
Keep the prompt scoped to retail and stock numbers only, so no clinical or patient wording can appear. Bind the output to digest. For the difference between the two modes, see using connector nodes in Agent mode and choosing between Agent and Direct mode.
Step 6: Email the digest to managers with a Send Email node
Add a Send Email node, which sends from Spojit's built-in mail service with no extra connection. Fill in the fields:
- Recipients: your manager addresses, comma-separated, for example
front-manager@example.com, store-lead@example.com(each must be on the org allowlist). - Subject:
Daily retail report - {{ digest.headline }}. - Body: a plain-text template that drops in the numbers and the summary, for example the total sales, average basket, the ranked top categories, the low-stock count, and
{{ digest.summary }}. - If sending fails: choose Fail the workflow so a delivery problem shows up in your run history rather than passing silently.
If you would rather send from your own pharmacy domain, swap the Send Email node for a Connector node on the resend or smtp connector using its send-email tool. See using send email nodes.
Tips
- Keep the heavy lifting in Direct mode math and connector calls, and reserve Agent mode for the short written summary only: deterministic tools cost no AI credits, so you pay for the agent only on the few sentences of commentary.
- Compute the date window from
{{ scheduledAt }}with the date connector'ssubtractandstart-oftools so the report always covers "yesterday" no matter which day the schedule fires. - Ask Miraxa to scaffold the canvas for you with a prompt like "Add a Parallel node with a Shopify list-orders branch and an http http-get branch, then a math node and a Send Email node," and fine-tune each node's fields in the properties panel afterward.
- Send a single combined email rather than one per metric, so managers get exactly one message at open.
Common Pitfalls
- Timezone drift. If the cron timezone and your store's trading day disagree, the report can include the wrong day's orders. Set the IANA timezone explicitly on the Schedule trigger and build the date window in that same zone.
- Pagination. Busy stores return more orders than a single
list-orderspage. Page through results (or narrow the time window) so totals are not silently truncated. - Recipient allowlist. A Send Email node will not deliver to an address that is not on the org allowlist, and the email also counts toward your monthly allowance. Add every manager address first.
- Scope creep into clinical data. Keep the POS query and the Agent-mode prompt limited to sales, category, and stock figures. Do not pull or template prescription, diagnosis, or patient-record fields: this workflow is a retail performance digest only.
Testing
Before scheduling it, validate the workflow on a small scope. Temporarily replace the Schedule trigger with a Manual trigger and use the Run button so you can fire it on demand. Point the POS http-get at a single past date you know the numbers for, and narrow the Shopify list-orders window to that same day. Open the run in execution history and check each node's output: confirm the Parallel branches both returned data, the math figures match what you see in Shopify and the POS dashboard, and the Agent-mode digest reads cleanly and mentions only retail figures. Send the first email to your own address, confirm the formatting, then switch back to the Schedule trigger and add the real manager recipients.