const TelegramBot = require("node-telegram-bot-api"); // replace the value below with the Telegram token you receive from @BotFather const TOKEN = "AAHk_qlAnVQX2xjUUUFMnKzSuX3knHOidYY"; /* Use this token to access the HTTP API: 7542722102:AAHk_qlAnVQX2xjUUUFMnKzSuX3knHOidYY */ // Create a bot that uses 'polling' to fetch new updates // const bot = new TelegramBot(token, { polling: true }); const options = { webHook: { // Just use 443 directly port: 443, }, }; // You can use 'now alias ' to assign fixed // domain. // See: https://zeit.co/blog/now-alias // Or just use NOW_URL to get deployment url from env. const url = 'https://bot.10adyp.top/webHook' || process.env.NOW_URL; const bot = new TelegramBot(TOKEN, options); // This informs the Telegram servers of the new webhook. // Note: we do not need to pass in the cert, as it already provided bot.setWebHook(`${url}/bot${TOKEN}`); // Just to ping! bot.on('message', function onMessage(msg) { bot.sendMessage(msg.chat.id, 'I am alive on Zeit Now!'); });