Skip to content

Universal semantic message filtering for Telegram pipeline actions #462

@axisrow

Description

@axisrow

Implement universal pipeline message filtering based on structured Telegram message metadata instead of text heuristics.

Problem

Current pipeline filters cannot reliably distinguish Telegram service messages because the collector does not persist MessageService.action data from Telethon. As a result, pipelines like auto-react end up matching all messages or matching service messages only by fragile text checks.

Goal

Add a stable filtering model that works for all message types and exposes semantic categories in runtime, CLI, and web UI.

Scope

  • Persist structured message classification in messages
  • Add semantic mapping from raw Telethon service actions
  • Replace text-based service_message filter logic with generic structured filtering
  • Add CLI commands to inspect/set/clear pipeline filters
  • Update pipeline create/edit UI to use the new filter model
  • Keep legacy filters working through alias translation
  • Reconfigure pipeline id=1 to react only to join messages

Data model

Add:

  • message_kind
  • service_action_raw
  • service_action_semantic
  • service_action_payload_json
  • sender_kind

Initial semantic service categories

  • join
  • leave
  • pin
  • title_changed
  • photo_changed
  • migrate
  • created
  • other

Notes from Telethon docs

Telethon exposes service messages via MessageService.action, with raw action types including:

  • MessageActionChatAddUser
  • MessageActionChatJoinedByLink
  • MessageActionChatJoinedByRequest
  • MessageActionChatDeleteUser
  • MessageActionPinMessage
  • MessageActionChatEditTitle
  • MessageActionChatEditPhoto
  • MessageActionChatDeletePhoto
  • MessageActionChatMigrateTo
  • MessageActionChannelMigrateFrom

Acceptance criteria

  • Service-message filters work without reading message.text
  • Existing pipelines continue to run
  • CLI can set semantic filters directly
  • Web create/edit can configure semantic filters
  • Pipeline 1 can be configured to react only on join messages
  • Tests cover collector mapping, filter execution, CLI, and dry-run count

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions