Event Handling

The globalMOO API provides event notifications for important state changes and asynchronous operations.

Event Format

Events follow this structure:

{
    "id": 123,
    "created_at": "2025-01-31T10:00:00.000Z",
    "updated_at": "2025-01-31T10:00:00.000Z",
    "disabled_at": null,
    "name": "project.created",
    "subject": "optional-subject-id",
    "data": {
        // Event-specific data object
    }
}

Event Types

Event Name
Description
Data Type

project.created

New project created

Project

inverse.suggested

New inverse step suggested

Inverse

SDK Event Handling

Validation & Error Handling

Events are validated before processing:

  1. Basic JSON validation

  2. Required fields check

  3. Event name validation

  4. Data type mapping

  5. Field type validation

Possible exceptions:

  • InvalidArgumentException: Invalid JSON or missing fields

  • InvalidEventException: Unknown event type

  • ValidationException: Invalid data format

Example error handling:

Best Practices

  1. Always validate event payloads

  2. Use type-safe event handling

  3. Implement idempotency checks

  4. Log event processing

  5. Handle errors gracefully

  6. Process events asynchronously

  7. Monitor event throughput

Integration Example

Complete webhook handler example:

Last updated