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

Outbound message delivery pipeline through `Jido.Messaging.OutboundGateway`.

Handles sending messages to external channels:
1. Creates assistant message with :sending status
2. Routes send/edit operations through the outbound gateway
3. Updates status to :sent or :failed
4. Returns the persisted message

## Usage

    case Deliver.deliver_outgoing(MyApp.Messaging, original_message, "Hello!", context) do
      {:ok, sent_message} ->
        # Message sent and persisted
      {:error, reason} ->
        # Delivery failed
    end

# `context`

```elixir
@type context() :: Jido.Messaging.Context.t() | map()
```

# `deliver_media_outgoing`

```elixir
@spec deliver_media_outgoing(
  module(),
  Jido.Messaging.Message.t(),
  map(),
  context(),
  keyword()
) ::
  {:ok, Jido.Messaging.Message.t()} | {:error, term()}
```

Deliver an outgoing media payload as a reply.

# `deliver_outgoing`

```elixir
@spec deliver_outgoing(
  module(),
  Jido.Messaging.Message.t(),
  String.t(),
  context(),
  keyword()
) ::
  {:ok, Jido.Messaging.Message.t()} | {:error, term()}
```

Deliver an outgoing message as a reply.

Creates an assistant message, sends it via the channel, and updates the message status.

# `edit_outgoing`

```elixir
@spec edit_outgoing(
  module(),
  Jido.Messaging.Message.t(),
  String.t(),
  context() | map(),
  keyword()
) ::
  {:ok, Jido.Messaging.Message.t()} | {:error, term()}
```

Edit a previously-sent message through the outbound gateway.

# `edit_outgoing_media`

```elixir
@spec edit_outgoing_media(
  module(),
  Jido.Messaging.Message.t(),
  map(),
  context() | map(),
  keyword()
) ::
  {:ok, Jido.Messaging.Message.t()} | {:error, term()}
```

Edit a previously-sent media message through the outbound gateway.

# `send_to_room`

```elixir
@spec send_to_room(module(), String.t(), String.t(), keyword()) ::
  {:ok, Jido.Messaging.Message.t()} | {:error, term()}
```

Send a proactive message to a room using bridge-configured routing.

# `send_to_room_via_routes`

```elixir
@spec send_to_room_via_routes(module(), String.t(), String.t(), keyword()) ::
  {:ok, Jido.Messaging.Message.t()} | {:error, term()}
```

Send a proactive message using control-plane routing.

This path resolves routes via `RoomBinding + BridgeConfig + RoutingPolicy`
and dispatches through `Jido.Messaging.OutboundRouter`.

---

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