message-group-telegram-bot
v1.0.2
Published
This package will be used to send the messages to Telegram groups.
Downloads
9
Maintainers
Readme
Messaging Telegram Bot API
This package is created by using Telegram Bot API to send message to public Telegram group via installed Bot.
- TelegramBotMemberGroup use to confirm the existence of telegram group and also confirmed that bot is already installed
- TelegramBot use to send the message to telegram group where bot is already installed
Installation
npm install message-group-telegram-bot
Usage
TelegramBotMemberGroup
const { TelegramBotMemberGroup } = require("message-group-telegram-bot");
const token = "YOUR TOKEN";
const options = {
method: "sendMessage",
action: "member_access",
chat_id: "YOUR GROUP_ID",
tg_bot_username: "bot username ",
bot_dsiplay_name: "Bot display name",
};
async function confirmTelegramGroupChannelExistence() {
try {
const bot = new TelegramBotMemberGroup(token, options);
const response = await bot.sendRequest();
console.log("response: ", response);
} catch (error) {
console.log("error", error);
}
}
confirmTelegramGroupChannelExistence();
TelegramBot
const { TelegramBot } = require("message-group-telegram-bot");
const token = "bot_token_here";
const content = `Send message to group telegram`;
const options = {
method: "sendMessage",
action: "send",
message: {
chat_id: "YOUR GROUP_ID",
content,
},
};
async function sendTelegramTestMessage() {
try {
const bot = new TelegramBot(token, options);
const response = await bot.sendRequest();
console.log("response:", response);
} catch (error) {
console.log("error:", error);
}
}
sendTelegramTestMessage();