Appearance
A scheduled report
Build a flow that runs every morning, queries a MongoDB collection, formats a readable summary with the Template node, and emails you that the day's numbers are in. Then schedule it with cron and wire the tick that fires it.
What you'll build
1. Create the flow
Create a new flow file and lay out four nodes in a line:
Start → MongoDB → Template → Email → End
A scheduled run starts with no inputs, so everything the report needs comes from the nodes themselves.
2. Store your database connection as a secret
Never paste a connection string onto a node. Add a secret named DB_URI (your mongodb+srv://… string) and one named REPORT_TO (your email) in the secrets vault. You'll reference them as ${secrets.DB_URI} and ${secrets.REPORT_TO}.
3. Query your data (MongoDB node)
Configure the MongoDB node to read a single summary document — for example a metrics collection where you keep a rolling daily total:
| Field | Value |
|---|---|
| Connection | ${secrets.DB_URI} |
| Database | analytics |
| Collection | metrics |
| Operation | findOne |
| Query | { "day": "today" } |
| Result variable | result |
findOne returns one document, stored under the result variable. You can now read its fields elsewhere in the flow as result.orders, result.revenue, and so on. See MongoDB node for query interpolation with {{ }} placeholders and the other operations (find, insertOne, updateOne, deleteOne).
4. Format the summary (Template node)
The Template node builds a string from references. Set its template to something like:
<h2>Daily report</h2>
<p>Orders today: ${result.orders}</p>
<p>Revenue today: £${result.revenue}</p>${result.orders} and ${result.revenue} are pulled from the MongoDB result; ${secrets.X} and ${env.X} also resolve here. The rendered text is stored under the node's output variable (default text), so downstream it's available as text.value. See Template node.
5. Send the email
Configure the Email node:
| Field | Value |
|---|---|
| To | ${secrets.REPORT_TO} |
| Subject | Your daily report is ready |
| Body | The overnight report has run. Open Run history to see today's numbers. |
WARNING
The Email node resolves ${secrets.X} and ${env.X} in its fields but does not yet interpolate flow references like ${result.orders} or the Template's ${text.value} into the body. So today the email is a reliable daily nudge. To see the composed summary, open the run in Run history (it captures the trace of every node). To persist the summary instead, add a MongoDB insertOne step — its query template does interpolate refs via {{result.orders}} — and write a report row you can query later.
6. Schedule it with cron
Open the flow's trigger bar and use the Schedule button. Enter a standard 5-field cron expression — evaluated in UTC:
0 7 * * *That fires at 07:00 UTC every day. The fields are minute hour day-of-month month day-of-week, and support *, ranges (1-5), steps (*/15) and lists (1,15). See Scheduled (cron).
| Expression | Fires |
|---|---|
0 7 * * * | Every day at 07:00 UTC |
0 9 * * 1 | Mondays at 09:00 UTC |
*/30 * * * * | Every 30 minutes |
7. Wire the tick
Schedules only fire when something pings FlowRunner once a minute. Your platform operator sets a CRON_SECRET and points a timer at:
POST /api/cron/tick
Authorization: Bearer <CRON_SECRET>On each tick, FlowRunner runs every enabled schedule whose cron matches the current minute, and dedupes so a re-tick in the same minute never double-fires. Without CRON_SECRET, the endpoint is fail-closed and nothing runs. See Scheduled triggers wiring for the one-line setup.
8. Confirm it ran
Every scheduled run lands in Run history with method CRON — status, duration, and which node failed if one did. That's where you confirm the morning run happened and inspect the Template output.