# Telegram Evidence: Link, Repost and Edit Tracker (`halcyon_marram/telegram-evidence`) Actor

Monitor public Telegram with explicit aliases, observed edits and source evidence. Optional paid API provider adds forward counts, numeric origins, replies and public groups. Export normalized messages, interactions, graphs and an offline report.

- **URL**: https://apify.com/halcyon_marram/telegram-evidence.md
- **Developed by:** [Telegram Evidence](https://apify.com/halcyon_marram) (community)
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 90.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Telegram Evidence

Turn a set of public Telegram channels into a traceable account of shared links, reposts and observed edits. Every finding points back to source messages. Every run reports what it could and could not collect.

**Version 0.4.4. Beta for analysts and researchers.** Compare public channels, inspect which messages share content, and hand a source-linked report to a colleague. No Telegram account or LLM key is required. It does not identify bots, misinformation, intent, or the original author of a story.

### Choose the source

`collectionSource: "public_web"` is the default. It reads accessible `t.me/s` previews without a Telegram account. `collectionSource: "telegram_api"` explicitly starts paid runs of `truefetch/telegram-channel-message` through your Apify account. The provider advertises public channels, groups and forums, including ones without a web preview. No private invitation links are accepted. These published modes do not use an operator Telegram account. The Actor does not validate how the external provider operates its accounts.

| Field | Public web | Optional API provider |
| --- | --- | --- |
| Message text, time, links | Visible preview | Provider record |
| Forward origin | Public username/post when exposed | Numeric origin and message ID when returned |
| Forward count | Unknown (`null`) | Provider count, including a real zero |
| Reactions, reply count and reply-to | Unknown (`null`) | Preserved when returned |
| Edit timestamp | Visible marker only | Provider `edit_date` when returned |
| Observed edit history | Comparison across revisits | Comparison across reobserved provider records |
| Coverage | Paginated accessible preview | Bounded provider sample; no resume cursor |

API collection requires 1-10 explicit usernames and `discoverChannels: false`. `sourceMaxChargeUsd` defaults to $0.50 total, divided between channels, with at least $0.02 per channel. It caps provider charges, excludes this Actor's platform usage, and does not promise a fixed price. The source never changes automatically and media downloads are disabled. An Apify token is required locally; hosted runs use the platform-provided token.

**Coverage limitation:** TrueFetch reads oldest first from the start of the requested UTC day. The exact `since`/`until` filter is applied after receipt. The message cap can therefore be consumed by earlier posts. API coverage is always marked partial because the provider has no end cursor or verifiable completeness signal. Free account/provider restrictions may further reduce results. Increase message limits to reach the desired interval. Monitoring compares records actually reobserved and cannot guarantee coverage of unseen edits.

```json
{
  "mode": "scrape",
  "collectionSource": "telegram_api",
  "channels": ["telegram"],
  "discoverChannels": false,
  "since": "2026-11-11",
  "until": "2026-11-12",
  "maxMessagesPerChannel": 200,
  "maxMessages": 200,
  "sourceMaxChargeUsd": 0.10
}
```

Each provider call has a 120-second run limit; local start/read/wait/cancel operations also have deadlines. Paid starts are not retried. A lost start acknowledgement is marked `startOutcomeUnknown`: check your provider runs before retrying. `SUMMARY.json.coverage` preserves run ID, dataset ID, record count, observed charges when reported, invalid rows and exact-window exclusions. Each API message includes the SHA-256 of the received provider record. This is evidence of what was received, not an independent attestation of Telegram authenticity.

### Search by topic

Enter phrases such as `Jordi Wild` and `Abascal` in **Search terms** and click **Start**. Channels are optional. The Actor discovers indexed public Telegram channels using `apify/google-search-scraper`, collects their public previews and keeps posts matching the terms in the requested interval. Leave dates blank for the last seven days.

For a controlled monitor, start with a team-curated channel list. Discovery is supplemental, not a substitute for source selection. `SOURCE_CANDIDATES.json` suggests public usernames cited by matching messages, with source-post evidence. It never collects those suggestions automatically or assigns ideology or reliability.

Use explicit aliases and exclusions when exact names are too narrow:

```json
{
  "searchTerms": ["Pedro Sánchez"],
  "searchAliases": {"Pedro Sánchez": ["Sánchez", "Sanxe"]},
  "ignoreAccents": true,
  "excludeTerms": ["Jorge Hernández Sánchez"]
}
```

This is a fragment to merge with your channels and dates. The exclusion is an example from an observed namesake, not a general identity resolver. `matchedTerms` names the canonical query; `matchedVariants` records the literal variants that matched. Aliases can add false positives and need human review. Optional accent folding preserves ñ and leaves original text and evidence hashes unchanged. Google discovery uses canonical terms only, so aliases do not silently multiply paid queries. Changing aliases, accent behavior, exclusions or collection source requires a new monitor name.

Choose **Any term** (OR) or **All terms** (AND). Matching ignores case and recognizes joined hashtags such as `#JordiWild`. It does not interpret regular expressions, infer sentiment or transcribe media. A standalone pinned-message notice is excluded from topic results.

Start with **1,000 inspected messages**, **100 per channel**, **15 discovered channels**, **512 MB** and a **300-second timeout**. The message budget bounds collection before filtering, so 1,000 inspected posts can yield 10 matches or none. The report shows inspected posts, matches per term, intersection counts, channels with matches and collection limits. `DISCOVERY.json` records discovery queries, source URLs, candidates and the provider run ID.

Discovery searches the web index, not every Telegram channel. Old indexed pages can identify a channel whose recent posts contain no matches. The default web source does not expose forward counts or API reply metadata. Private chats, media transcription and complete historical archives are unsupported. Empty results do not prove absence.

Discovery API calls have deadlines: 15 seconds to start or read results, 130 seconds to await the provider, and 10 seconds to request cancellation. Paid starts are not automatically retried. If an acknowledgement is lost, `DISCOVERY.json` marks `startOutcomeUnknown`; check provider runs before starting again. A child accepted by Apify has its own 120-second timeout and configured provider charge cap. An unconfirmed cancellation is not proof that the child stopped.

**Costs:** no additional developer fee for Telegram Evidence. Apify platform usage applies. Automatic discovery separately runs Google's Search Results Scraper at its current per-page pricing. Its charge cap defaults to **$0.50**, the provider's accepted minimum cap, not a fixed fee. At most 5 terms and 3 pages per term are allowed. AI, ads and lead-enrichment add-ons are disabled. The cap excludes this Actor's platform usage. Turn off discovery and supply channels to avoid the search-provider charge.

For known channels, leave Search terms empty. For topic filtering within your own list, supply channels and terms and disable **Discover channels automatically**. The existing collection and analyze modes remain compatible.

After the run succeeds, open **Storage → Key-value store → REPORT.html**, or **Interactive evidence report** where that output link is shown. Start with **Cobertura y siguientes pasos**: it explains each channel’s limit and how to continue.

Use channel, text, UTC date and change filters to narrow the messages and graph together. Click **Examinar evidencia** to compare full texts, publication dates, collection dates and source links inside the report. **Exportar vista filtrada (CSV)** exports every filtered message, including rows beyond the current page; **Informe completo (JSON)** always exports the full analysis. **Mostrar 300 más** makes records after the first 300 accessible. A monitoring run can deliver zero new messages while the report still shows retained context.

Use **Ver CSV para copiar** if a CSV download does not start. It displays the exact filtered CSV for selection and copying. For full JSON, use Complete analysis or Storage → Key-value store → RESULT.json. Support: open the Actor Issues tab with the run ID and expected behavior, without tokens or private data.

#### Repeat monitoring and automation

Give the workflow a **Monitor name**, enable **Only new or edited messages**, save a Task, and schedule it in your Apify account. Start with a narrow date interval so a large backlog does not delay new posts. Use a distinct monitor name for each client or topic.

Dataset field `changeStatus` is `new`, `edited`, `unchanged`, or `retained` (older context not fetched this run). Route edits by this field, or read `EVENTS.json` for before/after text. Deduplicate repeated deliveries by `eventId` and content hash. The Actor sends no emails or messages on its own.

#### Choose this when

You need a reproducible review of shared URLs, similar texts, visible forwards and observed revisions across discovered or known public channels. Global Telegram search and media transcription are not supported. The optional API source adds provider-supplied counters, reactions, reply IDs and numeric forward origins for public usernames; it does not crawl comment threads automatically.

### What it delivers

| Output | Purpose |
| --- | --- |
| Message dataset | Normalized posts, timestamps, visible forwards, links, rounded-view flags, content hashes and preview content availability |
| `REPORT.html` | Offline, searchable Spanish-language report with channel graph and source links; if storage fails, use the dataset and RESULT.json and check SUMMARY.json.outputStatus |
| `GRAPH.json` | Channel nodes and typed evidence relations, suitable for customer analysis and network tools |
| `GROUPS.json` | Shared-link and exact-text groups, ordered by publication timestamp |
| `SIMILARITY.json` | Near-duplicate text pairs with measured lexical similarity and member IDs |
| `TIMELINE.json` | Shared-content publication timeline, collection timestamps and retained observed edits |
| `EVENTS.json` | Newly observed messages, observed content edits, preview availability/attribution changes and rapid-spread threshold crossings |
| `DISCOVERY.json` | Indexed candidates, source URLs, query provenance and provider status |
| `SUMMARY.json` | Collection coverage, invalid records, limits reached and method settings |
| `RESULT.json` | Complete analysis, including retained context |
| `MESSAGES.csv` | Spreadsheet export with formula-injection protection |
| `MESSAGES.norm.jsonl` | Portable message schema, including metrics, provenance and matching variants |
| `INTERACTIONS.jsonl` | Explicit forward, reply and Telegram message-link edges, one JSON object per line |
| `SOURCE_CANDIDATES.json` | Cited public usernames to review for the next collection |

The report has no trackers, external assets, model calls or remote scripts. Message links open only when clicked. The default dataset contains messages; events and relations are separate outputs so downstream consumers do not have to untangle mixed record types.

### Normalized export contract

Both JSONL files use `schema_version: "telegram-evidence/1"`. This is a documented portable export. Customer integrations should map these fields to their own ingestion schema.

Messages carry `id`, `native_id`, `author_id`, `author_username`, `url`, `published_at`, `collected_at`, `text`, `content_hash`, `metrics`, `forward`, `reply_to`, `edit_date`, `links`, `media_types`, `media_urls`, `collection_source` and `provenance`. Missing API metrics remain null. `media_urls` only preserves safe URLs actually returned; text-only provider collection may return none. Public channel posts are represented as authored by their channel; this does not assert the identity of a person who submitted a group message.

Identifiers use `telegram:peer:<numeric-id>` where a provider ID exists, otherwise `telegram:username:<handle>`. Message IDs append `:<native-message-id>`. Numeric origin IDs are preserved without inventing usernames or public URLs. Consumers joining web and API datasets should retain an explicit ID-to-username mapping; renamed usernames are not resolved automatically.

Interaction direction is **observed message to referenced origin**: `source_message_id` is the post containing the forward/reply/link, and `target_message_id` is the referenced post when known. This differs from the presentation graph, which shows origin to observing channel. Each edge records a stable `id`, `type`, both endpoints, `evidence_type`, `evidence_url`, timestamps and content hash. Text similarity does not create an interaction. The exports follow the incremental dataset when `onlyChanges` is enabled; `RESULT.json` and its graph retain the broader analysis context.

### Run locally

Python 3.12 is the tested runtime. No Telegram login or LLM key is required.

```bash
python -m venv .venv
.venv/bin/pip install -r requirements.lock
.venv/bin/pip install --no-deps .
.venv/bin/python -m telegram_evidence.main --input examples/demo.json --output output/demo
```

Open `output/demo/REPORT.html`. It is prominently labeled synthetic.

To collect public channels:

```bash
.venv/bin/python -m telegram_evidence.main --input examples/monitor.json --output output/monitor
```

`scrape` mode defaults to the last seven days. Set `since` and `until` as YYYY-MM-DD dates (inclusive UTC days) or ISO timestamps with timezone for a different interval. Messages are read from the public `t.me/s/` preview, without browser rendering, login, private groups or membership collection. Automatic discovery searches indexed public channel pages, then applies dates to the collected posts; it is not global Telegram search.

The global message budget is divided across the requested channels before collection, so it limits work as well as output. Unused per-channel budgets are not redistributed. Page and message limits can reduce coverage; those runs are marked partial. The HTTP collector retries transient failures and 429 responses, does not follow redirects, and never fetches outbound message links.

Public-web collection has a shared time budget of at most 180 seconds, shortened for cloud runs to leave time for output delivery. Time is shared across remaining channels. When it expires, completed pages are retained, coverage reports `collection_time_budget`, and a named monitor can resume on its next run. Discovery time also consumes this budget. This bounds collection, not the whole analysis or Actor run. Each preview download additionally has a 60-second total deadline, including retries. Identical duplicate posts within a page count once. Conflicting versions of one post stop that page with `invalid_page_retry_required`; the monitor keeps its last safe resume point. Malformed or numerically unsafe view counters become unknown without discarding the post.

To run discovery locally, set `APIFY_TOKEN` securely in your environment and use `examples/topic-search.json`. No extra search API key is needed on Apify.

### Analyze an existing dataset

Use `mode: "analyze"` and provide `messages` with this contract:

```json
{
  "mode": "analyze",
  "messages": [
    {
      "id": "channelname/123",
      "date": "2026-11-12T10:00:00Z",
      "text": "The message as collected.",
      "links": ["https://example.org/source"],
      "forwardedFrom": "originalchannel/42",
      "fetchedAt": "2026-11-12T10:05:00Z"
    }
  ]
}
```

`id` can also be a public Telegram post URL. `date` and `text` are required for meaningful text analysis; missing text is accepted for media records. The optional `forwardedFrom` must be a public channel username or post URL. `fetchedAt` defaults to processing time if absent. Invalid records are reported. An all-invalid import fails rather than appearing successful. Adapt third-party field names to this contract before importing.

### Method

1. **Exact text:** Unicode NFKC, case folding and whitespace normalization. Negations, numbers, punctuation and accents remain. The default minimum is 100 normalized characters, to avoid grouping short everyday phrases.
2. **Shared links:** normalize host names and default ports; remove only explicit `utm_*`, `fbclid`, `gclid`, `dclid`, `msclkid`, `mc_cid`, and `mc_eid` tracking fields. Preserve meaningful query parameters, repeated parameter order, path, scheme and fragment. Redirects and URL shorteners are not resolved.
3. **Similar text:** Jaccard similarity over sets of three-word shingles. Default threshold 0.8. A short paragraph with one changed word can fall below this threshold; use 0.75 for a more permissive review. Similarity is lexical, not semantic agreement. Opposing claims with shared wording may be flagged. There is no cross-language semantic matching, image matching, OCR, or audio transcription.
4. **Explicit forwards:** source attribution visible in Telegram's preview. A channel can appear in the graph as an external source without its messages having been collected.
5. **Direct message links:** visible links to a public Telegram post create a reference relation. The cited channel can be external to the sample. The link does not establish agreement, origin or causality.
6. **Rapid spread:** the first observed window in a content group reaching the configured number of distinct channels, default three in 30 minutes. A threshold crossing is a review cue, not a statistical anomaly score or a coordination finding.

Shared-content graph edges form a compact star from the earliest sampled message to the first message in each other channel. They are not a reconstructed forwarding chain. Equal publication timestamps are labeled simultaneous; ordering tied IDs is only a deterministic presentation choice. Similarity edges are undirected. All near-pair member IDs are available even where the compact graph uses representatives.

`firstObservedAt` means earliest **publication timestamp within the analyzed sample**, not the time a researcher first collected the message and not the original publication across all Telegram. Actual collection timestamps are stored as `fetchedAt`.

### Monitoring

A topic monitor freezes its discovered channel set after the first successful discovery, avoiding repeat search charges and changing samples. Use a new monitor name to refresh discovery or change terms, match mode, country or channel scope. Nonmatching observations remain in monitor state so an edit that enters or leaves the topic can be detected. Results contain matching messages; edit events include `searchMatchBefore` and `searchMatchAfter`.

Set a distinct `monitorName` for each workflow. Locally, state is written atomically under `state/` with an exclusive file lock. On Apify it is stored in the named key-value store `telegram-evidence-{monitorName}`.

Cloud runs acquire an exclusive, atomic Apify request-queue lease before reading monitor state. A second run using the same name fails before collection. Leases last two minutes, renew every 30 seconds and are checked before state commits. Lock operations have a ten-second deadline. Failed renewal stops the run; a hard-crashed run's lease becomes available by expiry, up to two minutes after the last successful renewal. Older builds can retain their former ten-minute lease until it expires. The named queue `telegram-evidence-lock-{monitorName}` contains one internal sentinel that is never fetched. Do not process or modify that queue externally. This is a lease, not a transactional storage system: an extreme process pause longer than the lease is outside its safety guarantee.

When imported records repeat a message identifier, the newest fetchedAt observation wins, including copies with identical content. Older copies cannot roll back the observation timestamp. Conflicting copies tied at the newest fetchedAt are quarantined and reported as invalid; a strictly newer observation resolves the tie. A conflict with retained content at the same fetchedAt is ignored with an explicit warning. An edit requires a later observation time. These checks also apply to availability and attribution transitions.

State is committed only after required JSON/CSV outputs and dataset delivery succeed. Cloud output work has a total deadline of at most 90 seconds, shortened when needed to reserve 15 seconds before the Actor deadline. Individual operations have bounded waits. Idempotent record writes can retry once for transient errors; this Actor does not retry an ambiguous dataset push. A failure before state commit can repeat outputs on the next run. Consumers should deduplicate by eventId and message contentHash. Delivery is not exactly once.

HTML output is optional for data delivery. If generating REPORT.html fails or both bounded attempts to save it fail, the Actor continues saving the data and records `outputStatus.htmlReport: "unavailable"` plus `html_report_unavailable` in SUMMARY.json and RESULT.json. The final run message directs users to the dataset and Complete analysis. Successful HTML writes are marked `available`. Failure of a required output stops delivery instead of advancing the monitor. A timeout during the state-write acknowledgement is ambiguous and requires checking the saved state and outputs.

With public_web collection, each channel has a durable cursor. If a page or message limit interrupts collection, the next run resumes before the last delivered message, including interruptions in the middle of a page. The upper message ID and time interval are frozen until that backlog is drained. New arrivals are picked up in the following interval. A large initial historical window can therefore delay fresh-post monitoring; start with a narrow window. Unexpected or malformed pages stop cursor advancement and are reported. Known stickers are recognized. When Telegram explicitly displays an unsupported-content notice, the Actor preserves a metadata record with its source link, date, empty text and `contentStatus: "unavailable"`, then continues pagination. This is not recovered content: the run remains partial and `SUMMARY.json.unavailableMessages` lists the affected posts, including retained observations before keyword filtering. Such posts cannot match keywords without visible text. Unknown empty structures, invalid identifiers and invalid dates still block advancement. Telegram preview limits prevent any promise of complete history.

Use a new monitor name when changing channels, mode, since or until. Limits can change within the same monitor. Legacy monitors are migrated from their highest observed IDs; this cannot reconstruct gaps from earlier versions. When the total message budget is smaller than the number of channels, the allocation rotates between runs.

Retention defaults to 30 days since last observation, capped at 10,000 messages. Eviction is reported and may make reobserved posts count as new. Observed edits are retained separately for the retention period, up to 1,000 revisions and five million text characters. This is bounded revision history, not permanent forensic preservation. Metrics such as view counts do not produce edit events. Forward attribution can differ between public preview pages. These transitions are recorded as `forward_attribution_changed` events with before/after attribution, not as message edits. They do not enter the `onlyChanges` message dataset or edit history. `contentHash` still covers all observed content fields, including public username attribution, and may therefore change without an edit event. Numeric provider forward metadata is preserved separately and does not enter the legacy content hash; the provider record hash covers the full received record. Text, links, media types and publication-date changes remain edit events, with `changedFields` recorded. Changes into or out of unavailable preview content are separate `content_availability_changed` observations, not author-edit claims. They do not enter the incremental changed-message dataset. New metadata-only posts are marked as new; topic searches exclude them when no text matches. Availability observations remain in EVENTS.json for the run; this is not permanent availability history.

`onlyChanges` limits the dataset to new or changed records. Graphs and timelines use retained context, prioritizing newly collected records when the analysis budget is full. Timeline rows distinguish publication time from collection time and give delay relative to the earliest publication in the sampled group. They do not establish the original source or a causal forwarding chain. A missing message is never automatically called deleted. Edits outside pages revisited by the collector remain undetectable.

Limits: 100 channels, 10,000 analyzed messages, 40,000 characters per message, 20 million UTF-8 text bytes and 25 million serialized record bytes (including links and metadata) per input batch, analysis context and retained monitor state, 250,000 near-text comparisons by default, and one million indexed shingles. Common-shingle postings are capped at 200 representatives. Near-match recall is incomplete when these limits are reached; the summary reports it. A batch over either byte budget fails with diagnostics and does not confirm dataset or state delivery. Older retained context can be evicted to meet the same byte budget; this is reported and can make reobserved messages appear new. Unicode consumes more bytes than ASCII. These bounds are safeguards, not throughput guarantees.

### Deploy to Apify

The package contains the Dockerfile, actor definition, input schema, output schema and dataset view. Install the official Apify CLI, authenticate to your account, then run:

```bash
npx apify-cli login
npx apify-cli push
```

Alternatively, `scripts/deploy.py` creates a **new private Actor**, builds it, and performs a synthetic smoke test using `APIFY_TOKEN` supplied through your environment. It never publishes to Store or changes an existing Actor. The token is never written to files or printed.

```bash
.venv/bin/python scripts/deploy.py
```

The first deployment should use 512 MB and a five-minute timeout. Run a small live collection next and inspect `SUMMARY.json`. Publishing and pricing should follow a measured comparison of cost, completeness and repeat-run behavior. This beta does not emit paid events or claim free platform execution; Apify infrastructure usage can still incur charges.

Use Apify schedules and run-completion integrations to deliver `EVENTS.json` to your own workflow. This code does not automatically send email, Slack messages or arbitrary webhooks.

### Validation

```bash
.venv/bin/pip install pytest==8.4.1
.venv/bin/python -m pytest -q
```

See `VALIDATION.md` for the exact tested scope and the remaining deployment checks. HTML fixtures were collected from the public Telegram and Pavel Durov channels through Apify on 12 November 2026. They are test observations, not authored sample content or evidence of coordinated activity.

### Ownership

Copyright 2026 Miguel Guerrero. All rights reserved. No public redistribution license is granted by this package. Source and test artifacts remain available to the owner for modification and deployment. Third-party dependencies and public source material retain their respective terms.

#### v0.4.1 integrity and export limits

Conflicting native origins, chat IDs or reply targets at the same observation timestamp are rejected rather than resolved by input order. A strictly newer observation can update attribution; this remains distinct from an author edit. Invalid counters become null. Explicit and text-discovered links share a 200-URL limit per message.

INTERACTIONS.jsonl is limited to 25,000 rows and 16 million UTF-8 bytes. `SUMMARY.json.exports.interactions` gives rows, bytes and `complete`; exceeding either limit produces a visible warning. This flag describes export truncation only, never collection completeness. Source suggestions inspect at most 100,000 references and track at most 10,000 distinct usernames, returning the top 100. Their `complete` flag and summary warning disclose a truncated scan; rankings then describe only the scanned prefix. Split large jobs into smaller windows for complete exports.

#### v0.4.2 customer-neutral product and managed-service preparation

Reports and exports are independent of any client organization. Cross-channel native replies retain their actual peer identity. The source package additionally includes an experimental operator-managed collector, durable encrypted queue, customer authentication and limits. **Managed collection is not activated or offered in the published input form yet.** It requires a dedicated operator Telegram account, server deployment and live acceptance tests. Web and TrueFetch modes remain available. See `MANAGED-OPERATIONS.md` for the exact activation gate and limitations.

### Managed native service status

An operator-owned native collector is staged privately. Customers do not connect their own Telegram account. It is not enabled for customers yet: a dedicated account and live acceptance tests are still required. Version 0.4.4 keeps customer queue turns fair across UTC midnight and extends resumable time budgets to public-web collection. Dedicated account acquisition is paused; native service activation remains pending. See `MANAGED-OPERATIONS.md` for activation and verified limits. Fragment permits accounts without a SIM, but still requires an owned +888 number and wallet. No free email-only registration is implemented.

# Actor input Schema

## `mode` (type: `string`):

Choose public collection, imported records, or an explicitly synthetic demo.

## `collectionSource` (type: `string`):

Web: no Telegram account. API: paid TrueFetch provider, public channels/groups without web previews, forward counts and numeric origins. Requires 1-10 explicit channels and discoverChannels=false. No private chats or guarantee of completeness.

## `channels` (type: `array`):

Explicit public channel or group usernames. Web collection requires t.me/s previews. API source accepts public usernames through the paid provider. Private invite links are not supported.

## `searchTerms` (type: `array`):

Canonical literal terms, up to 5. Aliases and accent folding apply after collection. Google discovery is optional and searches canonical terms only; team-curated channels give a controlled monitoring scope.

## `searchAliases` (type: `object`):

Example: {"Pedro Sánchez":\["Sánchez","Sanxe"]}. Up to 5 aliases per existing search term. All mode requires each entity, not each spelling. Ambiguous surnames need review.

## `ignoreAccents` (type: `boolean`):

Folds acute/grave/circumflex accents and diaeresis; preserves ñ. Does not alter original text or evidence hashes.

## `excludeTerms` (type: `array`):

Up to 5 explicit literal exclusions. Example: Jorge Hernández Sánchez. Applies to collection output and analysis, not Google discovery. Excluded posts remain in monitor state for change tracking.

## `matchMode` (type: `string`):

Any: posts containing at least one term. All: posts containing every term. Matching ignores case and accepts joined hashtags. Counts use visible text only.

## `discoverChannels` (type: `boolean`):

Optional Google index discovery, supplemental to explicit channels. This is not a complete Telegram search. Disable for API collection. Provider charges apply.

## `sourceMaxChargeUsd` (type: `number`):

Only used for telegram_api. Divided across channels, minimum $0.02 each. Excludes this Actor platform usage. Provider has per-run and per-result charges. No automatic fallback or media downloads.

## `since` (type: `string`):

YYYY-MM-DD or ISO timestamp with timezone. A date starts at 00:00 UTC. Leave blank for the last 7 days.

## `until` (type: `string`):

YYYY-MM-DD includes the whole day in UTC; ISO timestamps keep their exact time. Leave blank for no upper boundary.

## `maxMessages` (type: `integer`):

Maximum posts inspected across all selected channels, before keyword filtering. The budget is split across channels. Output may be smaller.

## `maxMessagesPerChannel` (type: `integer`):

Maximum messages per channel per run. Start with 20; increase for deeper history.

## `monitorName` (type: `string`):

Optional. Reuse a unique name for repeat monitoring. Overlapping runs are rejected. Use a new name when changing channels or dates.

## `onlyChanges` (type: `boolean`):

Requires monitorName. Report and graph retain analysis context.

## `retentionDays` (type: `integer`):

Keep state and observed edit history for this many days since last observation.

## `stateMaxMessages` (type: `integer`):

Maximum messages retained between runs. Eviction is reported and can make old posts count as new.

## `maxDiscoveryChannels` (type: `integer`):

Upper limit on discovered channels to collect, in addition to your manual list. Results are distributed across terms.

## `discoveryPagesPerTerm` (type: `integer`):

Each page usually has about 10 organic results. More pages can discover additional channels, at additional provider cost.

## `discoveryMaxChargeUsd` (type: `number`):

Cap for the separate Google Search Results Scraper run. Apify requires at least $0.50 for this cap; this is not a fixed fee. This Actor platform usage is additional. AI and enrichment add-ons are disabled.

## `discoveryCountry` (type: `string`):

Two-letter lowercase Google country code. Does not restrict the language of collected Telegram posts.

## `messages` (type: `array`):

Analyze mode: objects with id (channel/number), date (ISO with timezone), text, optional links and forwardedFrom. Maximum 10,000.

## `maxPagesPerChannel` (type: `integer`):

Maximum preview pages fetched per channel. A limit can leave partial coverage; named monitors resume next run.

## `maxConcurrency` (type: `integer`):

Number of channel requests processed in parallel, between 1 and 5.

## `requestDelaySeconds` (type: `number`):

Pause between pages of the same channel. Default 1 second; retries respect temporary failures.

## `similarityThreshold` (type: `number`):

Word-triple Jaccard threshold. 0.8 is conservative; 0.75 finds more candidates. Lexical overlap is not semantic agreement.

## `minTextLength` (type: `integer`):

Minimum normalized characters for exact-text and similar-text comparison. Shared links are analyzed regardless of text length.

## `maxComparisons` (type: `integer`):

Hard cap for similar-text comparisons. Reaching it is reported and can miss matches.

## `rapidSpreadMinutes` (type: `integer`):

Flag a group reaching the channel threshold within this interval. This does not establish coordination.

## `rapidSpreadMinChannels` (type: `integer`):

Distinct channels sharing content within the configured window.

## `proxyConfiguration` (type: `object`):

Optional Apify proxy. The local CLI uses inherited network proxy settings.

## Actor input object example

```json
{
  "mode": "scrape",
  "collectionSource": "public_web",
  "searchTerms": [
    "Jordi Wild",
    "Abascal"
  ],
  "searchAliases": {},
  "ignoreAccents": false,
  "excludeTerms": [],
  "matchMode": "any",
  "discoverChannels": true,
  "sourceMaxChargeUsd": 0.5,
  "maxMessages": 1000,
  "maxMessagesPerChannel": 100,
  "onlyChanges": false,
  "retentionDays": 30,
  "stateMaxMessages": 10000,
  "maxDiscoveryChannels": 15,
  "discoveryPagesPerTerm": 2,
  "discoveryMaxChargeUsd": 0.5,
  "discoveryCountry": "es",
  "maxPagesPerChannel": 10,
  "maxConcurrency": 3,
  "requestDelaySeconds": 1,
  "similarityThreshold": 0.8,
  "minTextLength": 100,
  "maxComparisons": 250000,
  "rapidSpreadMinutes": 30,
  "rapidSpreadMinChannels": 3
}
```

# Actor output Schema

## `messages` (type: `string`):

No description

## `report` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `graph` (type: `string`):

No description

## `events` (type: `string`):

No description

## `result` (type: `string`):

No description

## `timeline` (type: `string`):

No description

## `csv` (type: `string`):

No description

## `discovery` (type: `string`):

No description

## `normalized` (type: `string`):

No description

## `interactions` (type: `string`):

No description

## `sourceCandidates` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "Jordi Wild",
        "Abascal"
    ],
    "maxMessages": 1000,
    "maxMessagesPerChannel": 100,
    "maxPagesPerChannel": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("halcyon_marram/telegram-evidence").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": [
        "Jordi Wild",
        "Abascal",
    ],
    "maxMessages": 1000,
    "maxMessagesPerChannel": 100,
    "maxPagesPerChannel": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("halcyon_marram/telegram-evidence").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "Jordi Wild",
    "Abascal"
  ],
  "maxMessages": 1000,
  "maxMessagesPerChannel": 100,
  "maxPagesPerChannel": 10
}' |
apify call halcyon_marram/telegram-evidence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,halcyon_marram/telegram-evidence"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pLqZH84mgxP84alys/builds/f9mIZsTrT0hQmLfH6/openapi.json
