Render's free tier puts services to sleep after 15 minutes of inactivity.
File: .github/workflows/keep-alive.yml
How it works:
- Runs automatically every 5 minutes
- Pings your bot at:
https://api-bot-in6q.onrender.com/health - Keeps the service active 24/7
- Zero cost, zero maintenance
Status: ✅ Active after push
File: bot.py lines 139-158
How it works:
- Bot pings itself every 5 minutes
- Uses
localhost:10000/ - Only works when bot is already running
- Helps maintain activity
Status: ✅ Already implemented
Every 5 minutes:
GitHub Actions (external)
↓
Pings /health endpoint
↓
Render wakes up (if sleeping)
↓
Bot responds with 200 OK
↓
Internal self-ping activates
↓
Bot stays awake
- Go to: https://github.com/Masterofowls/API_Bot/actions
- See workflow runs every 5 minutes
- Green checkmark = working ✅
- Red X = needs attention
⚠️
GET /health 200 OK
✓ Keep-alive ping sent
- Telegram bot should respond instantly (not delayed)
- No "waking up" messages in logs
git add .github/workflows/keep-alive.yml KEEP_ALIVE.md
git commit -m "Add GitHub Actions keep-alive system"
git push- Go to: https://github.com/Masterofowls/API_Bot/actions
- If disabled, click "I understand my workflows, go ahead and enable them"
- Workflow will start running automatically
- Go to Actions tab
- Click "Keep Bot Alive on Render"
- Click "Run workflow" → "Run workflow"
- Wait 30 seconds, check for green checkmark
If GitHub Actions fails:
- Go to: https://uptimerobot.com/
- Sign up (free)
- Add monitor:
- Type: HTTP(s)
- URL:
https://api-bot-in6q.onrender.com/health - Interval: 5 minutes
- Save
Another backup option:
- Go to: https://cron-job.org/
- Sign up
- Create job:
- URL:
https://api-bot-in6q.onrender.com/health - Schedule:
*/5 * * * *(every 5 min)
- URL:
- Enable
- Bot sleeps after 15 minutes
- First message after sleep: 10-30 second delay
- Render shows: "Service waking up..."
- Bot always responsive (< 1 second)
- No wake-up delays
- Render logs show regular activity
- 24/7 uptime
- GitHub Actions is FREE for public repos (unlimited minutes)
- Render free tier has 750 hours/month (keep-alive uses ~720 hours)
- If repo is private, you have 2,000 minutes/month (enough for ~27 days)
- Multiple pings (GitHub + internal) ensure reliability
Check: Is repo public? Private repos have minute limits. Fix: Go to repo Settings → Actions → General → Enable workflows
Check: GitHub Actions logs for errors Fix: Add UptimeRobot as backup (see above)
Check: Render logs at https://dashboard.render.com/ Fix: Manual deploy to restart service
*/5 * * * *
│ │ │ │ │
│ │ │ │ └─── Day of week (0-7, 0=Sunday)
│ │ │ └───── Month (1-12)
│ │ └─────── Day of month (1-31)
│ └───────── Hour (0-23)
└─────────── Minute (0-59) - */5 means every 5 minutes
- URL:
/health - Response:
{"status": "ok", "uptime": seconds} - HTTP 200 OK
- Fast response (< 100ms)
After setup:
-
.github/workflows/keep-alive.ymlfile pushed - GitHub Actions enabled in repo settings
- First workflow run completed (check Actions tab)
- Bot responding instantly in Telegram
- Render logs show no sleep messages
- Test by not using bot for 20 minutes
- Bot still responds instantly after 20 min
You'll know it's working when:
- GitHub Actions shows green checkmarks every 5 minutes
- Render dashboard shows consistent activity
- Bot responds instantly at any time of day
- No "waking up" delays in Telegram
- Render free hours slowly counting up (not resetting)
Status: ✅ Ready to deploy Next: Push to GitHub and enable Actions