# `Jido.Messaging.InboundRouter`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/inbound_router.ex#L1)

Inbound routing boundary from raw adapter payloads into runtime ingest.

This module resolves adapter modules from bridge configuration, then:
1. verifies/parses webhook requests via `Jido.Chat.Adapter`
2. canonicalizes routing via `Jido.Chat.process_event/4`
3. persists message events through `Jido.Messaging.Ingest`

# `ingest_result`

```elixir
@type ingest_result() ::
  {:ok,
   {:message, Jido.Messaging.Message.t(), Jido.Messaging.Ingest.context(),
    Jido.Chat.EventEnvelope.t()}}
  | {:ok, {:duplicate, Jido.Chat.EventEnvelope.t()}}
  | {:ok, {:event, Jido.Chat.EventEnvelope.t()}}
  | {:ok, :noop}
  | {:error, term()}
```

# `route_ingress_result`

```elixir
@type route_ingress_result() ::
  {:ok, Jido.Messaging.IngressOutcome.t()} | {:error, term()}
```

# `webhook_result`

```elixir
@type webhook_result() ::
  {:ok, Jido.Chat.WebhookResponse.t(), ingest_result()} | {:error, term()}
```

# `route_ingress`

```elixir
@spec route_ingress(
  module(),
  String.t(),
  :webhook | :payload,
  map(),
  map(),
  keyword()
) ::
  route_ingress_result()
```

Routes ingress through a canonical normalized outcome.

Supported modes:
  * `:webhook` - verifies/parses request, dispatches event, formats webhook response
  * `:payload` - normalizes payload events for listener-driven ingress

# `route_payload`

```elixir
@spec route_payload(module(), String.t(), map(), keyword()) :: ingest_result()
```

Routes a non-webhook payload through canonical event normalization.

For transport listeners (polling, gateways, queues), this path supports:
  * direct `EventEnvelope` payloads
  * adapter `parse_event/2` normalization when available
  * `transform_incoming/1` fallback for message payloads

# `route_webhook`

```elixir
@spec route_webhook(module(), String.t(), map(), keyword()) :: ingest_result()
```

Routes a webhook payload through bridge-config verification + event parsing.

## Options

  * `:headers` - request headers map
  * `:path` - request path
  * `:method` - HTTP method
  * `:raw_body` - raw body used by signature verification
  * `:ingest_opts` - options passed to `Jido.Messaging.Ingest.ingest_incoming/5`

# `route_webhook_request`

```elixir
@spec route_webhook_request(module(), String.t(), map(), map(), keyword()) ::
  webhook_result()
```

Routes a webhook request and returns both typed HTTP response and ingest outcome.

`request_meta` accepts:
  * `:headers` - request headers map
  * `:path` - request path
  * `:method` - HTTP method
  * `:raw_body` - raw body used by signature verification

---

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