Skip to main content
Triggers bind your internal Actions to the outside world. They handle input mapping, authentication, and protocol specifics.

HTTP triggers

Expose an action as a REST endpoint.
trigger CreatePatient on HttpRequest
  description "Public endpoint to register a patient."
  endpoint POST /clinics/{clinicId}/patients
  
  arguments
    clinicId := @request.path.clinicId
    fullName := @request.body.fullName
    dateOfBirth := @request.body.dateOfBirth
  
  auth
    @subject can "patients:write"

Argument mapping

You can map data from various parts of the HTTP request to your Action arguments:
  • @request.body.fieldName: JSON body payload.
  • @request.path.paramName: URL path parameters.
  • @request.query.paramName: URL query string.
  • @request.files.fieldName: Uploaded files (mapped to URL type).

Queue triggers

Process background jobs asynchronously.
queue patientProcessingQueue with Patient

trigger ProcessPatient on Queue
  queue patientProcessingQueue
  arguments
    patient := @message
To trigger this, you would use enqueue inside an action:
action SubmitPatient(...): Patient
  body
    p := create Patient { ... }
    enqueue patientProcessingQueue with p
    return p