# `Noizu.Comms.Target`
[🔗](https://github.com/noizu-labs-sdks/elixir-comms/blob/main/lib/lib/noizu/comms/target.ex#L1)

A parsed outbound target.

URI forms (contract):

| URI | channel | kind |
|---|---|---|
| `discord://channel/<snowflake>` | `:discord` | `:channel` |
| `discord://webhook/<alias>` | `:discord` | `:webhook` |
| `slack://channel/<id>` | `:slack` | `:channel` |
| `slack://webhook/<alias>` | `:slack` | `:webhook` |
| `telegram://chat/<id or @username>` | `:telegram` | `:chat` |
| `whatsapp://<E.164>` (+ `?template=&lang=`) | `:whatsapp` | `:phone` |
| `test://<name>` | `:test` | `:sink` |
| `<alias>` (bare word) | resolved from config | `:alias` |

Alias targets carry `:alias` (the config name) and `:allow_write`; the
Router fills both after resolving the config entry.

# `kind`

```elixir
@type kind() :: :channel | :webhook | :chat | :phone | :sink | :alias
```

# `t`

```elixir
@type t() :: %Noizu.Comms.Target{
  alias: String.t() | nil,
  allow_write: boolean() | nil,
  channel: atom() | nil,
  id: String.t() | nil,
  kind: kind(),
  query: %{required(String.t()) =&gt; String.t()}
}
```

# `key`

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

Stable policy/telemetry key: `alias:<name>` or `<channel>:<kind>:<id>`.

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, t()} | {:error, Noizu.Comms.Error.t()}
```

Parses a target URI or bare alias.

# `raw?`

```elixir
@spec raw?(t()) :: boolean()
```

True when the target was a raw URI (not resolved through a config alias).

# `redacted_key`

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

Like `key/1` but masks secret/PII-bearing ids (phone numbers, webhook ids)
for use in error messages and logs — errors never carry them (see `Error`).

---

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