Nombaone.WebhookEndpoints (Nomba One v0.1.0)

View Source

Webhook endpoints — register and manage the URLs that receive signed events.

To verify incoming deliveries in your handler, use Nombaone.Webhooks (the crypto helper), not this REST resource. Deliveries under an endpoint live in Nombaone.WebhookEndpoints.Deliveries.

Summary

Functions

Register an endpoint. The response includes the full signing_secret exactly once — store it in your secret manager immediately.

Delete an endpoint. Pending deliveries to it are retired.

List your endpoints, newest first.

Retrieve an endpoint by id.

Rotate the signing secret. The new secret is returned exactly once; the old one is briefly honored so you can roll without dropping in-flight deliveries.

Update url, event subscription (:enabled_events), or :disabled state.

Functions

create(client, params, opts \\ [])

@spec create(Nombaone.Client.t(), map(), keyword()) ::
  {:ok, Nombaone.WebhookEndpointWithSecret.t()} | {:error, Nombaone.Error.t()}

Register an endpoint. The response includes the full signing_secret exactly once — store it in your secret manager immediately.

Example

{:ok, endpoint} =
  Nombaone.WebhookEndpoints.create(client, %{
    url: "https://example.com/nombaone/webhooks",
    enabled_events: ["invoice.paid", "invoice.payment_failed"]
  })

store_secret(endpoint.signing_secret)

create!(client, params, opts \\ [])

Raising variant of create/3.

delete(client, id, opts \\ [])

@spec delete(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.WebhookEndpoint.t()} | {:error, Nombaone.Error.t()}

Delete an endpoint. Pending deliveries to it are retired.

delete!(client, id, opts \\ [])

Raising variant of delete/3.

list(client, params \\ %{}, opts \\ [])

@spec list(Nombaone.Client.t(), map(), keyword()) ::
  {:ok, Nombaone.Page.t()} | {:error, Nombaone.Error.t()}

List your endpoints, newest first.

list!(client, params \\ %{}, opts \\ [])

@spec list!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.Page.t()

Raising variant of list/3.

retrieve(client, id, opts \\ [])

@spec retrieve(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.WebhookEndpoint.t()} | {:error, Nombaone.Error.t()}

Retrieve an endpoint by id.

retrieve!(client, id, opts \\ [])

Raising variant of retrieve/3.

rotate_secret(client, id, opts \\ [])

@spec rotate_secret(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.RotatedWebhookSecret.t()} | {:error, Nombaone.Error.t()}

Rotate the signing secret. The new secret is returned exactly once; the old one is briefly honored so you can roll without dropping in-flight deliveries.

rotate_secret!(client, id, opts \\ [])

Raising variant of rotate_secret/3.

update(client, id, params, opts \\ [])

@spec update(Nombaone.Client.t(), String.t(), map(), keyword()) ::
  {:ok, Nombaone.WebhookEndpoint.t()} | {:error, Nombaone.Error.t()}

Update url, event subscription (:enabled_events), or :disabled state.

update!(client, id, params, opts \\ [])

Raising variant of update/4.