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
npm install telegram
Typescript
Module System
Node Version
NPM Version
64.8
Supply Chain
98
Quality
94
Maintenance
100
Vulnerability
98.6
License
Total
2,436,333
Last Day
3,088
Last Week
47,060
Last Month
157,812
Last Year
1,505,405
1,336 Stars
553 Commits
182 Forks
13 Watching
5 Branches
50 Contributors
Updated on 06 Dec 2024
TypeScript (69.89%)
JavaScript (30.05%)
Batchfile (0.04%)
Shell (0.03%)
Cumulative downloads
Total Downloads
Last day
88.8%
3,088
Compared to previous day
Last week
17.9%
47,060
Compared to previous week
Last month
29.7%
157,812
Compared to previous month
Last year
335%
1,505,405
Compared to previous year
16
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
11 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 9
Reason
1 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
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 2024-12-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