Inbound message processing pipeline.
Handles incoming messages from channels:
- Resolves/creates room by external binding
- Resolves/creates participant by external ID
- Builds normalized Message struct
- Persists message via adapter
- Returns message with context for handler processing
Usage
case Ingest.ingest_incoming(MyApp.Messaging, TelegramChannel, "bot_123", incoming_data) do
{:ok, message, context} ->
# message is persisted, context contains room/participant info
{:error, reason} ->
# handle error
end
Summary
Functions
Process an incoming message from a channel.
Process an incoming message from a channel with ingest policy options.
Process an incoming message without deduplication check.
Process an incoming message without deduplication check and with ingest policy options.
Types
@type context() :: Jido.Messaging.Context.t()
@type incoming() :: Jido.Chat.Incoming.t() | map()
@type ingest_error() :: policy_denial() | security_denial() | term()
@type ingest_opts() :: keyword()
@type policy_denial() :: {:policy_denied, policy_stage(), atom(), String.t()}
@type policy_stage() :: :gating | :moderation
@type security_denial() :: Jido.Messaging.Security.security_denial()
Functions
@spec ingest_incoming(module(), module(), String.t(), incoming()) :: {:ok, Jido.Messaging.Message.t(), context()} | {:ok, :duplicate} | {:error, ingest_error()}
Process an incoming message from a channel.
Returns {:ok, message, context} on success where:
messageis the persisted Message structcontextcontains room, participant, and channel info for reply handling
Returns {:ok, :duplicate} if the message has already been processed.
@spec ingest_incoming(module(), module(), String.t(), incoming(), ingest_opts()) :: {:ok, Jido.Messaging.Message.t(), context()} | {:ok, :duplicate} | {:error, ingest_error()}
Process an incoming message from a channel with ingest policy options.
Options
:gaters- List of modules implementingJido.Messaging.Gatingbehaviour:gating_opts- Keyword options passed to each gater:gating_timeout_ms- Timeout per gater check (default:50):moderators- List of modules implementingJido.Messaging.Moderationbehaviour:moderation_opts- Keyword options passed to each moderator:moderation_timeout_ms- Timeout per moderator check (default:50):policy_timeout_fallback- Timeout fallback policy (:denyor:allow_with_flag):policy_error_fallback- Crash/error fallback policy (:denyor:allow_with_flag):security- Runtime overrides forJido.Messaging.Securityconfig:require_mention- RequireMsgContext.was_mentionedto be true:allowed_prefixes- Allowed command prefixes for parsed commands:mention_targets- Mention targets used to normalizewas_mentioned:command_prefixes- Command parser prefix candidates:command_max_text_bytes- Max message size for command parsing:mentions_max_text_bytes- Max message size for mention adapter parsing
@spec ingest_incoming!(module(), module(), String.t(), incoming()) :: {:ok, Jido.Messaging.Message.t(), context()} | {:error, ingest_error()}
Process an incoming message without deduplication check.
Use this when you've already verified the message is not a duplicate, or when deduplication is handled externally.
@spec ingest_incoming!(module(), module(), String.t(), incoming(), ingest_opts()) :: {:ok, Jido.Messaging.Message.t(), context()} | {:error, ingest_error()}
Process an incoming message without deduplication check and with ingest policy options.