CONNECT CODEX TO TELEGRAM ACROSS LOCAL PROJECTS — STUDIO
For Christopher. November 1, 2026.
OBSERVED RESULT: the Studio user-wide connection sent the actual sample attachment;
Christopher confirmed arrival and supplied its readable contents and correct marker.
The development history retains the failures and corrections that preceded this.
Read STUDIO-CONTINUATION.txt for observed results and outstanding acceptance.
For a reader reproducing this connection, follow READER-CHECKLIST.txt and the
accompanying codex-telegram-reader-kit-1.0.3.zip. The checklist uses your own
verified paths/account, rather than the historical Studio/Office examples below.
Read DEVELOPMENT-LESSONS.txt for Christopher's Clarity. Structure. Accountability.
framework and the design/guidance failures that shaped this workflow.
The original TUTORIAL.txt and VERIFICATION.txt remain unchanged historical source.
They include the failed Office-path handoff; that attempt did not work on Studio.

WHAT THE CONNECTION DOES
Ask a local Codex chat to send one specifically chosen file to Telegram, for example:
Send D:\Projects\Example\outputs\report.pdf to my Telegram.
telegram_send_file uploads the actual file bytes as a document attachment to the
one private chat approved locally. The tool has path and optional caption fields;
there is no recipient parameter. telegram_status reports local readiness without
contacting Telegram or exposing private identity values. Ambiguous files require
clarification. Every upload checks the approved bot and private-chat identities.

1. VERIFY THE EXECUTION COMPUTER BEFORE INSTALLATION
Opening an Office chat on Studio did not move its executor. The old source ran on
<OFFICE_COMPUTER> under its User account, with Python 3.14; its absolute launcher command
failed on Studio with CommandNotFoundException/ObjectNotFound before token entry.
That failure and original ZIP fingerprint are retained in VERIFICATION.txt.
This continuation independently verified <STUDIO_COMPUTER>, profile <USERPROFILE>,
and Documents known folder <DOCUMENTS> before writing. The display account name
does not determine the profile folder; the working chat directory does not
determine the Documents known folder. Do not guess either from a visible path.

2. VALIDATE A REAL PYTHON RUNTIME, THEN INSTALL ONCE AT USER SCOPE
Studio's first python.exe resolution is <OBSERVED_STUDIO_PYTHON_DIRECTORY>\python.exe, Python 3.11.0,
with tomllib, Tkinter, a sibling pythonw.exe, and working Windows DPAPI/ACL support.
No Python packages, Python installation, or system settings changes were needed.
The reviewed Install.ps1 checks compatibility before writing. Run it from a
complete delivered source folder using a single-line PowerShell command:
& '<PACKAGE_DIRECTORY>\Install.ps1'
It derives the Windows Documents known folder and installs at:
<DOCUMENTS>\Codex\Integrations\telegram-files
The user-level MCP registration is in:
<USERPROFILE>\.codex\config.toml
Its own table has command <OBSERVED_STUDIO_PYTHON_DIRECTORY>\python.exe, args -I -B followed by the
absolute installed server.py path, and tool_timeout_sec 180. Config contains no
Telegram token, private identity, or credential environment variable.
Direct configuration retains unrelated bytes/comments/options and checks parsed
preservation. Conflicting registration or differing installed files stop for
review. Current configuration was preserved during this Studio installation.
The initial Office CLI-add preservation caveat remains unresolved historical
evidence; Studio results do not repair or retroactively validate Office settings.

3. ENTER THE EXISTING MAVERICK CREDENTIAL ONLY IN THE MASKED LOCAL WINDOW
Launch the installed helper; no credential belongs in this command:
& '<DOCUMENTS>\Codex\Integrations\telegram-files\Setup Telegram.cmd'
Enter the existing token, your positive numeric private chat ID, and exact expected
@username from Maverick's existing Telegram profile. Do not guess an @username
from its display name. Token and private ID fields are masked. Never put the token
in chat, command arguments, environment variables, source, logs or screenshots.
Find your personal Telegram user ID (using a bot)
For a normal private conversation with Maverick, the required private chat ID is
your Telegram-assigned numeric user ID. It is not created by this local installer.
If you do not know it, use a separate utility bot inside Telegram:
1. Open Telegram on your phone or computer.
2. Open Get My ID at https://t.me/getmyid_bot, or search for the exact username
   @getmyid_bot. Alternatively, use Raw Data Bot at https://t.me/raw_data_bot
   (exact username @raw_data_bot).
