
Security News
Feross on Risky Business Weekly Podcast: npm’s Ongoing Supply Chain Attacks
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
telegram-message-send
Advanced tools
This library provides a simple class-based interface for sending messages and various media types to a Telegram bot.
yarn add telegram-message-send
npm install telegram-message-send
import { TelegramBot } from 'telegram-message-send';
const botKey = 'YOUR_BOT_KEY';
const chatId = 'YOUR_CHAT_ID';
const bot = new TelegramBot(botKey, chatId);
async function sendMessages() {
await bot.sendMessage('Hello World');
await bot.sendPhoto('https://avatars.githubusercontent.com/u/100691616?s=200&v=4', 'Custom Caption');
await bot.sendAudio('https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3', 'Custom Caption');
await bot.sendDocument('https://s2.q4cdn.com/175719177/files/doc_presentations/Placeholder-PDF.pdf', 'Custom Caption');
await bot.sendLocation(41.084677113651814, 29.00455392606353);
await bot.sendContact('Ilker Balcilar', '+905555555555');
await bot.sendPoll('Which one would you prefer', ['Javascript', 'Typescript']);
await bot.sendDice('dice'); // or 'dart', 'basketball', etc.
}
sendMessages();
Create a Telegram bot with BotFather before connecting your bot to Telegram.
/newbot
to create a new Telegram bot.botKey
) for later steps./getid
. You will get a reply back with your user ID.chatId
).In order to receive a message from the bot, you must first send a message to the bot and create a chat.
new TelegramBot(botKey, chatId)
botKey
(string, required): Your Telegram bot's access token.chatId
(string, required): The ID of the chat to send messages to.sendMessage(text)
text
(string, required): The message text to send.sendPhoto(photoURL, caption?)
photoURL
(string, required): URL of the photo to send.caption
(string, optional): Photo caption.sendAudio(audioURL, caption?)
audioURL
(string, required): URL of the audio file to send.caption
(string, optional): Audio caption.sendDocument(documentURL, caption?)
documentURL
(string, required): URL of the document to send.caption
(string, optional): Document caption.sendVideo(videoURL, caption?)
videoURL
(string, required): URL of the video to send.caption
(string, optional): Video caption.sendGIF(gifURL, caption?)
gifURL
(string, required): URL of the GIF to send.caption
(string, optional): GIF caption.sendLocation(latitude, longitude)
latitude
(number, required): Latitude of the location.longitude
(number, required): Longitude of the location.sendContact(name, phoneNumber)
name
(string, required): Contact's name.phoneNumber
(string, required): Contact's phone number.sendPoll(question, options)
question
(string, required): Poll question.options
(string[], required): Array of poll options.sendDice(type?)
type
(string, optional): Type of dice to send ('dice', 'dart', 'basketball', 'football', 'bowling', 'slot'). Defaults to 'dice'.
FAQs
Send message using telegram bot and api.
We found that telegram-message-send demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.