Gathering detailed insights and metrics for telegram
Gathering detailed insights and metrics for telegram
Gathering detailed insights and metrics for telegram
Gathering detailed insights and metrics for telegram
NodeJS/Browser MTProto API Telegram client library,
npm install telegram
Typescript
Module System
Node Version
NPM Version
90.3
Supply Chain
98
Quality
86.3
Maintenance
100
Vulnerability
98.6
License
TypeScript (69.89%)
JavaScript (30.05%)
Batchfile (0.04%)
Shell (0.03%)
Total Downloads
3,666,497
Last Day
5,519
Last Week
57,187
Last Month
226,293
Last Year
2,002,257
MIT License
1,509 Stars
554 Commits
195 Forks
13 Watchers
5 Branches
49 Contributors
Updated on Jun 08, 2025
Minified
Minified + Gzipped
Latest Version
2.26.22
Package Id
telegram@2.26.22
Unpacked Size
1.96 MB
Size
362.49 kB
File Count
226
NPM Version
11.0.0
Node Version
20.18.0
Published on
Feb 12, 2025
Cumulative downloads
Total Downloads
Last Day
28.4%
5,519
Compared to previous day
Last Week
13.2%
57,187
Compared to previous week
Last Month
14.9%
226,293
Compared to previous month
Last Year
111.5%
2,002,257
Compared to previous year
14
23
2
A Telegram client written in JavaScript for Node.js and browsers, with its core being based on Telethon.
Here you'll learn how to obtain necessary information to create telegram application, authorize into your account and send yourself a message.
Note that if you want to use a GramJS inside of a browser, refer to this instructions.
Install GramJS:
1$ npm i telegram
After installation, you'll need to obtain an API ID and hash:
Never share any API/authorization details, that will compromise your application and account.
When you've successfully created the application, change apiId
and apiHash
on what you got from telegram.
Then run this code to send a message to yourself.
1import { TelegramClient } from "telegram"; 2import { StringSession } from "telegram/sessions"; 3import readline from "readline"; 4 5const apiId = 123456; 6const apiHash = "123456abcdfg"; 7const stringSession = new StringSession(""); // fill this later with the value from session.save() 8 9const rl = readline.createInterface({ 10 input: process.stdin, 11 output: process.stdout, 12}); 13 14(async () => { 15 console.log("Loading interactive example..."); 16 const client = new TelegramClient(stringSession, apiId, apiHash, { 17 connectionRetries: 5, 18 }); 19 await client.start({ 20 phoneNumber: async () => 21 new Promise((resolve) => 22 rl.question("Please enter your number: ", resolve) 23 ), 24 password: async () => 25 new Promise((resolve) => 26 rl.question("Please enter your password: ", resolve) 27 ), 28 phoneCode: async () => 29 new Promise((resolve) => 30 rl.question("Please enter the code you received: ", resolve) 31 ), 32 onError: (err) => console.log(err), 33 }); 34 console.log("You should now be connected."); 35 console.log(client.session.save()); // Save this string to avoid logging in again 36 await client.sendMessage("me", { message: "Hello!" }); 37})();
Note that you can also save auth key to a folder instead of a string, change
stringSession
into this:1const storeSession = new StoreSession("folder_name");
Be sure to save output of client.session.save()
into stringSession
or storeSession
variable to avoid logging in again.
GramJS works great in combination with frontend libraries such as React, Vue and others.
While working within browsers, GramJS is using localStorage
to cache the layers.
To get a browser bundle of GramJS, use the following command:
1NODE_ENV=production npx webpack
You can also use the helpful script generate_webpack.js
1node generate_webpack.js
To use raw telegram API methods use invoke function.
1await client.invoke(new RequestClass(args));
General documentation, use cases, quick start, refer to gram.js.org, or older version of documentation (will be removed in the future).
For more advanced documentation refer to gram.js.org/beta (work in progress).
If your ISP is blocking Telegram, you can check My ISP blocks Telegram. How can I still use GramJS?
If you have any questions about GramJS, feel free to open an issue or ask directly in our telegram group - @GramJSChat.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
Found 11/30 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-02
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More