3. Tap Start in that utility bot's private chat.
4. Read your numerical Telegram user ID from its reply. If raw account/message
   details are shown, choose your own user ID, not the utility bot's or a group ID.
   If you used Select bot, Selected Bot ID identifies Maverick. The separate
   Your ID value identifies you and is the destination needed here. Do not put
   Selected Bot ID into the private numeric chat ID field.
5. Enter that number in the field labelled Your personal Telegram user ID.
6. Open Maverick's own existing private chat from that same Telegram account and
   tap Start before verifying setup. Starting the utility bot only retrieves the
   ID; it does not establish your private conversation with Maverick.
Never give either utility bot Maverick's token. The token belongs only in the
masked local setup window. Using a separate utility bot does not consume
Maverick's updates, change its webhook, or create a new bot for this integration.
Christopher supplied this utility-bot method for the process documentation.
The linked bot pages describe user-ID lookup; actual utility-bot replies have not
been exercised or observed by this integration.

Other ways to obtain the same ID remain available: use the existing receiver's
established workflow or its owner, without consuming Maverick's updates. Or, in
Telegram Desktop open Settings > Advanced >
Export Telegram Data, select Account information and Machine-readable JSON, and
deselect other categories. Read personal_information.user_id from local result.json
and enter it in the masked setup. Keep the export private; do not upload it here.
The local helper verifies the corresponding private recipient before saving.

If identity verification fails, setup version 1.0.1 and later identifies the API operation
(getMe, getChat or getWebhookInfo) and a fixed safe API error code. Recognized
chat-not-found failures include guidance to start the exact bot from the same
account. The helper never echoes Telegram's unrestricted error description,
request URL, supplied numeric ID or token. A failure is not proof that the ID is
wrong. If getChat fails after the bot username was verified, check that Maverick's
own private chat was started and that the account and numeric ID match. Report
only the safe error wording if help is needed; never share token-entry screenshots.
Version 1.0.2 also refuses to save or send when the recipient ID is the bot's own
ID. Reopen the masked local setup, enter Your ID, and confirm your own recipient
name in the local identity dialog. Do not edit the encrypted destination directly.
The original label Your private numeric chat ID was ambiguous. Version 1.0.3 uses
Your personal Telegram user ID in the input, validation guidance and local
confirmation. For this private conversation it maps internally to Telegram's
chat_id parameter. The terminology error and missing initial validation were
implementation/guidance failures; the development record retains their consequences.

Choose Verify identities and save. The helper calls only getMe, getChat and
getWebhookInfo, then displays a LOCAL confirmation of bot ID/username and private
recipient name/username/ID. Confirm only if these are correct. Only after local
confirmation does it encrypt the token and approved identities together using
current-user DPAPI. Ciphertext is stored in:
%USERPROFILE%\.codex\telegram-files-private\credentials.dpapi
The directory is restricted to the current Windows user and SYSTEM. DPAPI protects
storage; programs acting as the same user can decrypt it. Identity credentials
necessarily exist briefly in memory and in Telegram's HTTPS request route; these
are not logged. Temporary credential replacement files contain ciphertext only.
The setup clears successful fields and sends no file. Close it after saving.

Maverick's existing receiver is preserved: no getUpdates, offset consumption,
deleteWebhook, setWebhook, new bot, watcher or bot-setting changes. An empty
webhook does not exclude a polling receiver. The integration has no listening
port, bulk delivery, background polling, bidirectional agent or remote detection.

4. DISCOVER THE TOOLS ACROSS PROJECTS
The user registration applies to local Codex on this account and computer.
It does not install on another host or grant cloud access to Studio's files.
Project policy or a project override can still disable a user-level server.
Studio's bundled CLI 0.162.0-alpha.17.2 discovered telegram_status and
telegram_send_file through two standalone app-server processes in separate
disposable project contexts, using the actual user config and installed source.
No chats or project configs were created, and no unrelated project was edited.
That evidence establishes those Studio contexts; it does not prove tool refresh
in every already-open desktop chat. Refresh/reopen the client if needed rather
than repeatedly installing. A next ordinary local project chat can use the same
user registration; this workflow does not create chats on Christopher's behalf.

