Scheduled automation × message push

Scheduled Report Push Bot

Every Monday morning, a scheduler on an internal server produces five operations reports, converts them to PDF and pushes them to a group through a messaging platform API. The five report lines are independent. A config file or command-line argument sets the run scope, and the run log summary lists the items that ran and the items that were skipped.

5 report linesIndependent, each can be switched on or off
Every Monday 08:00Server schedule, unattended
5 stepsRead data / produce / convert to PDF / upload / push

Terms

Report line

The full process for one report, from reading data to pushing it. Each of the five reports is one line, and lines do not share intermediate results.

Allowlist

The list of items to run in this execution. Items outside the list do not run and are marked as skipped in the log.

Upload switch

Controls whether the PDF is sent to the messaging platform. When off, files are produced locally only and no message is sent to the group.

Problem

Before

  • Every Monday, staff run the five reports in sequence, convert them to PDF and send them to the group by hand.
  • During system tests, all five lines run as one round, which takes over ten minutes. When the upload step fails, the whole round is rerun.
  • When only some items run, the summary can still read "all succeeded".

After

  • The server scheduler runs automatically on Monday morning, and run logs are kept on the server.
  • The config file switches each line on or off, and a command-line argument runs only the specified items. A name not in the list raises an error immediately, and the valid names are listed.
  • The summary table lists the items that ran and the items that were skipped. When any item is skipped, the conclusion reads "N items that ran succeeded, M items did not run".

Workflow

1Read dataQueries the database with a read-only account to get the current week's data.
2Produce reportApplies the report template and fills in the current week's data and period.
3Convert to PDFCalls office software in headless mode to convert the file and checks that the file was created.
4UploadWhen the upload switch is on, sends the PDF to the messaging platform's file API. Off by default.
5PushSends a message to the group using the file ID and writes to the run log.

Interactive demo: run one schedule round

Scheduled run simulationReports and figures are synthetic examples; one round has already run with the default settings on page load

Config file: report lines

Command-line arguments

Run log
Message screen illustration
Operations reports group
No messages yet
Run summary
—
Equivalent command line: python run.py Items disabled in the config file do not run even when listed in --only.

Outcome and technology

Test entry point

A command-line argument or the config file specifies the items to run. When the upload step fails, only that item is rerun.

Input validation

An unrecognized item name raises an error immediately and lists the valid names. It is not ignored silently.

Verifiable log

The summary table lists the execution, skip status and duration of each item. When only some items run, the conclusion does not read "all succeeded".

PythonMessaging APIWindows Task SchedulerLibreOffice headless conversionSQL ServerConfig file allowlist