Action
An action is a Tengo script bound to a trigger on a resource. When the trigger fires, the engine builds a context object containing the relevant entities and runs the script. Actions are how the platform connects internal events to external systems: sending notifications, calling webhooks, unlocking doors, updating records, or any other server-side logic that should happen automatically in response to a booking, checkin, or code scan.
Triggers
| Trigger | Fires when |
|---|---|
booking_created | A booking is confirmed and saved |
booking_updated | A booking is modified |
booking_canceled | A booking is canceled |
booking_deleted | A booking is removed |
booking_ended | A booking's time window has ended |
checkin_created | A checkin is registered |
checkin_started | A user checks in |
checkin_updated | A checkin is modified |
checkin_deleted | A checkin is deleted |
checkout_started | A user initiates checkout |
checkout_completed | The checkout is finalized |
code_scanned | A code is scanned |
Context
When the script runs, the engine populates a context with the entities relevant to the trigger. Only the objects below are present, and only when the trigger names them.
| Context object | Present when |
|---|---|
trigger, starts_at, activity_id, user_id, owner_id | Every run |
booking | The trigger is booking_*, or the run is on a checkin linked to a booking |
checkin | The trigger is checkin_* or checkout_* |
user | The activity is attributed to a user |
organization | The activity has an owner |
bookable | The activity targets a bookable, or the booking or checkin in scope is on one |
location | The bookable in scope is placed at a location |
bookable_type | The bookable in scope has a type assigned |
Each organization, location, bookable and bookable_type also carries any Capabilities attached to it.
The action body is written in Tengo. The modules text, math, times and fmt are available and must be imported with import before use. See the Tengo language documentation for syntax and standard library reference.
Bindings
An action is attached to objects through bindings. When a trigger fires on a bookable, the engine matches actions bound to:
- The bookable itself
- Any location in the bookable's location chain
- Any organization in the bookable's organization chain
- Any capability attached to the bookable, its locations, or its organizations
A single action can carry multiple bindings, making it possible to attach the same script to every bookable in an organization without duplicating it.
Execution order
Multiple actions on the same trigger run in sequence. With continue_on_fail: false (default), a failure stops the remaining actions. With continue_on_fail: true, execution continues regardless.
API
The Action tag covers action CRUD, object bindings and the action audit log.