Current section

Files

Jump to
ash_hooks README.md
Raw

README.md

<!--
SPDX-FileCopyrightText: © 2026 BaseLabs Holdings LLC

SPDX-License-Identifier: MIT
-->

[![CI](https://github.com/baselabs/ash_hooks/actions/workflows/ci.yml/badge.svg)](https://github.com/baselabs/ash_hooks/actions/workflows/ci.yml)
[![Hex](https://img.shields.io/hexpm/v/ash_hooks.svg)](https://hex.pm/packages/ash_hooks)
[![HexDocs](https://img.shields.io/badge/docs-HexDocs-purple)](https://hexdocs.pm/ash_hooks)
[![REUSE](https://api.reuse.software/badge/github.com/baselabs/ash_hooks)](https://api.reuse.software/info/github.com/baselabs/ash_hooks)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit)

# AshHooks

AshHooks adds inbound and outbound webhooks to [Ash Framework](https://hexdocs.pm/ash) resources.

- Verify incoming signatures over the original request bytes before calling a handler.
- Deduplicate receipts with a database ledger that records handler outcomes and supports retry.
- Sign outgoing deliveries with [Standard Webhooks](https://www.standardwebhooks.com/) and persist per-endpoint retry state.
- Read delivery and attempt history under your Ash domain's authorization policy.

## Install

In an Ash application with Igniter, run:

<!-- not-run: The installer changes the dependencies, formatter, and endpoint of the adopter's project. -->
```sh
mix igniter.install ash_hooks
```

Follow the [tutorial setup](documentation/tutorials/get-started.md#configure-ash)
for the Ash configuration required before compiling resources.

## Receive a webhook

Use the ledger, provider, and migration from [Get started](documentation/tutorials/get-started.md).
The [signed-order example](documentation/tutorials/get-started.md#verify-and-handle-an-incoming-event)
binds the original body as `raw_body` and the verification context as `ctx`.
Use those bindings to run the first ingest.

<!-- not-run: This call needs the registered ledger, provider, and a real signed request. -->
```elixir
{:ok, :created, %{status: :processed}} =
  AshHooks.Ingress.ingest(MyApp.WebhookLedger, :orders, raw_body, ctx)
```

## Documentation

- **Tutorials** [Get started](documentation/tutorials/get-started.md) and the
  [guided Livebook](documentation/livebooks/get-started.livemd).
- **Topics** [Delivery lifecycle](documentation/topics/delivery/delivery-lifecycle.md),
  [Security guarantees](documentation/topics/support/security-guarantees.md), and
  [Upgrading](documentation/topics/support/upgrading.md).
- **How-to** [Integration guides](documentation/how-to/index.md).
- **Reference** [DSL, modules, and tasks](documentation/reference/reference.md).

See [Compatibility](documentation/topics/support/compatibility.md) for supported runtimes and dependencies.

## License

[MIT](https://opensource.org/license/mit).