MonetizationOS Docs
Workflows Reference

Surface Workflows

Control Surface behavior through custom business logic, via configurable properties and optional HTTP behaviors. Surface workflows execute before child Component workflows.

Usage

Surface Workflow
const :  = async ({ , ,  }: ) => {
    return {
        : {
            : `Hello, ${.}`,
            : ..,
            : .,
        },
        : {
            : 200,
            : {
                "X-Custom-Greeting": `Welcome, ${.}`,
            },
            : .({
                : `Hello from Surface Workflow, ${.}!`,
            }),
        },
    } as ;
};

export default ;

Invocation

Surface workflows are executed as part of the Surface Decisions API request flow. When a surface decision is requested, the workflow runs synchronously to compute the surface behavior before the response is returned.

Arguments

See SurfaceWorkflowArgs.

Prop

Type

Return Type

The workflow returns a SurfaceBehavior. As all properties are optional, returning an empty object {} is valid.

Prop

Type

Surface Behaviors

  • Properties: Use properties to attach computed values for surface control or to pass to child Component workflows.
  • HTTP: Optional - Provide http to override or modify response headers/body/status for HTTP surfaces. If the http behavior is provided and replaces the body, no further processing of child Component workflows will occur.

Common Use Cases

  • Customize surface responses based on user identity or attributes
  • Control feature access at the surface level
  • Fetch dynamic content or configuration from external APIs
  • Implement A/B testing or feature flagging at the surface level
  • Modify HTTP response headers or body for specific surfaces
  • Log surface access or usage metrics

See Also