# `Noizu.Telegram.Webhook`
[🔗](https://github.com/noizu-labs-sdks/elixir-telegram/blob/v0.1.0/lib/noizu/telegram/webhook.ex#L1)

Webhook management and inbound verification.

- `set/2` / `delete/0` manage the bot's webhook registration.
- `valid_secret?/2` verifies the `X-Telegram-Bot-Api-Secret-Token` header
  against the expected secret with a constant-time comparison.

Secret tokens are never logged: `set/2` redacts them from any error text.

# `delete`

```elixir
@spec delete(keyword()) :: {:ok, true} | {:error, Noizu.Telegram.Error.t()}
```

Bot API `deleteWebhook`.

# `secret_header`

```elixir
@spec secret_header() :: String.t()
```

Header name used for the webhook secret (`X-Telegram-Bot-Api-Secret-Token`).

# `set`

```elixir
@spec set(String.t(), keyword()) :: {:ok, true} | {:error, Noizu.Telegram.Error.t()}
```

Bot API `setWebhook`.

Opts: `:secret_token` (header value Telegram echoes back), `:allowed_updates`,
`:drop_pending_updates`, `:max_connections`, `:certificate`.

# `valid_secret?`

```elixir
@spec valid_secret?(String.t() | nil, String.t() | nil) :: boolean()
```

Verify the `X-Telegram-Bot-Api-Secret-Token` header value against the
expected secret, in constant time. Either side `nil` ⇒ `false`.

---

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