<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Mihail</title><generator>teletype.in</generator><description><![CDATA[Mihail]]></description><image><url>https://img4.teletype.in/files/f7/84/f78494d4-96d9-457d-a4a7-c333990ab006.png</url><title>Mihail</title><link>https://teletype.in/@mihailgok</link></image><link>https://teletype.in/@mihailgok?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/mihailgok?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/mihailgok?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Tue, 21 Apr 2026 01:21:18 GMT</pubDate><lastBuildDate>Tue, 21 Apr 2026 01:21:18 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@mihailgok/wHfZmLohOiX</guid><link>https://teletype.in/@mihailgok/wHfZmLohOiX?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok</link><comments>https://teletype.in/@mihailgok/wHfZmLohOiX?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok#comments</comments><dc:creator>mihailgok</dc:creator><title>Что за глупые вопросы от коллег - это хороший UX/UI, я по-другому не делаю</title><pubDate>Wed, 25 Mar 2026 17:01:10 GMT</pubDate><media:content medium="image" url="https://img3.teletype.in/files/e0/24/e024e97e-c909-4e61-ad20-c5909e7718fd.png"></media:content><description><![CDATA[<img src="https://img2.teletype.in/files/1e/08/1e089f02-f6ac-4c35-bba4-e6080ac572f8.jpeg"></img>]]></description><content:encoded><![CDATA[
  <figure id="mC2n" class="m_original">
    <img src="https://img2.teletype.in/files/1e/08/1e089f02-f6ac-4c35-bba4-e6080ac572f8.jpeg" width="790" />
  </figure>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@mihailgok/vdbV26HXlGW</guid><link>https://teletype.in/@mihailgok/vdbV26HXlGW?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok</link><comments>https://teletype.in/@mihailgok/vdbV26HXlGW?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok#comments</comments><dc:creator>mihailgok</dc:creator><title>Мне кажется или эта компания - скам?</title><pubDate>Wed, 25 Mar 2026 17:00:15 GMT</pubDate><description><![CDATA[<img src="https://img2.teletype.in/files/57/5c/575c998e-f975-4d48-94e4-b62a59b58eae.jpeg"></img>Моя девушка столько раз заказывала золотое яблоко, но ни разу яблока, тем более золотого, не приходило.]]></description><content:encoded><![CDATA[
  <p id="e2hW">Моя девушка столько раз заказывала золотое яблоко, но ни разу яблока, тем более золотого, не приходило.</p>
  <p id="GxLT">А она все продолжает..</p>
  <figure id="GKF5" class="m_original">
    <img src="https://img2.teletype.in/files/57/5c/575c998e-f975-4d48-94e4-b62a59b58eae.jpeg" width="535" />
  </figure>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@mihailgok/7gpQV947XJe</guid><link>https://teletype.in/@mihailgok/7gpQV947XJe?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok</link><comments>https://teletype.in/@mihailgok/7gpQV947XJe?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok#comments</comments><dc:creator>mihailgok</dc:creator><title>Том 2   Мышь запуталась</title><pubDate>Wed, 25 Mar 2026 16:58:19 GMT</pubDate><media:content medium="image" url="https://img3.teletype.in/files/ec/b5/ecb5361a-3e1e-494f-bbfe-c5cf12ab5e24.png"></media:content><description><![CDATA[<img src="https://img2.teletype.in/files/dd/a5/dda5ef38-3915-45cd-bb70-b9b755b060fd.jpeg"></img>]]></description><content:encoded><![CDATA[
  <figure id="bMXM" class="m_original">
    <img src="https://img2.teletype.in/files/dd/a5/dda5ef38-3915-45cd-bb70-b9b755b060fd.jpeg" width="859" />
  </figure>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@mihailgok/telegram-web-apps</guid><link>https://teletype.in/@mihailgok/telegram-web-apps?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok</link><comments>https://teletype.in/@mihailgok/telegram-web-apps?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=mihailgok#comments</comments><dc:creator>mihailgok</dc:creator><title>Creating telegram web apps and interacting with them in telegram bots</title><pubDate>Thu, 12 Sep 2024 21:38:01 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/80/3d/803d948d-414a-4c07-81cc-4699525c40e8.png"></media:content><description><![CDATA[<img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-1024x683.png"></img>In the Bot API 6.0 update, Telegram bots got a lot of new features. The most notable one for developers is Telegram Web Apps (Web Apps inside Telegram). With this innovation, developers can connect web applications to their bots, which open in an additional window, which greatly expands the toolkit and, consequently, the functionality of Telegram bots.]]></description><content:encoded><![CDATA[
  <p id="block-2d4369d9-f801-400c-9235-b6f330b93819">In the Bot API 6.0 <a href="https://core.telegram.org/bots/api-changelog#april-16-2022" target="_blank">update</a>, Telegram bots got a lot of new features. The most notable one for developers is Telegram Web Apps (Web Apps inside Telegram). With this innovation, developers can connect web applications to their bots, which open in an additional window, which greatly expands the toolkit and, consequently, the functionality of Telegram bots.</p>
  <figure id="jnvN" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-1024x683.png" width="1024" />
  </figure>
  <p id="block-790319b7-92d9-473a-94c7-866a7f7e0726"><em>Telegram apps are known for their speed, smoothness, and cross-platform design. Your web app should ideally follow these principles.</em></p>
  <ul id="block-7a039fab-4b62-4eb4-a700-97cc89a0d65c">
    <li id="block-40e46704-4f6d-49bb-a46c-028bf4b5fa30">All elements should be responsive and designed with mobile device orientation in mind.</li>
    <li id="block-35d42d74-ca9c-4767-9574-bf92002d222a">Interactive elements should mimic the style, behavior, and purpose of existing UI components.</li>
    <li id="block-75c82937-de1b-40f6-b7c5-46a0d4e637d6">All animations should be smooth, ideally 60 frames per second.</li>
    <li id="block-e7dade27-57d3-4434-8ec8-d65955def968">All input and images should include a label for accessibility.</li>
    <li id="block-a6a5a799-dced-49e3-be3c-4c6e72801c48">The application should provide a seamless experience by tracking changes in theme colors using the API, and using them appropriately.</li>
  </ul>
  <p id="block-2d542ac5-3760-423c-a8a3-2e037de2e388">Let&#x27;s put it into practice!</p>
  <h2 id="block-97e493bf-4620-4b43-ab55-470ae0dc40cc">Button creation</h2>
  <p id="block-33e70a52-9287-4d62-bada-97efcd715e64">The first thing we need to do is to create a button to launch the web application. This can be done in two ways:</p>
  <h3 id="block-bf00fb6f-163b-45b8-9aad-2d9129202384">1. Using @botfather - the button on the bottom left</h3>
  <p id="block-e315ea61-298e-4175-836c-88526177f641">1.1 Go to @botfather and write the command: /setmenubutton</p>
  <p id="block-bbe0aa62-9fef-4e45-9a0e-3afb3174b037">1.2 Next, select the bot that needs a web application button</p>
  <p id="block-d0f6b19b-875d-4754-8b1d-ac398584d825">1.3 Send the link where our web application is available</p>
  <p id="block-53088398-6b25-4fc1-ad85-cca871ac9468">1.4 Write the name of the button - it will be displayed at the bottom left.</p>
  <figure id="zkgv" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-1.png" width="1012" />
  </figure>
  <figure id="z5eS" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-2-720x1024.png" width="720" />
  </figure>
  <p id="block-4bda9e6f-586a-4f2d-bd13-2da9059f4eb3">That&#x27;s it. In general, if you have a responsive site and wanted to just add it to the bot, you can stop here.</p>
  <blockquote id="block-462557a9-f4dc-43cc-9c42-1158b1276554">Only when adding a button in this way can we get the <a href="https://core.telegram.org/bots/webapps#webappuser" target="_blank">user information</a>.</blockquote>
  <h3 id="block-ba8f3c0c-20e4-4524-93b3-4177f54c9cdd">2. In the bot code - keyboard buttons.</h3>
  <p id="block-a87619cd-e656-4385-88d5-996930ed094d">Launching the bot from an inline button gives the same results as the previous option. However, launching from keyboard button allows you to send data from the web application to the bot.</p>
  <p id="block-2b100c05-dc2b-479d-a463-f7ed35934f71">I&#x27;ll show you pytelegrambotapi as an example - I realize that it&#x27;s not the most popular library for writing telegram bots, but it happens to be the one I use. If you&#x27;re using another library/language, I think you&#x27;ll have no trouble following the analogy. You can see the example at once or go to the repository and see the code with comments:</p>
  <p id="block-2ee98dcc-36bc-426e-a1d4-503fa08e413b">2.1 Do all the standard things to start the bot - library import, token input, infinity_polling, start command handler. If you don&#x27;t know what I mean, this is the place to start.</p>
  <p id="block-aa9642b9-1fdf-4e3c-9278-ef0878212afc">2.2 Create a function that will return a keyboard with the desired button.</p>
  <p id="block-6be3cd42-c140-436c-9342-859ae06d4278">In order to create a button, we need to first create a WebAppInfo object with a url to our website inside it.</p>
  <p id="block-7c0f1fb8-35e9-4f7e-ae0e-3f8f436b8856">2.3 Send a message with our keyboard when sending a command or any other action:</p>
  <p id="block-720854d8-475f-4eb2-af15-c4e36a1f0987">It&#x27;s done. We have the buttons.</p>
  <p id="block-df756f92-f857-4533-8a04-130f444bf5bd">This is where you can generally end up if you just wanted a user to be able to open your site from a bot (for something). The way it would work is like this:</p>
  <figure id="1JLz" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-3-520x1024.png" width="520" />
  </figure>
  <h2 id="block-2312b19c-2ef7-4396-bad9-74fb327b6bc9">Working with the web application</h2>
  <p id="block-59e8aa5f-edb9-442d-b14b-135fc30e2b2b">Now we go to our web application. At the time of writing, any link opens, even to codepen.</p>
  <h3 id="block-e485ae72-e8dc-4aa9-833d-52698f362908">Initialization</h3>
  <p id="block-f1b07ff8-580e-4202-9d7f-0f34bcfc2eda">To interact with telegram we plug in a script:</p>
  <p id="block-f3ebf25d-a81b-4363-9310-32d1efe958b6"><code>&lt;script src=&quot;https://telegram.org/js/telegram-web-app.js&quot;&gt;&lt;/script&gt;</code></p>
  <p id="block-7a8db932-29fc-401f-85d6-120d3801d247">After that we will have an object available to us: <code>window.Telegram.WebApp</code></p>
  <p id="block-61a19c01-459b-40bf-b8b7-388c681f4746">Write it into a variable and start our work.</p>
  <p id="block-e6d03648-68e1-4961-8ea2-dd91d576c0bd"><code>let tg = window.Telegram.WebApp;</code></p>
  <p id="block-cc522131-81b5-437b-8867-695fc7f5beff">What can we do now? Not as much as we would like, but not a lot. The application consists of: the main button (telegram object) and the page itself, which is loaded by the link. Other elements of the telegram interface are not available to us. However, the user&#x27;s theme colors are available:</p>
  <figure id="vTzi" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-4-951x1024.png" width="951" />
  </figure>
  <p id="block-59f799c9-f717-4d3f-b0e0-475c58bc236c">Colors</p>
  <p id="block-53e283d8-6470-4508-ad0e-7364d764aabe">These are available in hex format as css variables:</p>
  <p id="block-740911e1-47e1-45a7-a393-dd383e967fab"><code>var(--tg-theme-bg-color)var(--tg-theme-text-color)var(--tg-theme-hint-color)var(--tg-theme-link-color)var(--tg-theme-button-color)var(--tg-theme-button-text-color)</code></p>
  <p id="block-3d586e0b-b29d-4a71-bb74-2b5de956c26a">Or as a <a href="https://core.telegram.org/bots/webapps#themeparams" target="_blank">ThemeParams</a> object in js (instead of window.Telegram.WebApp I use the tg variable):</p>
  <p id="block-4385b0db-127d-43e3-8f85-34a9707259b3"><code>tg.ThemeParams.bg_colortg.ThemeParams.text_colortg.ThemeParams.hint_colortg.ThemeParams.link_colortg.ThemeParams.button_colortg.ThemeParams.button_text_colorString</code></p>
  <p id="block-1713cfb3-b685-42d5-a851-17647181ef4b">But be careful, colors are an optional parameter, so it&#x27;s worth checking if they are there before you use them.</p>
  <p id="block-c025785f-a0ee-4ddd-b84e-9d5acf5a6060">There is also an event handler for changing the color scheme:</p>
  <p id="block-938f1638-d0ef-4c2a-b8da-6c323117602e"><code>Telegram.WebApp.onEvent(themeChanged, function(){});</code></p>
  <p id="block-d8a9f710-dccf-459a-a99d-297d24a3ade2">If you <a href="https://core.telegram.org/bots/webapps#events-available-for-web-apps" target="_blank">change</a> the color scheme or window size, you can change something in our web application as well.</p>
  <h3 id="block-a80b4acd-a170-4d77-b2e7-9a7691f61cce">Basic features</h3>
  <p id="block-f246a7e7-2355-4ac1-92f0-fb1ea349deb5">Colors have been dealt with - now let&#x27;s get to the other <a href="https://core.telegram.org/bots/webapps#initializing-web-apps" target="_blank">main parameters</a>:</p>
  <h3 id="block-eaaf3019-b0fc-4cc4-9863-5bcbd3639a57">Main button</h3>
  <p id="OflR">UPD: Now, with the Bot API 7.10 update, this button is called <code>BottomButton</code>, and an additional <code>SecondaryButton</code> has also been added.</p>
  <p id="block-28e266b5-5f1b-47b8-9070-23092eef8b26">We can interact with the <a href="https://core.telegram.org/bots/webapps#bottombutton" target="_blank">button</a> at the bottom of the application. Change its text, background and text color, show/hide it, make it active and deactivate it:</p>
  <figure id="z6TX" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-5-606x1024.png" width="606" />
  </figure>
  <h3 id="block-e6ae783f-057c-4d6e-8d77-ad662b55f9bc">Web App User</h3>
  <p id="block-d73aaa48-00cb-4af1-935a-f357ed20481f">And more user <a href="https://core.telegram.org/bots/webapps#webappinitdata" target="_blank">information</a>, we can parse the <code>tg.initData</code> string or use the <code>tg.initDataUnsafe</code> object:</p>
  <h2 id="block-ebfac7e5-7e23-4791-bfb7-259464e25562">Пишем веб-приложение (web app)</h2>
  <p id="block-8abc0a5c-29c8-43b4-9f1c-04298714e913">With this information, we can write a small application that will visualize the main features.</p>
  <p id="block-34bfab29-0190-49a1-9825-bc47e761079b">Don&#x27;t forget to connect the script:</p>
  <p id="block-36d7877b-ddb6-485d-a65b-b71c5c99fecd"><code>&lt;script src=&quot;https://telegram.org/js/telegram-web-app.js&quot;&gt;&lt;/script&gt;</code></p>
  <h3 id="block-7230ce71-bb62-42c0-8a2c-da979eb96b8c">1. Let&#x27;s create a small html base of our web app:</h3>
  <h3 id="block-259cbae5-83fc-4732-997d-2de334c9ed3f">2. Let&#x27;s write changes to the text of the main button and change the color:</h3>
  <h3 id="block-fac0c29c-29ca-4521-a8ae-75ca4f850818">3. Next, let&#x27;s put an event handler on the first html button and show/hide the main telegram button when clicked:</h3>
  <h3 id="block-09ce828a-e554-422c-aaff-15d652c52c46">4. Another event handler for the second html-button, which will activate/deactivate the main telegram-button when clicked:</h3>
  <h3 id="block-fe944d67-02f8-4616-a6c6-fe6217d213d7">5. Finally send the data when you click on the main telegram button:</h3>
  <p id="block-6e49bb6a-31d0-486f-b603-1a82fb2bfbcd">Through this method we can retrieve the data from the web application in the bot.</p>
  <h3 id="block-8e305255-453b-4a71-bee9-058c1d5823e3">6. We will also display all information about the user</h3>
  <p id="block-9371b337-b9f6-43b2-9705-333f681ae40e">(will only be available when launched from the button added with @botfather).<br />We can access: id / isBot / first_name / last_name / username / language_code</p>
  <h3 id="block-e58de00b-1dc4-4176-b922-d077c8449794">7. And add styles using telegram-css variables:</h3>
  <p id="block-a5c18998-9a5c-416f-807c-48bf71e87a3d">The result is a web application like this:</p>
  <figure id="VV2Q" class="m_original">
    <img src="https://blog.mihailgok.ru/wp-content/uploads/2024/09/image-6-1008x1024.png" width="1008" />
  </figure>
  <p id="block-6f1066f2-f20e-492b-9c7d-6d0ce04f0385">It displays the basic features - getting information about the user, engaging their theme colors and controlling the app&#x27;s main button.</p>
  <h2 id="block-b21ed8b0-0616-42fc-a5ab-eb103c409ec7">Getting data from the web app in the bot</h2>
  <p id="block-58a74495-9919-4ace-95d3-8c4e2d967f81">Now we hang an event handler on the message that the web app sends in the send method (it will work only with the keyboard button):</p>
  <p id="block-542c32c3-cb95-4e53-8e6b-05f609dcd243">And that&#x27;s it - now we can get information from the site and respond to it.<br />There are other ways - but that&#x27;s another story.</p>
  <p id="block-0b0a353e-e6e8-4688-8dcd-03e727437175">Source: <a href="https://github.com/mihailgok/telegramwebapps" target="_blank">github</a>, <a href="https://codepen.io/mihailgok/pen/ZEvgKMW" target="_blank">codepen</a><br /><a href="http://t.me/lilcheckbot" target="_blank">Sample bot</a></p>

]]></content:encoded></item></channel></rss>