Workflows Reference
Action Workflows
Respond to Triggers with asynchronous business logic. Action workflows enable integration with external services, notifications, analytics, and orchestration based on platform events.
Usage
const workflow: ActionWorkflow = async ({ identity, payload }: ActionWorkflowArgs) => {
await fetch(`https://dummyjson.com/users/${identity?.identifier}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
newPlans: payload,
}),
});
return {
status: "success",
};
};
export default workflow;Invocation
Action workflows are executed in response to configured triggers. Triggers can be system-defined (e.g. plans changed, decisions) or custom-defined (e.g. webhooks, business relevant events).
Arguments
See ActionWorkflowArgs.
Prop
Type
Return Type
The workflow returns ActionWorkflowResult or void. As all action workflows are fire-and-forget, ActionWorkflowResult is only used in Observability.
Prop
Type
System Triggers & Payloads
MonetizationOS provides built-in system triggers with typed payloads:
- Decision: ActionWorkflowDecisionPayload
- Counters Updated: ActionWorkflowCounterUpdatedPayload
- Plans Changed: ActionWorkflowPlansChangedPayload
- User Added: No
payloadprovided, useidentityfor user context.
Custom triggers can optionally define their own payload schemas, defaulting to any if unspecified.
Common Use Cases
- Send notifications (email, Slack, webhooks) on plan changes or access events
- Log analytics or metrics on decisions and counter updates
- Trigger downstream workflows in external systems
- Sync user state to third-party platforms