# `BankingCircle.Webhooks`
[🔗](https://github.com/iamkanishka/banking_circle/blob/main/lib/banking_circle/webhooks.ex#L1)

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.

# `client`

```elixir
@type client() :: atom()
```

# `activate_subscription`

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

# `create_subscription`

```elixir
@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
  * `:active` — `true` 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`

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

# `get_subscription`

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

# `list_subscriptions`

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

# `remove_subscription`

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

# `simulate`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
