Events are our way of letting you know when something that might interest you happens in Lucca. Whenever it does a new event resource is created. For example, when a leave-request is eventually approved, a leave-request.updated event is created to notify you that its status changed.

In general, events occur whenever the state of a resource representation changes. The state of that resource at the time of the change is embedded in the event’s data attribute. Given the previous example, the leave-request.updated event will contain the representation of the corresponding leave-request in its data attribute.

About topics

The topic of an event indicates both the type of the related resource and the nature of the change.

<resource_type> = "leave" | "employee" | "legal-entity" | ...
<change_type> = "created" | "updated" | "deleted"
<topic> = <resource_type> "." <change_type>

Examples: leave.created, employee.updated, legal-entity.deleted, etc…

List of topics

About update events

{resource}.updated events are triggered whenever an attribute of a resource that already existed is changed. This behavior is restricted to the direct attributes of the resource. As such, a change in the state of an embedded resource does not trigger a {resource}.updated event on the embedding resource.

The list of modified attributes, as well as their value before the change, can be found in the data.previousAttributes JSON object (<attribute> => <previous_value> dictionary).

About ApiVersion

Any time an event occurs, it is created as many times as there are supported Lucca API versions. Each event thus has an apiVersion attribute that indicates the relevant API version.

The data contained in an event is a representation of the related resource that conforms to the schema in the related API version.

This means that if the event occurred before the release of a specific API version, then there will be no related event for this version.

Consuming events

Option #1. As with other API resources, you can use the API endpoints to retrieve an individual event or a list of events from the API.

Option #2. We also have a separate webhooks system for sending the event directly to an endpoint on your server.

Events are only kept for up to 2 months.

Represents a change made to the state of a resource.