OpenClaw Integration
Example Workflows
Practical agent workflow examples using the NextPay CLI
Example Workflows
Here are common automation workflows you can build with an AI agent and the NextPay CLI.
Daily payout report
An agent that runs daily and generates a summary of payout activity:
Prompt: "Generate a daily payout report for the Finance workspace."
Agent steps:
1. nextpay --env prod auth status
→ Confirm authenticated, check active workspace
2. nextpay --env prod audit list --action disbursement.created --limit 100
→ Get today's payout activity
3. Summarize the data: total payouts, total amount, success/failure breakdown
4. Format as a report and send via email or SlackDirectory sync from external system
An agent that syncs contacts from an external HR system into NextPay:
Prompt: "Sync new employees from our HR CSV into the NextPay directory."
Agent steps:
1. Read the CSV file of new employees
2. nextpay --env prod directory list --type person --limit 100
→ Get existing contacts to avoid duplicates
3. For each new employee not already in the directory:
nextpay --env prod directory create --type person \
--fields '{"first_name":"Ana","last_name":"Reyes","email":"ana@company.ph"}'
4. Report: X new contacts added, Y already existed, Z failedMember onboarding
An agent that onboards a new team member with the right roles:
Prompt: "Onboard maria@acme.ph as a disbursement manager in the Finance workspace."
Agent steps:
1. nextpay --env prod workspace use ws_finance123
→ Set the target workspace
2. nextpay --env prod workspace members add \
--email maria@acme.ph --role member
→ Add as a basic member first
3. nextpay --env prod workspace roles assign \
--user-id <user_id_from_step_2> --role disbursement_manager
→ Assign the specialized role
4. nextpay --env prod audit list --actor <admin_id> --limit 5
→ Verify the actions were logged
5. Report: "Maria Santos onboarded as disbursement_manager in Finance."Invoice follow-up
An agent that checks for overdue invoices and sends reminders:
Prompt: "Check for overdue invoices and notify me of any that need follow-up."
Agent steps:
1. nextpay --env prod auth status
→ Confirm authenticated
2. Query the NextPay API for invoices with status "overdue"
3. For each overdue invoice, check the days past due
4. Categorize: 1-7 days (gentle reminder), 8-30 days (firm follow-up), 30+ days (escalate)
5. Generate a summary report with recommended actions for each invoiceTips for building workflows
- Start with
capabilities— Always have the agent callnextpay capabilitiesat the beginning of a session to understand what operations are available. - Use
--format json— Ensure JSON output for reliable parsing. This is the default for non-TTY contexts but can be forced explicitly. - Chain with
auth status— Start workflows by confirming authentication and the active org/workspace. - Handle errors — Check exit codes after each command. A non-zero exit code means the command failed — the error message is on stderr.
- Use
--quiet— Suppress informational stderr messages to keep agent logs clean.