简体   繁体   中英

Can i use Free Heroku plan as a Telegram Bot?

I want to use Telegram Bot with enabled webHook,

Can I use Heroku free plan as my Bot's Url to hook up when received text message ?

I'm using Nodejs as language.

Yes, you can and it works fine. But Heroku will try to freeze your app for some time. In fact it can't be active for more than 18 of the last 24 hours.

And if you will prevent it, with ping your app or your bot will continuously receive messages, your app will recharge next 6 hours. It's a limit of the free plan.

I suggest that you use Openshift, it doesn't have such limits in free tier.

I guess another suggestion I can make is for you to use glitch .

I use glitch for all the bots I have made so far, it's free, easy to get started with. It also has the limitation where it sleeps after 5 minutes of your bot not being active.

In a post they say the reason why and how to solve it:

Apps sleeping is a large reason why we can offer the Glitch service for free, so it's not something we can turn off. However, we accept that for some use-cases, like bots with no webhooks support, that's not ideal. It's possible to expose a route in your app that a web cron service or uptime monitoring service can hit and cause your bot to wake. Doing that every 5 mins or so should do what you want.

Hope it helps.

I have a couple of telegram bots hosted on Heroku's free plan, with webhooks active. They work fine but as mentioned in other answers the app is put to sleep after 30 minutes of inactivity: webhooks will reactivate it but when waking up there will be some lag and rarely some malfunctions (I lost a couple of commands). There is a monthly limit of usage time but unless the bot is heavily used I found that this has not ever been a problem. All in all I like the service, especially since it is free.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM