Introduction

Capsule supports both Telegram Bots and Mini-Apps. First, you’ll need to decide which one you’re building. We recommend reading through the linked Telegram guides before getting started.

Telegram Bots are a way to program logic natively into the Telegram App interface via text-based prompts and commands. Telegram Bots feel very native to the UX of Telegram, but are more limited to UX and functionality of text-based options and menus.

Telegram Mini-Apps are an easy way to serve hosted Web Applications from within Telegram. Because Mini-Apps are essentially added functionality to an existing web app, they are much more flexible but have a UX pattern that deviates from the native Telegram experience.

Telegram Bot

The most popular way to use Capsule in a Telegram Bot is to leverage Pregenerated Wallets in conjunction with the Server SDK that is already serving content to your Telegram Bot.

You’ll then need to decide where and how you want users to claim their pregenerated wallets. This can happen in a webview within Telegram or a standalone app.

Mini-App

Mini-Apps also leverage pregenerated wallets, but make use of Telegram CloudStorage to store the user share.

To take advantage of mini-apps, first you’ll need to set up a web app sourcing the mini-app. For this, you can use Pregenerated Wallets in conjunction with the Web SDK in the web framework of your choice.

Once you have a web example working with the above, to use telegram storage you’ll need to create an interface for getting and setting data, like in this example.

You’ll then need to decide where and how you want users to claim their pregenerated wallets. This can happen within the Telegram mini-app or a standalone app.

Telegram Storage APIs have some limitations on data size. You may need to implement chunking to work around this. See this reference implementation for more info.

Telegram Mini-Apps

Telegram Mini-App using Capsule Pregenerated Wallets