Skip to content

Documentation

Morning Report: Catalog, Supplier Mail, and Price Comparison

A daily workflow connects a 05:00 catalog crawl, supplier mail normally received around 06:00, and a comparison starting after 07:00. All times are Moscow time. Missing inputs may be awaited until 08:00. An incomplete crawl or unchecked message cannot authorize a report.

Prepare the sources

Create a catalog source and a separate report source. Catalog fields: string sku, decimal price, string currency. Report fields: string sku, currency, best_source; decimal best_price; boolean complete; JSON prices. Use SKU as the record key. Both inputs must explicitly identify their currency. The same SKU must represent the same item and sales unit; otherwise supply a mapping before comparison.

Prepare the scenarios

The catalog scenario fetches one HTML table, calls ai()->extract() and emits records. Future runs reuse a validated recipe. JSON and document sources can use the corresponding SDK readers. Technical example: resources/workflows/catalog-prices.php.

The report scenario reads catalog and supplier, selects one CSV/XLSX attachment, extracts the supplier table and calls sources()->comparePrices(). Example: resources/workflows/daily-price-report.php. Test and publish both scenarios through the normal publication process.

Configure mail and timing

Create an inbound address, preferably restrict it to the supplier, and choose a literal bracketed subject marker. A technical administrator configures the workflow using its source codes, published scenarios, address UUID, marker and timing window. Configuration also creates the 05:00 crawl schedule and a CSV delivery after successful comparison. A visual workflow editor is not available yet.

At 07:00 the coordinator checks all required inputs. The catalog needs a clean complete run started after 05:00 that day. Mail must have arrived after 06:00, passed checks and remain available. Until 08:00 checks repeat once per minute without holding a sandbox worker. Mail receipt time comes from the system, not the sender's Date header.

Once ready, the workflow pins the exact crawl and message. Duplicate ticks do not create a second report for that workflow/day. Revoked mail or a changed crawl stops execution before input access. A workflow still waiting at 08:00 expires without a report. The CSV includes only current-run records, excluding yesterday's entries retained by ordinary missing-item handling.

Read the result

best_source identifies the lowest price across all configured sources. A missing pair has complete=false, empty best_source and empty best_price. It does not claim that the only observed seller is the cheapest. Report completion and file delivery have separate statuses: verify the export history before considering the file delivered. Daily workflows follow normal scheduling plan limits and execution billing.

Test before publication

Run the report scenario as a trial using parameters from resources/workflows/daily-prices.preview.json. The parameters contain a sample catalog and a small CSV price list. The trial reads only supplied examples, cannot access real mail and does not write production records. Publish the scenario after a successful trial, then configure the daily workflow.

A catalog input requires a standalone full crawl. A resumed or retried crawl may contain only the remaining portion and is not treated as a complete fresh catalog.