Can i use Free Heroku plan as a Telegram Bot? - heroku

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.

Related

Tweepy Bot Crashes After Duplicates

I have a question about running my Twitter bot 24/7, and I already have it uploaded to Heroku. The code works great.
However, the dynos will fall asleep after 30 minutes of non-use. This is great, however, my code is programming to tweet the same thing once a day.
In order to keep the dynos alive, the code has to be run every 30 minutes. The tweet, however, is the same thing once a day.
Is there a way to keep the Twitter code running when receiving a duplicate?
It seems like you want to bypass the limit, but that is not possible. if you keep running that service all day your free hours will expire.
Verified accounts come with a monthly pool of 1000 Free dyno hours; unverified >accounts receive 550. When a Free dyno is active, it draws from the pool; your free >apps can run as long as there are dyno hours left in your monthly pool.
instead, better to upgrade the Heroku to the premium version.

Why my trading bot is being restarting after I made a sys exit on my python module?

I want just 1 trade open at a time. But Heroku force my bot to open another trade each time my bot "crashes" because Heroku restarting my bot again.
How can avoid this and "tell" Heroku to doing nothing if I already have an open trade?
I had to turn off the web dynos
This is not Heroku's fault. Heroku will always try to keep you application up, that's the deal with using such services. So if it crashes, it will restart.
You should check on your own application to only open a trade if there isn't one already.

Worker Dyno go to sleep with the Web dyno

I'm using heroku to host my discord bot
My bot is mostly designed to be used with the discord chats, but it have a web dashboard for when in need too. I put the bot on heroku, everything seems to be working well, I know about the 30 minutes sleep time for web dyno, and it was fine, since the web dashboard is only used every so often, not 24/24 like the bot. The issue here is, when the web dyno go offline, it also brought the worker dyno down too, which is not what I wanted. Although the documents say that "Worker Dynos do not sleep, since they don't handle web requests", clearly that my worker dyno is sleeping with the web dyno. I don't want to use pinging services, since my 1000 free hours is not enough for both dynos to stay online. Is there a workaround for this? Thanks

Hubot Heroku route message on startup

I have deployed a Hubot on Heroku to interact with Slack. I am using a free dyno currently. After 30 minutes of inactivity, it goes to sleep. It wakes up when pinged from Slack. However, the first request is lost in the mix. So the user has to type the command a second time. Is there an easy way to make the bot wake up and still handle the first command?
As stated in the documentation :
To get around this, you can use the hubot-heroku-keepalive script, which will keep your free dyno alive for up to 18 hours/day. If you never want Hubot to sleep, you will need to upgrade to Heroku's hobby plan.
I use it so Hubot is at least online from 6 AM to midnight.

Will my Heroku app working on 1 web dyno stay active if I pay for 1 worker dyno?

I currently have an app deployed on Heroku which runs on two web dynos so it won't go to sleep if it remains inactive for a certain time.
Now if I scale it down to only one web dyno (free) and instead pay for one worker dyno, will Heroku always keep my app active?
It will still idle - you NEED to have more than a single web dyno
https://devcenter.heroku.com/articles/dyno-idling
You can also use the New Relic add-on to monitor your app and keep it alive. There is a tab in settings to configure availability monitoring.
You can also avoid a single web dyno from idling by using a monitoring service like pingdom.com since it's periodically sending a request to your web dyno.
Try Pingdom. Free plans include one website check. I use this service to keep my app active all the time.
Pingdom tests your websites and other infrastructure components as
often as every minute to make sure it is all up and running.
From Pingdom Homepage
Pingdom does this by "pinging" or rather requesting a resource from your website on a regular interval. This has the side effect of keeping your website "active", cache's primed, etc.. because your website is seeing regular "traffic" (the requests coming from pingdom).
Try Un-idler. You don't need to sign in and it's free.
http://unidler.herokuapp.com/
You can try http://kaffeine.herokuapp.com/ it will ping your app every 30 minutes so your app won't go to sleep.
Try CloudUp. It visits your apps periodically to keep them awake. It is free, and you can add as many apps as you want. It also activates apps on Google App Engine and Azure.

Resources