Workflows Reference
Overview
Workflows are serverless TypeScript functions that run at the edge, enabling you to extend and customize MonetizationOS with your own business logic. Whether you need to control surface rendering, validate access decisions, dynamically provision plans, respond to platform events, or handle custom HTTP requests, workflows integrate seamlessly at critical points throughout the platform lifecycle.
Workflow Types
Action Workflows
Respond to system or custom triggers with asynchronous business logic. Enable integrations, notifications, and orchestration.
Component Workflows
Control component behavior through configurable properties and optional Web content behaviors.
Dynamic Provisioning Workflows
Assign plans based on identity, context, or custom logic evaluated at access check time.
Endpoint Workflows
Handle incoming HTTP requests with custom logic. Create custom API endpoints with access to identity and integrations.
Feature Workflows
Dynamically override feature property values based on custom logic, pulling values from external sources or request context.
Surface Workflows
Control surface behavior through configurable properties and optional HTTP behaviors.
Workflow Runtime
- MonetizationOS workflows are written in TypeScript, providing strong typing and autocompletion for workflow arguments, return types, and platform utilities.
- Workflows run in a secure, sandboxed environment (V8 isolates) at the edge, ensuring low-latency execution close to your users.
- The version of V8 (Chrome's JavaScript engine) is updated at least weekly, targeting the latest stable version to incorporate the latest performance, features, and security improvements.
- Supports all JavaScript language features supported by the latest stable V8 version. See the JavaScript reference for details.
- For security reasons, certain APIs are restricted or unavailable in the workflow runtime (e.g.
eval,Functionconstructor, andWebAssembly).
- For security reasons, certain APIs are restricted or unavailable in the workflow runtime (e.g.
- Supports standard Web APIs available in modern browsers, including:
fetchfor making HTTP requestsURLandURLSearchParamsfor URL manipulationTextEncoderandTextDecoderfor text encoding/decodingCryptoAPI for cryptographic operationsIntlfor internationalization and localization
Workflow Execution Model
- Action Workflows: Runs in response to triggers; does not block access checks or surface decisions.
- Component Workflows: Runs during surface decisions, after parent surface workflows.
- Endpoint Workflows: Runs when HTTP requests hit configured endpoints.
- Surface Workflows: Runs during surface decisions, before component workflows. Can terminate early with HTTP responses.
- Feature Workflows: Runs during access checks and surface decisions, after plan-based property resolution.
- Dynamic Provisioning Workflows: Runs during provisioning phase to assign plans dynamically.