Adanos Asset Sentiment Drift Sentinel
Pull an asset's sentiment score from the Adanos API on a schedule, classify bearish or bullish drift against thresholds, and alert Slack on extremes.
Read overdue Zoho Books invoices every morning, change nothing, and alert Slack when customers are late or the overdue total crosses a limit.
For a small business, cash flow depends on customers paying on time, and Zoho Books marks an invoice overdue the day after its due date. Nobody gets paged, though: the overdue list only matters when someone opens it, and by then an invoice can be two months late. This blueprint turns a scheduled, read-only call to the Zoho Books API into a receivables gate: two io.kestra.plugin.core.http.Request tasks refresh an OAuth token and read overdue invoices, one jq query adds up the overdue balance, counts invoices past your warning and critical limits and finds the customer owing the most, and the result routes to a quiet log or a Slack alert.
refresh_access_token (io.kestra.plugin.core.http.Request) exchanges the long-lived refresh token for a short-lived access token at the Zoho Accounts server (/oauth/v2/token, grant_type=refresh_token). Defaults use the India data centre; change accounts_domain and api_domain for .com, .eu and others.list_overdue_invoices (io.kestra.plugin.core.http.Request) calls GET /books/v3/invoices with status=overdue, per_page=200 and sort_column=due_date, sending Authorization: Zoho-oauthtoken <token>. It needs only the ZohoBooks.invoices.READ scope and changes nothing. allowFailed plus allowFailure on both calls keep an API error from aborting the flow so it can be reported instead.summarize_receivables (io.kestra.plugin.core.debug.Return) first guards for a missing or non-200 response, then for a non-zero Zoho code (UNREACHABLE). Otherwise one jq query adds up balance, counts invoices whose due_date is at least warning_days and critical_days in the past, and finds the customer with the largest overdue balance. Any invoice past critical_days, or a total at or above critical_overdue_balance, is CRITICAL; any invoice past warning_days is WARNING; otherwise HEALTHY.route_by_receivables_state (io.kestra.plugin.core.flow.Switch) branches on that classification: HEALTHY logs quietly, WARNING posts a Slack note, CRITICAL and UNREACHABLE page Slack. A defaults fallback logs anything unexpected.log_audit_result (io.kestra.plugin.core.log.Log) writes one audit line per run with the HTTP status and the full summary.errors block pages Slack if the flow itself fails, and the morning_check trigger runs at 09:30 IST on weekdays, shipped disabled: true.status output (HEALTHY / WARNING / CRITICAL / UNREACHABLE) and an overdue_balance output other flows can use.Zoho Books can email payment reminders to customers, but it does not tell your own team when receivables are getting out of hand. Kestra handles the OAuth refresh, the read-only API call, the classification, retries, a failure path and an execution history in one flow, and the status output can hold back other spending flows while too much cash is overdue.
ZohoBooks.invoices.READ scope.ZOHO_CLIENT_ID and ZOHO_CLIENT_SECRET: the self client's credentials.ZOHO_REFRESH_TOKEN: refresh token for ZohoBooks.invoices.READ.ZOHO_BOOKS_ORGANIZATION_ID: the Zoho Books organization ID.SLACK_WEBHOOK: Slack incoming webhook used for every alert branch and the flow-failure alert.In Kestra OSS, secrets are supplied as environment variables prefixed SECRET_ and base64-encoded, for example SECRET_ZOHO_BOOKS_ORGANIZATION_ID=$(echo -n '60012345678' | base64), and read back with {{ secret('ZOHO_BOOKS_ORGANIZATION_ID') }}. Use the Enterprise secrets backend for encryption at rest and access control.
ZohoBooks.invoices.READ.POST /oauth/v2/token with grant_type=authorization_code) and store it with the client ID, client secret and organization ID as secrets.status should be WARNING, or CRITICAL if it is older than critical_days.morning_check.page while page_context.has_more_page is true.status=unpaid as well to forecast what falls due this week.warning_days, behind an approval step.warning_days: type INT, default 15.critical_days: type INT, default 60.critical_overdue_balance: type FLOAT, default 500000.0.status: one of HEALTHY, WARNING, CRITICAL, UNREACHABLE.overdue_balance: total unpaid balance of overdue invoices.{{ fromJson(outputs.summarize_receivables.value).top_customer }} for the customer owing the most..in, .com, .eu, .com.au, ...); a mismatch shows up as UNREACHABLE.critical_overdue_balance per currency or convert with exchange_rate.due_date is compared with today's date in the Kestra server's time zone; run Kestra in IST or adjust the limits by a day if that matters.