Ruby SDKFeature Clients

Events Client

Events client for interacting with Hatchet event management API.

This class provides a high-level interface for creating and managing events in the Hatchet system. It uses gRPC for event creation (push/bulk_push) and the REST API for read operations (list, get, etc.).

response = hatchet.events.push(
  "user-login",
  { user_id: 123, action: "login" },
  additional_metadata: { ip_address: "192.168.1.1" }
)

It is available on the main client as hatchet.events.

Methods:

NameDescription
createCreates a new event in the Hatchet system.
pushPush a single event to Hatchet.
bulk_pushCreate events in bulk.
listList events with filtering options.
getGet a specific event by ID.
get_dataGet event data for a specific event.
list_keysList available event keys for the tenant.
cancelCancel events matching the given criteria.
replayReplay events matching the given criteria.

Functions

create

Creates a new event in the Hatchet system.

This method sends an event creation request via gRPC. The event will be processed and made available for workflow triggers and event-driven automation.

response = hatchet.events.create(
  key: "user-login",
  data: { user_id: 123, action: "login" },
  additional_metadata: { ip_address: "192.168.1.1" }
)

Parameters:

NameTypeDescriptionDefault
keyStringThe event key/name.required
dataHashThe event payload data.required
additional_metadataHash | nilAdditional metadata for the event.nil
priorityInteger | nilEvent priority.nil
scopeString | nilThe scope for event filtering.nil
namespaceString | nilOverride namespace for this event.nil

Returns:

TypeDescription
ObjectThe gRPC response containing the created event details.

Raises:

TypeDescription
ArgumentErrorIf required parameters are missing.
Hatchet::ErrorIf the API request fails or returns an error.

push

Push a single event to Hatchet.

response = hatchet.events.push(
  "user-signup",
  { user_id: 456, email: "user@example.com" },
  additional_metadata: { source: "web" }
)

Parameters:

NameTypeDescriptionDefault
event_keyStringThe event key/name.required
payloadHashThe event payload data.required
additional_metadataHash | nilAdditional metadata for the event.nil
namespaceString | nilOverride namespace for this event.nil
priorityInteger | nilEvent priority.nil

Returns:

TypeDescription
ObjectThe gRPC response containing the created event details.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

bulk_push

Create events in bulk.

events_data = [
  { key: "user-signup", data: { user_id: 1 } },
  { key: "user-login", data: { user_id: 1 }, priority: 1 }
]
response = hatchet.events.bulk_push(events_data)

Parameters:

NameTypeDescriptionDefault
eventsArray<Hash>Array of event hashes, each containing :key, :data, and optionally :additional_metadata and :priority.required
namespaceString | nilOverride namespace for all events.nil

Returns:

TypeDescription
ObjectThe gRPC response containing the created events.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

list

List events with filtering options.

events = hatchet.events.list(
  limit: 10,
  since: Time.now - 24 * 60 * 60,
  keys: ["user-signup", "user-login"]
)

Parameters:

NameTypeDescriptionDefault
offsetInteger | nilPagination offset.nil
limitInteger | nilMaximum number of events to return.nil
keysArray<String> | nilFilter by event keys.nil
sinceTime | nilFilter events after this time.nil
until_timeTime | nilFilter events before this time.nil
workflow_idsArray<String> | nilFilter by workflow IDs.nil
workflow_run_statusesArray<String> | nilFilter by workflow run statuses.nil
event_idsArray<String> | nilFilter by specific event IDs.nil
additional_metadataHash<String, String> | nilFilter by additional metadata.nil
scopesArray<String> | nilFilter by event scopes.nil

Returns:

TypeDescription
HatchetSdkRest::V1EventListList of events matching the filters.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

get

Get a specific event by ID.

Parameters:

NameTypeDescriptionDefault
event_idStringThe event ID.required

Returns:

TypeDescription
ObjectThe event details.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

get_data

Get event data for a specific event.

Parameters:

NameTypeDescriptionDefault
event_idStringThe event ID.required

Returns:

TypeDescription
ObjectThe event data.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

list_keys

List available event keys for the tenant.

Returns:

TypeDescription
ObjectList of available event keys.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

cancel

Cancel events matching the given criteria.

Parameters:

NameTypeDescriptionDefault
event_idsArray<String> | nilSpecific event IDs to cancel.nil
keysArray<String> | nilEvent keys to cancel.nil
sinceTime | nilCancel events after this time.nil
until_timeTime | nilCancel events before this time.nil

Returns:

TypeDescription
ObjectThe cancellation response.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

replay

Replay events matching the given criteria.

Parameters:

NameTypeDescriptionDefault
event_idsArray<String> | nilSpecific event IDs to replay.nil
keysArray<String> | nilEvent keys to replay.nil
sinceTime | nilReplay events after this time.nil
until_timeTime | nilReplay events before this time.nil

Returns:

TypeDescription
ObjectThe replay response.

Raises:

TypeDescription
Hatchet::ErrorIf the API request fails or returns an error.

Last updated on August 24, 2026

On this page