Behaviour and macro for defining discoverable Chronicle webhooks.
Discoverable webhooks follow the same pattern as read models and constraints:
metadata is captured at compile time and exposed through
__chronicle_webhook__/1.
Usage
defmodule MyApp.WebHooks.AccountEvents do
use Chronicle.WebHooks.Webhook,
target_url: "https://example.com/chronicle/webhooks"
alias Chronicle.WebHooks.DefinitionBuilder
@impl true
def define(builder) do
builder
|> DefinitionBuilder.with_event_type(MyApp.Events.AccountOpened)
|> DefinitionBuilder.with_header("x-source", "my-app")
end
endOptions for use Chronicle.WebHooks.Webhook:
:target_url— required webhook target URL:id— stable webhook identifier. Defaults to the module's last segment.:event_sequence_id— optional explicit event sequence identifier
Summary
Callbacks
@callback define(Chronicle.WebHooks.DefinitionBuilder.t()) :: Chronicle.WebHooks.DefinitionBuilder.t()