<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Roman</title>
    <description>The latest articles on Forem by Roman (@bbonk).</description>
    <link>https://forem.com/bbonk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3678502%2F0b465684-3dd7-4340-a33a-2efe5f2cc547.png</url>
      <title>Forem: Roman</title>
      <link>https://forem.com/bbonk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bbonk"/>
    <language>en</language>
    <item>
      <title>Stop logging print(): Inspect Telegram Payloads Instantly</title>
      <dc:creator>Roman</dc:creator>
      <pubDate>Tue, 30 Dec 2025 13:00:00 +0000</pubDate>
      <link>https://forem.com/bbonk/stop-logging-print-inspect-telegram-payloads-instantly-19a4</link>
      <guid>https://forem.com/bbonk/stop-logging-print-inspect-telegram-payloads-instantly-19a4</guid>
      <description>&lt;p&gt;If you build Telegram bots—whether in Python (&lt;code&gt;aiogram&lt;/code&gt;, &lt;code&gt;python-telegram-bot&lt;/code&gt;), Node.js (&lt;code&gt;Telegraf&lt;/code&gt;), or Go—you know the pain of the &lt;strong&gt;"Blind Webhook"&lt;/strong&gt; cycle.&lt;/p&gt;

&lt;p&gt;You want to handle a specific event, like a user forwarding a message or sending a sticker. But you aren't quite sure what the payload structure looks like. &lt;/p&gt;

&lt;p&gt;Usually, the workflow looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;print(update)&lt;/code&gt; or &lt;code&gt;console.log(ctx)&lt;/code&gt; to your code.&lt;/li&gt;
&lt;li&gt;Redeploy or restart the polling script.&lt;/li&gt;
&lt;li&gt;Send the message to your bot.&lt;/li&gt;
&lt;li&gt;Dig through terminal logs to find the JSON.&lt;/li&gt;
&lt;li&gt;Copy-paste it into a JSON formatter.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s inefficient.&lt;/p&gt;

&lt;p&gt;I got tired of ad-ridden "ID bots" and the deployment loop just to inspect a payload. So, I built a compliant, stateless tool to solve this cleanly: &lt;strong&gt;@re_GetMyIDBot&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: Guessing JSON Structures
&lt;/h2&gt;

&lt;p&gt;Telegram's API documentation is excellent, but it doesn't always reflect the exact nuance of the data you receive in real-time.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;em&gt;Where exactly is the &lt;code&gt;file_id&lt;/code&gt; located in a sticker object?&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;em&gt;Does a forwarded message from a hidden user return a &lt;code&gt;user_id&lt;/code&gt; or a &lt;code&gt;sender_name&lt;/code&gt;?&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;em&gt;What is the &lt;code&gt;chat_id&lt;/code&gt; of this channel for my &lt;code&gt;.env&lt;/code&gt; file?&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To answer these, we usually clutter our production code with debug statements.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: A DevTool, Not Just a Bot
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://t.me/re_GetMyIDBot" rel="noopener noreferrer"&gt;@re_GetMyIDBot&lt;/a&gt;&lt;/strong&gt; is designed as a utility for your toolkit, sitting alongside Postman and Git. It adheres to the UNIX philosophy: &lt;em&gt;Do one thing and do it well.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Feature 1: The "Get JSON" Inspector 🛠
&lt;/h3&gt;

&lt;p&gt;This is the killer feature. When you forward a message, send a photo, or interact with the bot, it offers an inline button: &lt;strong&gt;[ Get JSON ]&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Clicking it fetches the raw &lt;code&gt;Update&lt;/code&gt; object associated with that message. No logging required.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8auat42gslo1inqudq95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8auat42gslo1inqudq95.png" alt="Result of " width="470" height="912"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Scenario:&lt;/strong&gt;&lt;br&gt;
You need to see how a &lt;code&gt;document&lt;/code&gt; payload looks. You drop a file into the bot and click [Get JSON]. You get this instantly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;451&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;123456789&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"is_bot"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"first_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"language_code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"en"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"chat"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;123456789&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"private"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1706892345&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"document"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"file_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deployment_logs.txt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mime_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"text/plain"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"file_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"BQACAgIAAxkBAAM..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"file_unique_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AgAD..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"file_size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you know exactly how to parse &lt;code&gt;update.message.document.file_id&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Feature 2: Instant Copy-Paste IDs 📋
&lt;/h3&gt;

&lt;p&gt;Most bots return the Chat ID. This bot returns &lt;code&gt;user_id&lt;/code&gt;, &lt;code&gt;chat_id&lt;/code&gt;, and &lt;code&gt;channel_id&lt;/code&gt; formatted in &lt;strong&gt;monospace&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5r3ennjx3pa4esaisqd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5r3ennjx3pa4esaisqd.png" alt="Return the Chat ID" width="473" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why monospace? Because on mobile and desktop, single-tapping monospace text automatically copies it to the clipboard. It streamlines setting up your &lt;code&gt;.env&lt;/code&gt; config variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# No more manually typing IDs&lt;/span&gt;
&lt;span class="nv"&gt;TELEGRAM_ADMIN_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;123456789
&lt;span class="nv"&gt;LOG_CHANNEL_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;-100987654321&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Feature 3: Forwarding and Channel Debugging
&lt;/h3&gt;

&lt;p&gt;If you forward a message from a Channel to the bot, it extracts the hidden metadata. This is the fastest way to find a Channel ID (&lt;code&gt;-100...&lt;/code&gt;) without adding the bot to the channel as an admin first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;There are plenty of "ID Bots" on Telegram. Most of them suffer from two issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Spam/Ads:&lt;/strong&gt; They push ads for other channels every time you check an ID.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Limited Scope:&lt;/strong&gt; They only give you the ID, not the payload context.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I wanted a clean, fast, zero-dependency tool for developers. No ads, no spam, just the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it out
&lt;/h2&gt;

&lt;p&gt;Next time you are stuck guessing whether the field is called &lt;code&gt;caption&lt;/code&gt; or &lt;code&gt;text&lt;/code&gt;, or you just need to grab your ID for a config file, save yourself the redeploy.&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Bot Link:&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://t.me/re_GetMyIDBot" rel="noopener noreferrer"&gt;@re_GetMyIDBot&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Happy debugging.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>telegram</category>
      <category>python</category>
      <category>tooling</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
