Jido.Messaging.InboundRouter (Jido Messaging v1.0.0)

Copy Markdown View Source

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

Summary

Functions

Routes ingress through a canonical normalized outcome.

Routes a non-webhook payload through canonical event normalization.

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

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

Types

ingest_result()

@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()

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

webhook_result()

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

Functions

route_ingress(instance_module, bridge_id, arg3, request_meta, payload, opts)

@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(instance_module, bridge_id, payload, opts \\ [])

@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(instance_module, bridge_id, payload, opts \\ [])

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

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

Options

route_webhook_request(instance_module, bridge_id, request_meta, payload, opts \\ [])

@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