Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
moleculer-telegram-bot
Advanced tools
Moleculer Framework Addons: Send Messages, Photos, and Documents to Telegram using Telegram Bot API
Send Messages, Photos, and Documents to Telegram using Telegram Bot API with node-telegram-bot-api module.
npm install moleculer-telegram-bot --save
Before use the example below, please set the
TELEGRAM_TOKEN
environment variables and optionalTELEGRAM_TARGET
for default target.
const { ServiceBroker } = require('moleculer');
const TelegramService = require('moleculer-telegram-bot');
// Create broker
const broker = new ServiceBroker({ logger: console });
// Load my service
broker.createService({
name: 'telegram',
mixins: [TelegramService()]
});
// Start server
broker.start().then(() => {
broker
.call('telegram.sendMessage', { message: 'Hello Telegram!' })
.then(res => console.log('Telegram message sent.'))
.catch(console.error);
});
Property | Type | Default | Description |
---|---|---|---|
telegramToken | String | required | Telegram Bot API Token. Visit How do I create a bot?. |
telegramTarget | String | Number | - | Telegram chat id as default target |
sendMessage
Send a Telegram Message
Property | Type | Default | Description |
---|---|---|---|
message | String | required | Message text |
to | String | Number | - | Message target (required if default target not set) |
parse_mode | String | - | Optional parse mode |
disable_web_page_preview | Boolean | - | Optional disable web page preview |
disable_notification | Boolean | - | Optional disable notification |
reply_to_message_id | Number | - | Optional reply to message id |
reply_markup | Any | - | Optional reply markup |
sendPhoto
Send a Telegram Photo using URL.
Property | Type | Default | Description |
---|---|---|---|
photo | String | required | Photo URL |
to | String | Number | - | Photo target (required if default target not set) |
parse_mode | String | - | Optional parse mode |
caption | String | - | Optional photo caption |
disable_notification | Boolean | - | Optional disable notification |
reply_to_message_id | Number | - | Optional reply to message id |
reply_markup | Any | - | Optional reply markup |
fileOpts.filename | String | - | Optional filename |
fileOpts.contentType | String | - | Optional file content type |
sendDocument
Send a Telegram Document using URL.
Property | Type | Default | Description |
---|---|---|---|
doc | String | required | Document URL |
to | String | Number | - | Document target (required if default target not set) |
parse_mode | String | - | Optional parse mode |
caption | String | - | Optional document caption |
disable_notification | Boolean | - | Optional disable notification |
reply_to_message_id | Number | - | Optional reply to message id |
reply_markup | Any | - | Optional reply markup |
fileOpts.filename | String | - | Optional filename |
fileOpts.contentType | String | - | Optional file content type |
sendMessage
Send a message
Property | Type | Default | Description |
---|---|---|---|
to | String | Number | - | Message target |
message | String | - | Body of the message |
opts | TelegramBot.SendMessageOptions | - | Send message options |
sendPhoto
Send a photo
Property | Type | Default | Description |
---|---|---|---|
to | String | Number | - | Message target |
photo | String | Stream | Buffer | - | Photo to send |
opts | TelegramBot.SendPhotoOptions | - | Send photo options |
fileOpts | TelegramBot.fileOpts | - | Send photo file options |
sendDocument
Send a document
Property | Type | Default | Description |
---|---|---|---|
to | String | Number | - | Message target |
doc | String | Stream | Buffer | - | Document to send |
opts | TelegramBot.SendDocumentOptions | - | Send document options |
fileOpts | TelegramBot.fileOpts | - | Send document file options |
npm test
In development with watching
npm run ci
The project is available under the MIT license.
FAQs
Moleculer Framework Addons: Send Messages, Photos, and Documents to Telegram using Telegram Bot API
We found that moleculer-telegram-bot demonstrated a not healthy version release cadence and project activity because the last version was released 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.