Invoice OverdueInvoiceTrigger

Invoice OverdueInvoiceTrigger

Certified

Trigger a flow when QuickBooks invoices become overdue

Polls the QuickBooks query API for invoices matching Balance > '0' AND DueDate < '<today>' (today in UTC) and starts an execution for the ones not reported yet. An invoice is reported once while it stays overdue and is not reported again on later polls.

A polling trigger starts at most one execution per evaluation. With BATCH that execution holds every new overdue invoice. With PER_INVOICE it holds the oldest not yet reported one, and the next ones follow on the next evaluations, so use a short interval when many invoices can become overdue at once.

The reported invoice ids are stored in the namespace KV store, only after the execution has been built, and are dropped once the invoice is no longer overdue. All overdue invoices are loaded in memory on every poll.

yaml
type: io.kestra.plugin.quickbooks.invoices.OverdueInvoiceTrigger

Send one daily batch of newly overdue invoices

yaml
id: qbo_overdue_invoices
namespace: company.finance

triggers:
  - id: overdue
    type: io.kestra.plugin.quickbooks.invoices.OverdueInvoiceTrigger
    clientId: "{{ secret('QBO_CLIENT_ID') }}"
    clientSecret: "{{ secret('QBO_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('QBO_REFRESH_TOKEN') }}"
    realmId: "{{ secret('QBO_REALM_ID') }}"
    mode: BATCH
    interval: P1D

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ trigger.count }} invoice(s) overdue, up to {{ trigger.daysOverdue }} day(s)"

Start one execution per overdue invoice, checking every hour

yaml
id: qbo_overdue_invoice_reminder
namespace: company.finance

triggers:
  - id: overdue
    type: io.kestra.plugin.quickbooks.invoices.OverdueInvoiceTrigger
    clientId: "{{ secret('QBO_CLIENT_ID') }}"
    clientSecret: "{{ secret('QBO_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('QBO_REFRESH_TOKEN') }}"
    realmId: "{{ secret('QBO_REALM_ID') }}"
    mode: PER_INVOICE
    interval: PT1H

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Invoice {{ trigger.invoices[0].DocNumber }} is {{ trigger.daysOverdue }} day(s) overdue"
Properties

QuickBooks Client ID

QuickBooks Client Secret

QuickBooks Realm ID

QuickBooks Refresh Token

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Defaulthttps://oauth.platform.intuit.com/oauth2/v1/tokens/bearer

OAuth Token URL

The OAuth2 token endpoint. Must be an intuit.com domain.

Defaulthttps://quickbooks.api.intuit.com

Base URL

The Base URL for QuickBooks API. Must be an intuit.com domain. Defaults to production.

DefaultP1D
Formatduration

Polling interval

How often the trigger should look for overdue invoices.

Default75

Minor Version

The minor version of the QuickBooks API to use. Must be 1 or more, checked after rendering.

DefaultBATCH
Possible Values
BATCHPER_INVOICE

Execution mode

  • BATCH: one execution with all newly overdue invoices in invoices.
  • PER_INVOICE: one execution per invoice, invoices holds a single invoice. Executions are created one per evaluation, oldest due date first.
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

Count

The number of invoices in invoices.

Days overdue

The number of days past due date, for the most overdue invoice of invoices (UTC, never negative).

SubTypeobject

Invoices

The overdue invoices of this execution, oldest due date first, as returned by QuickBooks.