Triggers

Triggers specify which type of event will cause the script to run. They take parameters, which are only given during the creation of an Automation (not when the script is written or deployed). These are the types of triggers available:

Time / Date

These triggers run at scheduled times. The trigger is set by defining the following at the start of the Script.

trigger="time"; 

This type of trigger will make the automation run automatically on a schedule set by the system. The following timescales should be supported by Payscript:

  • Daily: Executes every day at a specified time (e.g., every day at 12:00 pm).
  • Weekly: Executes on selected weekdays at a specified time (e.g., every Monday at 12:00 pm).
  • Monthly: Executes on a specific day of the month or the last working day at a specified time (e.g., 2nd of every month at 12:00 pm).
  • Yearly: Executes on a specific date and month at a specified time (e.g., every year on 21st of January at 12:00 pm).
  • One time: Executes once at a specified date and time (e.g., 12th of January 2026 at 12:00 pm.
  • Every X Hours: Executes at regular hourly intervals (e.g., every 2 hours).
  • Every X Minutes: Executes at regular minute intervals (e.g., every 10 minutes).

Transaction

Some scripts run when a specific event happens, such as a payment being received. The trigger is set by defining the following at the start of the Script.

trigger="transaction"; 

This makes the script run whenever a payment is made or received in a monitored account. BUT…. You have to specify the payer, payee and amount for the trigger, so it’s currently extremely specific – this is getting updated.
Users also have the ability to specify within the parameters, to trigger certain automations when a transaction for , any payer, any payer or any amount happen on an account e.g. whenever i I receive a payment of any amount from any payer, move 20% to my savings account.
Additionally, we applied the rule that the customer setting the automation must be either the payer or the payee.
Some examples of possible declarations for transaction trigger:

trigger = transaction(payer = OWNER)
trigger = transaction(payer = anyExcept(OWNER, IgnoredAccounts))
trigger = transaction(amount => 1000)
trigger = transaction(payer = anyExcept(OWNER, IgnoredAccounts), payee = OWNER, amount =< 5000)

Weebhook/ On Demand

This allows users to manually execute pre-configured automations by pressing a trigger button which is available(in UI) only for on-demand automations.

trigger="on_demand"; 

We support two ways of executing on-demand triggers:

  • From the UI button: This uses the values already set within the automation. Users can manually trigger pre-configured automations by pressing a button, which is available only for automations of type on_demand.
  • Via API call: This allows external systems or users to trigger the automation by calling the endpoint /customers/{customerId}/automations/{automationId}/execution and passing the required values directly in the request payload. The automation will run with the provided values instead of the pre-set one.