Heroku deployment
See original GitHub issueAfter deployment to Heroku the bot receives all messages, but doesn’t answer. In case the bot sends two messages consequently in a short period of time, only the second one gets delivered. When polling is used, all the messages sent by the bot get delivered. I also tried using webhooks without express, but nothing changed. I found several related issues, but in all of them the author ended up using node-telegram-bot library which solved the problem.
The code used for setting webhook:
const express = require("express");
const expressApp = express();
const bot = new Telegraf(process.env.BOT_TOKEN);
bot.telegram.setWebhook(`${process.env.BOT_URL}/bot${process.env.BOT_TOKEN}`);
expressApp.use(bot.webhookCallback(`/bot${process.env.BOT_TOKEN}`));
bot.use(Telegraf.log());
bot.use(session({
ttl: 100
}));
expressApp.get("/", (req, res) => {
res.send("Hello World!");
});
expressApp.listen(process.env.PORT, () => {
console.log(`Example app listening on port ${process.env.PORT}!`);
});
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Deployment - Heroku Dev Center
Most Heroku deployments are performed with Git. Heroku also supports Docker-based deployments. Additionally, you can deploy to Heroku via any of the following ......
Read more >Heroku Deploy – How to Push a Web App or Site to Production
Heroku allows developers to quickly and almost painlessly deploy an application on a web server. It also provides a lot of plugins that...
Read more >Heroku Deployment Methods: 1/3 - YouTube
This Heroku Showcase demonstrates several deployment methods available on the Heroku Platform. In this, the first of three deployment ...
Read more >How To Deploy to Heroku in 5 Minutes - YouTube
In this video I teach how to deploy an api to Heroku in under 5 minutes. Heroku is one of the best services...
Read more >Heroku Deployment Guide | The Full-Stack Blog - GitHub Pages
Deploy to Heroku ... Okay, it's time to actually deploy your application! Deployment allows other developers to give you more detailed feedback ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I have a question, what is
/secret-path
?, What am I supposed to put there?@TiagoDanin This is not what I asked, although I do appreciate your effort.
What I do struggle with is how to implement bot.launch in the code you provided yourself.
I have exactly the same setup with expessApp and stuff, so I was having trouble modifying my code to fit the bot.launch in.
Also I updated the telegraf obviously and I am still experiencing random malfunctioning API calls.
What is skipped almost always is the calls of
ctx.telegram.deleteMessage()
andctx.answerCbQuery()
.ctx.telegram.editMessageMedia()
seems to ALWAYS work though.I can post the whole code base of mine, but since its multiple files I do feel like it’s too much to go through for you guys. The fact is that it’s all working fine with locally hosted long polling app.