Telegram Stories Analytics
tg-stories exports your own Telegram Stories through Telethon, fetches viewer
lists, computes engagement analytics, and renders local JSON, Markdown, and
HTML reports.
The CLI is packaged as a normal Python console script and works on macOS,
Linux, and Windows. Authentication is stored in the system keyring. On macOS it
can also reuse credentials created by the local telegram-telethon skill.
Install
For normal use:
pipx install telegram-stories-analytics
For local development:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .
Telegram API Credentials
Create api_id and api_hash at https://my.telegram.org under API
Development Tools.
Then login once:
tg-stories auth login --profile personal
Check the session:
tg-stories auth status --profile personal
On macOS, if you already use the telegram-telethon skill, this tool can reuse
that Keychain session:
tg-stories auth status --profile ivanopcode --auth-source telegram-telethon
Export Stories
Full export:
tg-stories export --profile personal --progress --open
This writes:
exports/my-telegram-stories-full.json
exports/my-telegram-stories-analysis.json
exports/my-telegram-stories-analysis.md
exports/my-telegram-stories-analysis.html
The full JSON contains each story, Telegram story link when available, metadata,
counts, and a nested viewers array with viewer identity, view date, and
reaction.
Rebuild Reports
If you already have a full export, recompute analytics without calling Telegram:
tg-stories analyze exports/my-telegram-stories-full.json --open
Render or open HTML from an analysis JSON:
tg-stories html exports/my-telegram-stories-analysis.json --open
tg-stories open exports/my-telegram-stories-analysis.json
Analytics
The generated analysis includes:
- all-time regularity and
>=80%viewers; - recent windows, by default 30, 90, and 180 days;
- sliding-window regularity;
- fastest regular viewers by median view latency;
- story-level speed buckets: 5m, 15m, 1h, 6h, and 24h;
- top viewers by absolute reactions;
- top viewers by reaction rate;
- lapsed viewers, new recent viewers, and declining viewers;
- contact, mutual contact, non-contact, and premium segments.
Important definitions:
view_rate = viewed_story_count / story_countreaction_rate_per_viewed_story = reaction_count / viewed_story_countview_latency_seconds = viewer view_date - story date
Environment Auth
For CI-like or temporary usage, credentials can be provided through environment variables:
export TG_STORIES_API_ID=12345
export TG_STORIES_API_HASH=...
export TG_STORIES_SESSION=...
tg-stories export --auth-source env
Do not commit exported reports. Viewer data is personal data.
Metadata
Release files for telegram-stories-analytics 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| telegram_stories_analytics-0.1.0.tar.gz | 20.0 kB | With provenance | Details for telegram_stories_analytics-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| telegram_stories_analytics-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for telegram_stories_analytics-0.1.0-py3-none-any.whl |
Total release size: 42.1 kB
Release files / telegram_stories_analytics-0.1.0.tar.gz
| Download URL | telegram_stories_analytics-0.1.0.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
976229db3e397210070c8d646171548d7061d6ee4e3814359e3c23364b717f3e
|
|
BLAKE2b-256 checksum How to use checksums |
323878d366ea0d82cbc25364593033b02c842e85bceea3be8cfa724e25225a69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / telegram_stories_analytics-0.1.0-py3-none-any.whl
| Download URL | telegram_stories_analytics-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfab138621b527baf75438348d3a4cd89339db54e15b45f1e1427b2795b50115
|
|
BLAKE2b-256 checksum How to use checksums |
36806986b1f1d864aa4f541fa4c65f6fa2052fe771ea7b931977647c1bf05550
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logSecurity for telegram-stories-analytics 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for telegram_stories_analytics-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.