Skip to content

Scripting overview

Fluxweave offers the ability to build custom behavior in Lua and trigger actions through Webhooks or Lifecycle events.


A Webhook is a way for one application to trigger in real time another application. Fluxweave supports receiving webhook calls from other systems - that will then trigger a Lua script - or calling a web API including webhooks in other systems.

See the webhook documentation for more details.

Life cycle events

Lua scripts can also be triggered based on life cycle events with the system.

The following lifecycle events are supported:

  1. Dispatch creation for a specific tracker
  2. User added to the org
  3. Payment
  4. User added or removed from a program
  5. User added or removed from a group
  6. A user label applied

When a lifecycle event happens information about the event will be available through the param function. The mock function can be used to simulate this for test purposes.

Dispatch creation using a tracker

A script can be triggered when a dispatch is created for specific trackers.

mock("dispatchId", "819ae45f-71ae-4269-835e-44405b50c8ac");
local dispatchId = param("dispatchId")

User script

Using the user enpoint functions invokeScript or invokeScriptWithHandle a script can be invoked. The calling user context will be available as userId and any JSON params will be available as body.

local testConfig = {
mock("body", testConfig)

local body = param("body")
local userId = param("userId)