BankingCircle.Webhooks (banking_circle v1.0.0)

Copy Markdown View Source

Manages webhook subscriptions (create/list/activate/deactivate/remove) via the notification self-service API.

For decrypting and verifying incoming webhook payloads, see BankingCircle.Webhook.Verifier — that's a pure, network-free function meant to run inside your Plug/Phoenix controller, not here.

Summary

Types

client()

@type client() :: atom()

Functions

activate_subscription(subscription_id, client \\ :default)

@spec activate_subscription(String.t(), client()) ::
  {:ok, map()} | {:error, BankingCircle.Error.t()}

create_subscription(attrs, client \\ :default)

@spec create_subscription(map(), client()) ::
  {:ok, map()} | {:error, BankingCircle.Error.t()}

Creates a subscription. attrs supports:

  • :url (required) — your HTTPS receiver endpoint
  • :encryption_key (required) — 32-character pre-shared AES-256-GCM key
  • :event_types (required) — list of event type strings to subscribe to
  • :activetrue to activate immediately (default false, i.e. created inactive so you can verify your receiver before flipping it on)
  • :email — notified on sustained delivery failure
  • :max_notifications_per_message — batching size

deactivate_subscription(subscription_id, client \\ :default)

@spec deactivate_subscription(String.t(), client()) ::
  {:ok, map()} | {:error, BankingCircle.Error.t()}

get_subscription(subscription_id, client \\ :default)

@spec get_subscription(String.t(), client()) ::
  {:ok, map()} | {:error, BankingCircle.Error.t()}

list_subscriptions(client \\ :default)

@spec list_subscriptions(client()) :: {:ok, map()} | {:error, BankingCircle.Error.t()}

remove_subscription(subscription_id, client \\ :default)

@spec remove_subscription(String.t(), client()) ::
  {:ok, map()} | {:error, BankingCircle.Error.t()}

simulate(event_type, payload, client \\ :default)

@spec simulate(String.t(), map(), client()) ::
  {:ok, map()} | {:error, BankingCircle.Error.t()}

In sandbox only: triggers a webhook notification without creating or mutating any underlying resource, so you can test your receiver's handling logic in isolation.