Skip to content

Events

All events live in the Integrations\Events namespace and use Laravel's Dispatchable trait.

Integration lifecycle

IntegrationCreated

Dispatched when a new integration is created. Implements ShouldDispatchAfterCommit, so inside a transaction Laravel holds the dispatch until the commit and discards it on a rollback.

PropertyTypeDescription
integrationIntegrationThe newly created integration

IntegrationHealthChanged

Dispatched when an integration's health status changes.

PropertyTypeDescription
integrationIntegrationThe integration
previousStatusHealthStatusStatus before the change
newStatusHealthStatusStatus after the change

IntegrationDisabled

Dispatched when an integration is automatically disabled after too many failures.

PropertyTypeDescription
integrationIntegrationThe disabled integration

Requests

RequestCompleted

Dispatched after a successful API request.

PropertyTypeDescription
integrationIntegrationThe integration
requestIntegrationRequestThe logged request record

RequestFailed

Dispatched after a failed API request.

PropertyTypeDescription
integrationIntegrationThe integration
requestIntegrationRequestThe logged request record

Circuit breaker

CircuitOpened

Dispatched when an integration's circuit breaker transitions to open — whether tripped automatically or forced open by an operator. Fires once per transition, not per request.

PropertyTypeDescription
integrationIntegrationThe integration
reasonstringthreshold_reached, half_open_probe_failed, or forced_open

CircuitClosed

Dispatched when the breaker transitions to closed — whether a half-open probe succeeded or an operator forced it closed.

PropertyTypeDescription
integrationIntegrationThe integration
reasonstringhalf_open_probe_succeeded or forced_closed

A publishable SendCircuitNotification listener can turn these into notifications — see Notifications.

These four events — IntegrationHealthChanged, IntegrationDisabled, CircuitOpened, and CircuitClosed — also drive the durable incident history the package records. Operator overrides (forced_open / forced_closed) are excluded.

Failure anomalies

These fire from integrations:evaluate-failures, not the request path. See the anomaly signal.

ElevatedFailureRate

Dispatched when an integration's failure rate over the configured window crosses the threshold. Debounced to one event per incident, so a consumer raises a single alert rather than one per failure.

PropertyTypeDescription
integrationIntegrationThe integration
failureRatefloatFailed share of requests in the window (0–100)
windowMinutesintThe measured window
observedRequestsintRequests seen in the window
dominantClassFailureClassThe FailureClass with the most failures in the window

FailureRateRecovered

Dispatched when an integration that previously had an elevated rate drops back below the threshold. The mirror of ElevatedFailureRate, so a consumer can resolve its alert and the next incident alerts immediately.

PropertyTypeDescription
integrationIntegrationThe integration

Operations

OperationStarted

Dispatched when an operation is logged with status processing.

PropertyTypeDescription
integrationIntegrationThe integration
logIntegrationLogThe operation log record

OperationCompleted

Dispatched when an operation completes successfully.

PropertyTypeDescription
integrationIntegrationThe integration
logIntegrationLogThe operation log record

OperationFailed

Dispatched when an operation fails.

PropertyTypeDescription
integrationIntegrationThe integration
logIntegrationLogThe operation log record
attempt?SyncAttemptContextRetry-attempt context when the failure was logged inside a sync item run; null otherwise. Lets a listener down-rank mid-retry noise via isLikelyFinalAttempt(). See terminal-vs-transient failures.

Alert on terminal failures only

Inside a sync, a re-throwing listener logs failed on every attempt, so OperationFailed fires per attempt by design. For one alert per dead item, route terminal alerting to SyncItemFailed (fires once on exhaustion). The attempt context is a best-effort filter for operation-granularity hooks, not a replacement.

Sync

IntegrationSynced

Dispatched after sync completes (legacy aggregate event).

PropertyTypeDescription
integrationIntegrationThe integration
resultSyncResultSync outcome (created/updated/failed counts)

SyncCompleted

Dispatched once a sync run reconciles.

PropertyTypeDescription
integrationIntegrationThe integration
resultSyncResultAggregated run outcome

SyncItemFailed

Dispatched when a sync item exhausts its retries.

PropertyTypeDescription
integrationIntegrationThe integration
itemIntegrationSyncItemThe failed item
exceptionThrowableThe failure cause

SyncItemStuck

Dispatched when one external ID has failed sync.stuck_item_after_runs consecutive runs with no success in between. It carries the record that blocks the cursor, while SyncItemFailed reports one failed attempt. See stuck items.

PropertyTypeDescription
integrationIntegrationThe integration
itemIntegrationSyncItemThis run's failed row for the stuck record
consecutiveFailedRunsintNumber of consecutive runs the external ID has failed

SyncBecameStale

Dispatched by integrations:sync when an integration passes the staleness threshold. One event per episode. See sync staleness.

PropertyTypeDescription
integrationIntegrationThe integration
secondsSinceLastCleanSyncintSeconds since the last clean sync, or since the integration was created if it has never synced

SyncStalenessRecovered

Dispatched when a stale integration syncs cleanly again. It closes the episode that SyncBecameStale opened.

PropertyTypeDescription
integrationIntegrationThe integration

Webhooks

WebhookReceived

Dispatched when a webhook is received and verified.

PropertyTypeDescription
integrationIntegrationThe integration
eventstringThe webhook event type

Listening to events

Register listeners in your EventServiceProvider:

php
use Integrations\Events\IntegrationSynced;
use App\Listeners\HandleIntegrationSync;

protected $listen = [
    IntegrationSynced::class => [
        HandleIntegrationSync::class,
    ],
];