New to Kestra?
Use blueprints to kickstart your first workflows.
Check PayFit payroll completion status, alert Slack only if still not completed past a deadline day, and log the result for HR and Finance.
A payroll run that is still not_completed the day before payday is a problem that affects
real paychecks, but PayFit's own interface has no alert for it, someone has to remember to
open the company's payroll status page. This blueprint checks the status directly with
io.kestra.plugin.payfit.company.GetPayrollStatus and only pages when the period is actually
overdue, not every day the payroll happens to still be in progress.
This blueprint was created by Mohit Jeswani.
check_payroll_status (io.kestra.plugin.payfit.company.GetPayrollStatus) fetches the
status (completed or not_completed) and execution end timestamp for pay_period.
Read-only; nothing in PayFit is started or changed. allowFailure: true covers an API or
auth error without failing the flow outright.evaluate (io.kestra.plugin.core.output.OutputValues) classifies the result:
completed is always OK. not_completed is only CRITICAL once today's date reaches
deadline_day_of_month for pay_period's month, otherwise it is still OK, since a
payroll that simply hasn't run yet this period is normal, not a problem.
check_payroll_status failing outright is also CRITICAL.route (io.kestra.plugin.core.flow.If):summary logs the status and severity, closing the governance cycle.errors alerts Slack if the flow itself fails, for example an expired API key.company.GetPayrollStatus used on its own as a governance check.PayFit's payroll status is a page someone has to remember to open; it has no scheduled check
and no alert of its own. Kestra keeps deadline_day_of_month as a flow input instead of
institutional memory, turns the status into a Slack page the moment it is actually overdue,
and keeps a full execution history of every check, completed or not.
auth.AccessToken.This flow calls the PayFit Partner API directly over HTTPS; there is no official local PayFit
emulator, so check_payroll_status cannot be exercised against a local Docker container.
Use a PayFit sandbox/test company to validate this end to end.
PAYFIT_API_KEY: the PayFit API key or OAuth access token used by check_payroll_status.
In Kestra OSS, provide it as the base64-encoded environment variable SECRET_PAYFIT_API_KEY.SLACK_WEBHOOK_URL: used by alert and the errors block. In Kestra OSS, provide it as
the base64-encoded environment variable SECRET_SLACK_WEBHOOK_URL.| Input | Default | Purpose |
|---|---|---|
pay_period |
202609 |
Payroll period to check, YYYYMM |
company_id |
empty | PayFit company ID, resolved from the API key when empty |
deadline_day_of_month |
25 |
Day of the month not_completed becomes CRITICAL |
{{ outputs.check_payroll_status.status }}: completed or not_completed.{{ outputs.check_payroll_status.completed }}: boolean convenience flag.{{ outputs.check_payroll_status.executionEndDate }}: completion timestamp, null while not
completed.{{ outputs.evaluate.values.severity }}: OK or CRITICAL.deadline_day_of_month is compared against today's date within the target pay period;
setting a deadline past the last calendar day of shorter months will not evaluate to
CRITICAL until the next calendar month begins.GetPayrollStatus reports on exactly the pay_period you ask for. Checking last month's
period after this month has already started tells you nothing about the current period.companyId left empty costs one extra PayFit token-introspection call per run; set it
explicitly once you know it to skip that round trip.PAYFIT_API_KEY and SLACK_WEBHOOK_URL secrets.pay_period set to a period you know is already completed
and confirm compliant logs it.pay_period to the current period and deadline_day_of_month to a day already passed
this month to confirm alert fires if that period is still not_completed.daily trigger, which always checks the current calendar month.company_id values with io.kestra.plugin.core.flow.Loop to watch every
legal entity in one scheduled run.io.kestra.plugin.core.flow.If) that logs a
lower-severity reminder a few days before deadline_day_of_month, without paging Slack.io.kestra.plugin.payfit.payslips.List after a completed result to confirm payslips
were actually generated for every collaborator, not just that PayFit's own status flipped.