Answer the question
In order to leave comments, you need to log in
How to set up web hooks for Telegram bot on Nodejs?
Good afternoon:
const TELEGRAM_TOKEN = process.env.BOT_TOKEN || '0x000000000000000000'
const Telegraf = require('telegraf')
const fastifyApp = require('fastify')()
const bot = new Telegraf(TELEGRAM_TOKEN)
bot.on('text', ({ reply }) => reply('Hello'))
fastifyApp.use(bot.webhookCallback(`/${TELEGRAM_TOKEN}`))
// Set telegram webhook
// npm install -g localtunnel && lt --port 3000
bot.telegram.setWebhook(`https://kinobu-sentry.herokuapp.com/${TELEGRAM_TOKEN}`)
fastifyApp.get(`/${TELEGRAM_TOKEN}`, (req, reply) => {
console.dir(req)
})
fastifyApp.listen(3000, () => {
console.log('Example app listening on port 3000!')
})
2020-01-15T07:08:13.388551+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/0XXXXXXXXXXXXXXXXXXXXXX" host=kinobu-sentry.herokuapp.com request_id=6d977e09-65af-4500-9e39-6feb17a584ff fwd="91.108.6.84" dyno= connect= service= status=503 bytes= protocol=https
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question