Skip to content

Commit

Permalink
Merge pull request #384 from reveloper/extended_messages_scheme
Browse files Browse the repository at this point in the history
Extended messages scheme
  • Loading branch information
reveloper committed Oct 23, 2023
2 parents 96c867f + 465dbc9 commit 8b1140e
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
16 changes: 8 additions & 8 deletions docs/develop/dapps/telegram-apps/app-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ Check out the examples below to see how to create your own Telegram Mini App.

<p align="center">
<br />
<img width="240" src="https://github.com/twa-dev/vanilla-js-boilerplate/raw/master/assets/tapps.png" alt="logo of telegram mini apps" />
<img width="240" src="/img/docs/telegram-apps/tapps.png" alt="logo of telegram mini apps" />
<br />
</p>


This is a basic and straightforward Telegram Mini App(TMA) implemented using plain JavaScript, HTML, and CSS. This project aims to provide a minimalistic example of how to create a simple TMA and launch it within Telegram without relying on complex build tools or bleeding-edge libraries.

- App is available via direct link: [t.me/simple_telegram_web_app_bot/app](https://t.me/simple_telegram_web_app_bot/app)
- Or you can launch app with a bot menu button: [t.me/simple_telegram_web_app_bot](https://t.me/simple_telegram_web_app_bot)
- Deployment URL: [twa-dev.github.io/vanilla-js-boilerplate](https://twa-dev.github.io/vanilla-js-boilerplate/)
- App is available via direct link: [t.me/simple_telegram_mini_app_bot/app](https://t.me/simple_telegram_mini_app_bot/app)
- Or you can launch app with a bot menu button: [t.me/simple_telegram_mini_app_bot](https://t.me/simple_telegram_mini_app_bot)
- Deployment URL: [https://telegram-mini-apps-dev.github.io/vanilla-js-boilerplate/](https://telegram-mini-apps-dev.github.io/vanilla-js-boilerplate/)

<Button href="https://t.me/simple_telegram_web_app_bot/app" colorType={'primary'} sizeType={'sm'}>Open Demo</Button>
<Button href="https://github.com/twa-dev/vanilla-js-boilerplate" colorType={'secondary'} sizeType={'sm'}>GitHub</Button>
<Button href="https://t.me/simple_telegram_mini_app_bot/app" colorType={'primary'} sizeType={'sm'}>Open Demo</Button>
<Button href="https://github.com/Telegram-Mini-Apps-Dev/vanilla-js-boilerplate.git" colorType={'secondary'} sizeType={'sm'}>GitHub</Button>



Expand All @@ -40,7 +40,7 @@ To run this example, you'll need a modern web browser with JavaScript enabled.
1. Clone this repository to your local machine:

```bash
git clone https://github.com/twa-dev/vanilla-js-boilerplate.git
git clone https://github.com/Telegram-Mini-Apps-Dev/vanilla-js-boilerplate.git
```

2. Navigate to the project directory:
Expand All @@ -64,7 +64,7 @@ Open index.html in your preferred code editor or IDE.

Vite (which means "fast" in French) is a front-end build tool and development server that aims to provide a faster and leaner development experience for modern web projects. We will utilise Vite to create Telegram Mini App example.

You can find example project here [https://github.com/twa-dev/vite-boilerplate](https://github.com/twa-dev/vite-boilerplate) or you can go through following instructions.
You can find example project here [https://github.com/Telegram-Mini-Apps-Dev/vite-boilerplate](https://github.com/Telegram-Mini-Apps-Dev/vite-boilerplate) or you can go through following instructions.

### Prerequisites

Expand Down
23 changes: 22 additions & 1 deletion docs/develop/dapps/telegram-apps/tips-and-tricks.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


# Tips and Tricks


Expand Down Expand Up @@ -31,3 +30,25 @@ The process of development in Google Chrome more convenient because of the famil

You can retrieve the launch parameters of the mini-app and open this link in Chrome. For our case, the easiest way is to retrieve the launch parameters from the web version of Telegram: [https://web.telegram.org/](https://web.telegram.org/)



### Closing Behaviour


In many web applications, users might accidentally close the app while scrolling to the top. This can happen if they drag a section of the application too far, inadvertently triggering the app to close.


<p align="center">
<br />
<img width="240" src="/img/docs/telegram-apps/closing-behaviour.svg" alt="closing_behaviour_durgerking" />
<br />
</p>


To prevent such accidental closures, enable `closing_behavior` in the TMA. This method will add a dialog where the user can either approve or decline the closing of the Web App.



```typescript
window.Telegram.WebApp.enableClosingConfirmation()
```
19 changes: 19 additions & 0 deletions static/img/docs/telegram-apps/closing-behaviour.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/docs/telegram-apps/tapps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/schemes-visio/message_processing.vsdx
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8b1140e

Please sign in to comment.