
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
messaging-api-telegram
Advanced tools
Messaging API client for Telegram
npm i --save messaging-api-telegram
or
yarn add messaging-api-telegram
const { TelegramClient } = require('messaging-api-telegram');
// get accessToken from telegram [@BotFather](https://telegram.me/BotFather)
const client = new TelegramClient({
accessToken: '12345678:AaBbCcDdwhatever',
});
messaging-api-telegram
uses axios as HTTP client. We use axios-error package to wrap API error instances for better formatting error messages. Directly calling console.log
with the error instance will return formatted message. If you'd like to get the axios request
, response
, or config
, you can still get them via those keys on the error instance.
client.getWebhookInfo().catch((error) => {
console.log(error); // formatted error message
console.log(error.stack); // error stack trace
console.log(error.config); // axios request config
console.log(error.request); // HTTP request
console.log(error.response); // HTTP response
});
All methods return a Promise.
To enable default request debugger, use following DEBUG
env variable:
DEBUG=messaging-api:request
If you want to use a custom request logging function, just provide your own onRequest
:
const client = new TelegramClient({
accessToken: ACCESS_TOKEN,
onRequest: ({ method, url, headers, body }) => {
/* */
},
});
To avoid sending requests to real Telegram server, specify the origin
option when constructing your client:
const { TelegramClient } = require('messaging-api-telegram');
const client = new TelegramClient({
accessToken: ACCESS_TOKEN,
origin: 'https://mydummytestserver.com',
});
Warning: Don't do this on your production server.
1.0.4 / 2021-01-11
FAQs
Messaging API client for Telegram
The npm package messaging-api-telegram receives a total of 1,297 weekly downloads. As such, messaging-api-telegram popularity was classified as popular.
We found that messaging-api-telegram demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.