Functions
Write TypeScript that OmniLab compiles to WebAssembly and runs in a sandbox, either after an event or inside a business decision.
1 min read
Use functions when OmniLab needs to run your logic rather than call out to your systems. You write a single TypeScript file, OmniLab compiles it to WebAssembly, and the platform runs it in a sandbox.
There are two kinds, and the difference is when they run:
FunctionsPlatform event functionsReact after something happens — a touchpoint completed, a reward won, a contact created.FunctionsHook functionsRun inside an operation and decide whether it continues, such as vetting a signup.
Functions run inside OmniLab, webhooks call out to you
A webhook tells your infrastructure that something happened and waits for nothing. A function runs on OmniLab's infrastructure and, for one kind, can change the outcome of the operation that triggered it. If you only need a notification, use webhooks — they are simpler to operate.
Everything else
FunctionsAbout functionsUnderstand the two kinds, the lifecycle, and the sandbox model.FunctionsCreate and build a functionCreate it, save a draft, and compile it to a running version.FunctionsConfigure runtime and secretsSet timeouts, memory, outbound host allow-lists, config keys, and credentials.FunctionsTest and monitor functionsRun test invocations, read the execution log, and diagnose failures.FunctionsFunction SDK referenceHandler exports, the available SDK calls, error codes, and every limit.