Jido.Messaging (Jido Messaging v1.0.0)

Copy Markdown View Source

Messaging and notification system for the Jido ecosystem.

Usage

Define a messaging module in your application:

defmodule MyApp.Messaging do
  use Jido.Messaging,
    persistence: Jido.Messaging.Persistence.ETS
end

Add it to your supervision tree:

children = [
  MyApp.Messaging
]

Use the API:

{:ok, room} = MyApp.Messaging.create_room(%{type: :direct, name: "Chat"})
{:ok, message} = MyApp.Messaging.save_message(%{
  room_id: room.id,
  sender_id: "user_123",
  role: :user,
  content: [%{type: :text, text: "Hello!"}]
})
{:ok, messages} = MyApp.Messaging.list_messages(room.id)

Summary

Functions

Fetch runtime status for one bridge worker.

Create or ensure a bridge-backed room topology in one idempotent call.

Create a new participant

Create a new room

Create a binding between an internal room and an external platform

Delete adapter-scoped provider ingress subscription for a bridge.

Lookup a single directory entry.

Ensure adapter-scoped provider ingress subscription for a bridge.

Get a message by ID

Get a message by its external ID within a channel/instance context

Get a room by ID

Get room by external binding (without creating)

Get a thread by ID

List registered agents for a room.

List runtime status for all bridge workers.

List running bridge workers for an instance module.

List adapter-scoped provider ingress subscriptions for a bridge.

List all bindings for a room

Create or update bridge config.

Create or update room routing policy.

Resolve configured outbound adapter routes for a room.

Route outbound text through bridge bindings/policy for a room.

Route direct payload through bridge-config transform path into ingest.

Route webhook payload through bridge-config parse/verify path into ingest.

Route webhook request and return typed response + ingest outcome.

Save an already-constructed message struct (for updates)

Save a room struct directly (for custom IDs)

Save an already-constructed thread struct (for updates)

Start (or resume) an onboarding flow.

Fetch thread assignment for a room thread.

Unregister an agent from a room.

Functions

advance_onboarding(instance_module, onboarding_id, transition, metadata \\ %{}, opts \\ [])

Advance an onboarding flow.

assign_thread(instance_module, room_id, thread_id, agent_id)

Assign a thread to an agent.

bridge_status(instance_module, bridge_id)

Fetch runtime status for one bridge worker.

cancel_onboarding(instance_module, onboarding_id, metadata \\ %{}, opts \\ [])

Cancel an onboarding flow.

complete_onboarding(instance_module, onboarding_id, metadata \\ %{}, opts \\ [])

Complete an onboarding flow.

create_bridge_room(instance_module, attrs)

Create or ensure a bridge-backed room topology in one idempotent call.

This helper ensures:

  • optional bridge configs are upserted
  • room exists
  • bridge-scoped room bindings exist
  • optional routing policy exists

create_participant(runtime, attrs)

Create a new participant

create_room(runtime, attrs)

Create a new room

create_room_binding(runtime, room_id, channel, bridge_id, external_id, attrs)

Create a binding between an internal room and an external platform

delete_bridge_config(instance_module, bridge_id)

Delete bridge config.

delete_ingress_subscription(instance_module, bridge_id, subscription_id, opts \\ [])

Delete adapter-scoped provider ingress subscription for a bridge.

delete_message(runtime, message_id)

Delete a message

delete_room(runtime, room_id)

Delete a room

delete_room_binding(runtime, binding_id)

Delete a room binding

delete_routing_policy(instance_module, room_id)

Delete room routing policy.

directory_lookup(runtime, target, query, opts \\ [])

Lookup a single directory entry.

directory_search(runtime, target, query, opts \\ [])

Search directory entries.

ensure_ingress_subscription(instance_module, bridge_id, opts \\ [])

Ensure adapter-scoped provider ingress subscription for a bridge.

get_bridge_config(instance_module, bridge_id)

Fetch bridge config by id.

get_message(runtime, message_id)

Get a message by ID

get_message_by_external_id(runtime, channel, bridge_id, external_id)

Get a message by its external ID within a channel/instance context

get_onboarding(instance_module, onboarding_id)

Fetch an onboarding flow.

get_or_create_participant_by_external_id(runtime, channel, external_id, attrs)

Get or create participant by external ID

get_or_create_room_by_external_binding(runtime, channel, bridge_id, external_id, attrs)

Get or create room by external binding

get_participant(runtime, participant_id)

Get a participant by ID

get_room(runtime, room_id)

Get a room by ID

get_room_by_external_binding(runtime, channel, bridge_id, external_id)

Get room by external binding (without creating)

get_routing_policy(instance_module, room_id)

Fetch room routing policy.

get_thread(runtime, thread_id)

Get a thread by ID

get_thread_by_external_id(runtime, room_id, external_thread_id)

Get a thread by external thread ID

get_thread_by_root_message(runtime, room_id, root_message_id)

Get a thread by root message ID

list_agents(instance_module, room_id)

List registered agents for a room.

list_bridge_configs(instance_module, opts \\ [])

List bridge configs.

list_bridge_status(instance_module)

List runtime status for all bridge workers.

list_bridges(instance_module)

List running bridge workers for an instance module.

list_ingress_subscriptions(instance_module, bridge_id, opts \\ [])

List adapter-scoped provider ingress subscriptions for a bridge.

list_messages(runtime, room_id, opts \\ [])

List messages for a room

list_room_bindings(runtime, room_id)

List all bindings for a room

list_rooms(runtime, opts \\ [])

List rooms

list_threads(runtime, room_id, opts \\ [])

List threads for a room

put_bridge_config(instance_module, attrs)

Create or update bridge config.

put_routing_policy(instance_module, room_id, attrs)

Create or update room routing policy.

register_agent(instance_module, room_id, agent_spec, opts \\ [])

Register an agent with a room.

resolve_outbound_routes(instance_module, room_id, opts \\ [])

Resolve configured outbound adapter routes for a room.

resume_onboarding(instance_module, onboarding_id)

Resume an onboarding flow.

route_outbound(instance_module, room_id, text, opts \\ [])

Route outbound text through bridge bindings/policy for a room.

route_payload(instance_module, bridge_id, payload, opts \\ [])

Route direct payload through bridge-config transform path into ingest.

route_webhook(instance_module, bridge_id, payload, opts \\ [])

Route webhook payload through bridge-config parse/verify path into ingest.

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

Route webhook request and return typed response + ingest outcome.

save_message(runtime, attrs)

Save a message

save_message_struct(runtime, message)

Save an already-constructed message struct (for updates)

save_room(runtime, room)

Save a room struct directly (for custom IDs)

save_thread(runtime, attrs)

Save a thread

save_thread_struct(runtime, thread)

Save an already-constructed thread struct (for updates)

start_onboarding(instance_module, attrs, opts \\ [])

Start (or resume) an onboarding flow.

thread_assignment(instance_module, room_id, thread_id)

Fetch thread assignment for a room thread.

unassign_thread(instance_module, room_id, thread_id)

Unassign a thread.

unregister_agent(instance_module, room_id, agent_id)

Unregister an agent from a room.

update_message_external_id(runtime, message_id, external_id)

Update a message's external_id

whereis_onboarding_worker(instance_module, onboarding_id)

Find onboarding worker PID.