Registers a URL to be notified whenever a given event fires. See
TreasuryPrime.WebhookEvent for the shape of what gets POSTed to your
url, and TreasuryPrime.WebhookSignature for verifying authenticity.
Creating a webhook
{:ok, webhook} =
TreasuryPrime.Webhook.create(client, %{
event: "ach.update",
url: "https://example.application.com/notify",
basic_user: "myapp",
basic_secret: "a long random secret"
})One TreasuryPrime.Webhook object covers exactly one event type — to
subscribe to multiple events, create one webhook per event (they can all
point at the same url).
Event catalog
Common events include account.update, ach.update, wire.update,
book.update, card.update, card_event.create,
check_deposit.update, check.update, fednow.update,
network_transfer.update, account_application.update,
business_application.update, person_application.update,
kyc.update, incoming_ach.create, incoming_wire.create,
digital_wallet_token.update, greendot.update,
account_tax_document.update, account_statement.create, and more —
see Treasury Prime's Event Types reference for the authoritative,
current list (it grows as new resources ship).
Summary
Functions
Creates a webhook. Required: event, url. Strongly recommended:
basic_user + basic_secret, so you can verify incoming notifications
with TreasuryPrime.WebhookSignature.valid?/3.
Deletes a webhook.
Disables a webhook without deleting it (so it stops receiving notifications but keeps its config).
Re-enables a previously disabled webhook.
Fetches a single webhook by id.
Lists webhooks.
Updates a webhook (e.g. url, status, credentials).
Types
@type t() :: %TreasuryPrime.Webhook{ basic_secret: String.t() | nil, basic_user: String.t() | nil, created_at: String.t() | nil, error: String.t() | nil, event: String.t() | nil, id: String.t() | nil, status: String.t() | nil, updated_at: String.t() | nil, url: String.t() | nil, userdata: map() | nil }
Functions
@spec create(TreasuryPrime.Client.t(), map(), keyword()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Creates a webhook. Required: event, url. Strongly recommended:
basic_user + basic_secret, so you can verify incoming notifications
with TreasuryPrime.WebhookSignature.valid?/3.
@spec create!(TreasuryPrime.Client.t(), map(), keyword()) :: t()
@spec delete(TreasuryPrime.Client.t(), String.t()) :: {:ok, nil} | {:error, TreasuryPrime.Error.t()}
Deletes a webhook.
@spec delete!(TreasuryPrime.Client.t(), String.t()) :: nil
@spec disable(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Disables a webhook without deleting it (so it stops receiving notifications but keeps its config).
@spec enable(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Re-enables a previously disabled webhook.
@spec get(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Fetches a single webhook by id.
@spec get!(TreasuryPrime.Client.t(), String.t()) :: t()
@spec list(TreasuryPrime.Client.t(), map()) :: {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}
Lists webhooks.
Filterable params
event, status.
@spec list!(TreasuryPrime.Client.t(), map()) :: TreasuryPrime.Page.t()
@spec update(TreasuryPrime.Client.t(), String.t(), map()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Updates a webhook (e.g. url, status, credentials).
@spec update!(TreasuryPrime.Client.t(), String.t(), map()) :: t()