App data hooks
Apps can register data hooks that will be called by Rimdian when specific events occur.
As opposed to tasks that are executed in the background, data hooks are called in real-time in the data processing pipeline and are expected to return a response within a few seconds.
A common use case for data hooks is to enrich or transform data before it is inserted by Rimdian, or to forward data to a third-party system.
Data hooks types
Rimdian supports the following data hook types:
on_success
- called when a data log item is successfully processed (created, updated…).on_validation
- called when a data log item about to be validated (before it is processed), and can be used to enrich/transform/reject the data item.
Hook on_success
When a on_success
data hook is called, Rimdian will send a POST request to your app webhook_endpoint
with the following payload:
The full user
object will be included if the data log item is associated with a user.
The data_log_item
is the JSON-escaped string value of the item sent to the Collector.
Expected response
Returning is_done
as false
will cause the data hook to be retried.
Hook on_validation
When a on_validation
data hook is called, Rimdian will send a POST request to your app webhook_endpoint
with the following payload:
The data_log_item
is the JSON-escaped string value of the item sent to the Collector.
Expected response for rejecting the data
Expected response for enriching the data
updated_item
field should be a JSON string and not a JSON object.Expected response for accepting the data
You just need to return a 200 OK
status code with an empty body to accept the data.