Iris API

This documentation covers the Jyro scripting API available in Iris for Event Hooks, Dynamic Endpoints, and Ad-hoc Scripts.

Getting Started

Key Concepts

  1. Event Hooks - Scripts triggered by domain events (e.g., BeforeOrganizationCreated, AfterPersonUpdated)
  2. Dynamic Endpoints - Custom REST API endpoints powered by Jyro scripts
  3. Ad-hoc Scripts - Administrative scripts executed on-demand

Essential Reading

Document Description
Data context reference Structure of the Data object passed to scripts
Iris API functions All available host functions for interacting with Iris

Data Context

Every script receives a Data object containing context-specific information:

Event Hooks

  • Create/Delete Events: Access entity via Data.{entityType} (e.g., Data.organization, Data.person)
  • Update Events: Access both states via Data.Current and Data.Previous
# BeforeOrganizationCreated
Log("Information", "Creating: " + Data.organization.Name)

# AfterPersonUpdated
if Data.Current.EmailAddress != Data.Previous.EmailAddress then
    Log("Information", "Email changed")
end

Dynamic Endpoints

  • Request Data: Data.request.method, Data.request.query, Data.request.body, Data.request.user
  • Response Control: Data._payload, Data._statusCode, Data._redirect
# GET /api/dynamic/v1/hello
Data._payload = { "message": "Hello, " + Data.request.user.name }
Data._statusCode = 200

See the Data context reference for complete details.

Quick Reference

Event Types

Entity Before After Async
Organization BeforeOrganizationCreated/Updated/Deleted AfterOrganizationCreated/Updated/Deleted AsyncOrganizationCreated/Updated/Deleted
Person BeforePersonCreated/Updated/Deleted AfterPersonCreated/Updated/Deleted AsyncPersonCreated/Updated/Deleted

Common Host Functions

Function Description
Log(level, message) Write to application logs
CancelAction(reason) Cancel operation (Before hooks only)
GetOrganizationById(id) Get organization by ID
GetAllOrganizations() Get all organizations
SendNotification(userId, title, message, type, link) Send push notification
GetSecret(name) Get decrypted secret value

See the Iris API functions for the complete list.

In this section

External resources


Back to top

Copyright © Globetrotter. All rights reserved.