Browser

GramJS can be easily converted to something you can use in a browser with webpack.

at the time of writing this, the supported webpack versions are

webpack 5.21.2
webpack-cli 4.5.0

To create the file simply call webpack in the root folder and a new folder called browser would be created in which you'll find the gramjs.js file that you can use.

a simple usage example would be like so

<script src="./browser/gramjs.js"></script>
<script>

const { TelegramClient } = gramjs
const { StringSession } = gramjs.sessions
const client = new TelegramClient(new StringSession(''), apiId, apiHash, {
    connectionRetries: 3,
})
</script>

Last updated