Conversation channels

A channel is the route that connects a person to Metnos. Web chat and Telegram have different interfaces, but both deliver requests to the same runtime. The medium and available features change; the rules governing actions do not.

On this page

  1. What a channel does
  2. Identity before message content
  3. Web chat
  4. The Telegram channel
  5. How Metnos handles a Telegram message
  6. Text, photos, location, and buttons
  7. Replies and deferred delivery
  8. The technical channel contract
  9. Limits and guarantees

What a channel does

The channel handles transport. It recognises the sender through an existing pairing, gathers text and attachments, calls the runtime, and returns the answer. It does not choose executors, bypass Vaglio, or decide which powers to grant.

PartResponsibility
ChannelReceives and sends messages and keeps the identifiers required by the transport.
RuntimeUnderstands the request, prepares the work, and coordinates executors.
ControlsCheck identity, authority, policy, placement, and required confirmations.

For example, “send Lucia the meeting summary on Telegram” does not require the requester to know her technical chat number. Metnos finds Lucia's paired Telegram channel and, if the action is allowed, delivers the message there.

Identity before message content

Each request is attributed using authenticated channel data. A name written in the message or displayed by Telegram cannot assign a role, switch users, or claim somebody else's resources.

Conversations, pending dialogues, approvals, and notices are scoped to the recognised user. Even a button click is checked again: knowing or forwarding a button's internal code does not authorise the linked action.

Browser and Telegram pairing are described in Pairing and identity.

Web chat

The browser takes a direct path. The page sends the request to the HTTP server, which authenticates the session and calls the runtime. It can return a complete JSON response or stream progress updates while the turn is running.

Web chat does not implement the polling cycle in the Channel contract: HTTP already has its natural request-and-response model. This is a transport difference, not a governance difference. Policy, Vaglio, executors, and user separation remain the same.

Available routes and methods are documented in HTTP API.

The Telegram channel

Telegram uses a small service process and the official Bot API. Metnos opens outbound connections to Telegram, so a home server does not need to expose an incoming port or configure a webhook.

The channel is enabled during installation when a bot token is provided. Metnos looks for that token, in order, in explicit configuration, environment variables, the encrypted credential store, and the legacy compatibility file. A normal installation uses the encrypted store.

The Telegram service is optional. On systems using systemd, it runs as the Metnos user's service, starts with the rest of the instance, and restarts after a failure.

How Metnos handles a Telegram message

  1. Metnos asks Telegram for new updates. The request may remain open for about 25 seconds, avoiding constant traffic when nothing arrives.
  2. The update becomes an internal message containing channel, sender, content, timestamp, identifier, and transport metadata.
  3. The service checks the pairing and resolves the logical user. The /start and /pair commands are the exception because their purpose is to create that pairing.
  4. If the update is a button click or a reply to an open dialogue, Metnos checks the recorded state. Otherwise it starts a normal runtime turn.
  5. It sends the result to the same chat and only then acknowledges the received update.

The identifier of the latest acknowledged update is stored atomically. If handling or storage fails, the identifier does not advance, and Telegram may redeliver the message on the next pass. This reduces the risk of losing a request during an abrupt shutdown.

Text, photos, location, and buttons

ContentBehaviour
TextIt becomes a request or a reply to an already open dialogue.
PhotosThey are downloaded only after the sender has been recognised. Closely timed album items are collected into one request, and every file remains subject to configured limits.
LocationIt may answer a location prompt or update the authenticated user's location. Sharing is always initiated by the user in Telegram.
ButtonsThey support choices, cancellation, and approval. Button data is accepted only while the matching state is valid and belongs to the same user.
Unsupported contentIt is acknowledged at transport level without being arbitrarily reinterpreted as a request.

Long replies are split to respect Telegram's limits. Formatting is adapted to the channel; if Telegram rejects formatted text, Metnos retries in plain text. A partial or uncertain delivery is reported as such, because retrying the whole response could duplicate the part already received.

Replies and deferred delivery

A reply normally returns through the channel that originated the turn. A different destination must be declared in the request and authorised. Metnos does not silently move a conversation between users or channels.

Some work finishes after the original turn has timed out, such as a remote executor waiting for its computer to return. Metnos then places the result in the user's private queue, and the Telegram service attempts delivery in later cycles without running the action again.

The technical channel contract

For polling-based transports, Metnos defines a very small Python contract:

class Channel(Protocol):
    name: str

    def poll(self) -> list[InboundMessage]: ...
    def send(self, recipient: str, message: OutboundMessage) -> dict: ...

InboundMessage keeps the sender, text, identifier, timestamp, and transport metadata. OutboundMessage contains text, an optional message to reply to, and buttons. Received objects are immutable: an arrived message is a fact to record, not a workspace to alter.

The contract separates transport mechanics from request semantics. A new adapter may normalise its own messages, but it must deliver them to the same runtime and honour the same identity checks.

Limits and guarantees

To learn how to open the web interface, continue with Open and use Metnos. For server details, continue with HTTP API.