Skip to main content
To act on this morning’s audit, from a sync, a chat post or a report, you first need to know it has finished. Darpan has no “audit ready” signal yet: no webhook, and no field that says the morning is done. Until there is one, poll auditReport for today’s date and wait until no check is left at notRun.

The request

Pass today’s date in the tenant’s time zone (report.tenant.timeZone). Do not leave date out here: until the audit’s scheduled time, a blank date returns yesterday’s finished report, which looks ready.

Read the answer

health.checks counts the audit’s configured checks for that morning: As each check finishes, it moves from notRun to ran or partial. The API cannot tell a check that has not started from one that failed: both are notRun. So pick a cutoff, a time by which every check has always finished on a normal morning. Before the cutoff, notRun means wait. After it, notRun means a real miss, and health.summary names the checks that did not run. Once notRun is 0, the morning is done. Then read health.complete: true means every read was complete; false means some counts may be short, as Check this morning’s audit explains.

A complete script

Run it from your scheduler a little after the audit’s scheduled time. It polls every five minutes and exits 0 when the morning is done, or 1 at the cutoff.
  • ran + partial > 0. An audit with no configured check has notRun at 0 from the start. The script treats that as not ready; health.summary says “No check is configured yet.”
  • Cost. Each poll costs about 35 points, far below the throttle. Polling more often than every few minutes does not get the answer sooner.

Next

When the script exits 0, run what depends on the morning: Post new findings to chat, Sync findings every day, or read the counts with Check this morning’s audit.