Noizu.Comms (noizu_comms v0.1.0)

Copy Markdown View Source

Channel-agnostic outbound messaging (Discord, Slack, Telegram, WhatsApp).

One call surface, one policy model:

Noizu.Comms.send("ops-alerts", "deploy finished", level: :success)
Noizu.Comms.send("discord://channel/123456789012345678", "**hey**")
Noizu.Comms.broadcast(["ops-alerts", "releases"], "build ok")

Targets are URIs or named aliases resolved from a YAML targets file (COMMS_TARGETS_FILE, default ~/.config/noizu-comms/targets.yaml). Each channel ships as an adapter with the channel SDK as an optional dependency, so a service pulls in only the channels it uses.

Architecture (contract: docs/arch/comms-channels.md):

            agents (Claude Code, tobor crew)      services / hooks
                     │ MCP                              │ library call
     ┌───────────────┼──────────────────────┐           │
     │ comms-mcp (one tool surface)         │◄──────────┘ Noizu.Comms.send/3
     └───────────────┬──────────────────────┘
                     │ noizu_comms: Message · Target · Router · Policy
     ┌───────────┬───┴────────┬──────────────┬──────────────┐
     │ Discord   │ Slack      │ Telegram     │ WhatsApp     │  adapters
     ├───────────┼────────────┼──────────────┼──────────────┤
     │noizu_     │noizu_slack │noizu_telegram│noizu_whatsapp│  SDKs
     │discord    │            │              │              │
     └───────────┴────────────┴──────────────┴──────────────┘

Summary

Functions

Fans out to several targets concurrently (Task.async_stream).

Parses a target URI or alias into a %Noizu.Comms.Target{}.

Sends message_or_text (a %Noizu.Comms.Message{} or a text binary) to target_or_alias.

Functions

broadcast(targets, message_or_text, opts \\ [])

Fans out to several targets concurrently (Task.async_stream).

Returns [{target_or_alias, result}] in input order, where result is the same shape as send/3.

parse_target(uri)

@spec parse_target(String.t()) ::
  {:ok, Noizu.Comms.Target.t()} | {:error, Noizu.Comms.Error.t()}

Parses a target URI or alias into a %Noizu.Comms.Target{}.

send(target_or_alias, message_or_text, opts \\ [])

Sends message_or_text (a %Noizu.Comms.Message{} or a text binary) to target_or_alias.

Target forms: full URIs (discord://channel/<snowflake>, discord://webhook/<alias>, slack://channel/<id>, slack://webhook/<alias>, telegram://chat/<id-or-@username>, whatsapp://<E.164>), a bare config alias (ops-alerts), or a %Noizu.Comms.Target{}.

Options are merged into the message (:title, :fields, :level, :attachments, :reply_to, :thread, :silent, :format, :idempotency_key, :metadata) and forwarded to the adapter (:req_options, :retry, :client).

Returns {:ok, %Noizu.Comms.Receipt{}} or {:error, %Noizu.Comms.Error{}}.