Last active
August 16, 2021 13:51
-
-
Save headStyleColorRed/2f0e5e52560710bf05667844a3d02118 to your computer and use it in GitHub Desktop.
MEDIUM telegram notification bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TelegramBot = require('node-telegram-bot-api'); | |
function sendMessage(message, botId, chatId) { | |
const bot = new TelegramBot(botId, { polling: false }); | |
try { | |
bot.sendMessage(chatId, message) | |
} catch { | |
return 'Something went wrong when trying to send a Telegram notification' | |
} | |
return "Success sending Telegram notification" | |
} | |
module.exports = { | |
sendMessage, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment