Skip to content

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

TriggerFires when
booking_createdA booking is confirmed and saved
booking_updatedA booking is modified
booking_canceledA booking is canceled
booking_deletedA booking is removed
booking_endedA booking's time window has ended
checkin_createdA checkin is registered
checkin_startedA user checks in
checkin_updatedA checkin is modified
checkin_deletedA checkin is deleted
checkout_startedA user initiates checkout
checkout_completedThe checkout is finalized
code_scannedA 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 objectPresent when
trigger, starts_at, activity_id, user_id, owner_idEvery run
bookingThe trigger is booking_*, or the run is on a checkin linked to a booking
checkinThe trigger is checkin_* or checkout_*
userThe activity is attributed to a user
organizationThe activity has an owner
bookableThe activity targets a bookable, or the booking or checkin in scope is on one
locationThe bookable in scope is placed at a location
bookable_typeThe 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.