preview_rule
Test a candidate Telegram alert rule against real message history to see what it would match before creating it, so you can judge if it is too broad or narrow.
Instructions
Test a candidate rule against real message history before creating it.
Shows what the rule would have matched, so the user can judge whether it is too broad or too narrow while they are still writing it. Creates nothing. Use this during setup, before add_alert_rule, and show the user the samples — a rule that looks sensible in the abstract often turns out to match mostly noise.
The matched samples are also the right input for testing draft criteria: read them and decide which ones a criterion should keep, then tell the user which would have been surfaced and which filtered out.
Args: pattern: the candidate pattern. match_type: 'substring', 'word', or 'regex'. case_sensitive: match case exactly. chat_ids: restrict to these chats; omit to search everywhere. search_hint: a plain word to search Telegram for when match_type is 'regex' — Telegram cannot search by regex, so this narrows what gets scanned locally. Required for an unscoped regex preview. limit: max samples to return. scan: how many messages to pull and test.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scan | No | ||
| limit | No | ||
| pattern | Yes | ||
| chat_ids | No | ||
| match_type | No | substring | |
| search_hint | No | ||
| case_sensitive | No |