5. REQUEST AND VERIFY THE CHOSEN ATTACHMENT
After secure setup, ask telegram_status to check readiness. The authorized harmless
test file is:
<DOCUMENTS>\Codex\Integrations\telegram-files\sample-delivery.txt
Its marker is CODEX-TELEGRAM-LOCAL-2026-11-01. Its unchanged source SHA-256 is:
d5746630f6243ea2dedfed407b6a07574d004468fa48e4492dd2c97930d430d7
The sender verifies getMe/getChat before streaming the exact selected attachment.
An accepted API response reports telegram_api_accepted, filename, bytes and message
ID. It explicitly leaves physical acceptance pending. Christopher must receive,
download, open the attachment and confirm reading the marker. Do not infer that
from API acceptance. No automatic retry occurs; uncertain network delivery requires
checking Telegram before another send to avoid duplicates.
Setup identity lookup and encrypted save do not establish permission to deliver a
document. In the first live Studio sample attempt, getMe/getChat matched the pinned
identities but sendDocument was rejected with API 403. It was not retried. If this
happens, check the exact existing bot's private chat and account, Start/blocking
state, and the locally confirmed recipient. The full process record retains this
failure; a later successful attempt must be recorded separately.
Subsequently Christopher explicitly requested one new sample attempt after saving
the corrected personal-user destination. Telegram accepted sample-delivery.txt,
345 bytes, message ID 3. The failed first attempt remains in the evidence. Actual
receipt/download/opening is a separate acceptance step pending his confirmation.
Christopher then confirmed attachment arrival and supplied the full readable
contents with the expected marker. Receipt and file-content access are therefore
observed; a separate manual save-to-disk step was not described. The original API
receipt and the later user confirmation are preserved as separate evidence.

Other selected files must be nonempty regular files up to 49,000,000 bytes at direct
absolute Windows drive paths. No UNC/device path, alternate stream, wildcard,
parent traversal, symlink or junction is accepted. The credential directory and
hardlinks to its active vault cannot be delivered. A Windows read lock excludes
concurrent write/delete during streaming. Unicode filenames are supported; unsafe
header characters are removed or rejected. Caption limit: 1024 UTF-16 units.
Offline tests cover all these restrictions, pinned recipient/identity mismatch,
multipart bytes, private-store denial, redaction, masked UI and no retry.

6. MAINTAIN THE CONNECTION
Use the same masked helper to replace credentials or change the pinned private
chat, with fresh local identity confirmation. Retain original source/evidence and
PARITY-INVENTORY.txt when updating. Do not drop capabilities or required outputs
without Christopher's specific prior approval. The installer preserves differing
source files for review. Do not use CLI add/remove as an unreviewed repair for
unrelated settings: the Office caveat demonstrated a broader rewrite concern.
Retiring the integration should remove only its own reviewed user-config entry,
installed directory and encrypted private store after checking the actual paths.
Never delete a parent .codex folder or unrelated integration. Removing this sender
does not revoke a Telegram token or remove an existing receiver.

OPTIONAL ADDENDUM — BOTFATHER FOR A READER WHO HAS NO BOT
Christopher already has Maverick. No new bot was created, and this is not part of
his setup. A future reader without a bot may follow Telegram's official BotFather
creation tutorial separately, keep the issued token private, open the private bot
chat and press Start. Arrange the numeric private ID through an established trusted
workflow. Do not run getUpdates against an existing bot consumer or alter its
webhook. Return to the masked local setup once identities are known.

PRIMARY GUIDANCE
https://developers.openai.com/codex/mcp
https://core.telegram.org/bots/api#senddocument
https://core.telegram.org/bots/api#getme
https://core.telegram.org/bots/api#getchat
https://core.telegram.org/bots/api#getwebhookinfo
https://learn.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata
https://core.telegram.org/bots/tutorial#obtain-your-bot-token
https://bugs.telegram.org/c/60/7
https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/export/output/export_output_json.cpp
https://t.me/getmyid_bot
https://t.me/raw_data_bot
