Telegram bot development using node.js and Telegraf API.
Step by step guide:
ishan0445 / telegraf-telegram-bot-deploy
Telegram bot deploy steps for Telegraf API using micro-bot
Steps to host your Telegram bot
Heroku:
- Create a Telegram bot with Telegraf API.
- Create account on Heroku.
- Install Heroku CLI.
- Install and setup git.
-
Add micro-bot to the project
npm install micro-bot --save
- Remove Telegraf dependency from package.json.
-
set the start command in package.json
... "main": "index.js" "scripts": { "start": "micro-bot" } ...
-
Make cahnges in the code
-
Change the telegraf import to
const { Composer } = require('micro-bot')
-
Create bot from Composer:
const bot = new Composer
-
Finally remove bot.launch() line instead use:
module.exports = bot
-
Change the telegraf import to
-
Init a new git repo:
git init
-
make .gitignore file with following content:
node_modules
-
Login to Heroku:
heroku login
-
Create a Heroku app:
heroku create
-
Update Heroku config
heroku config:set --app YourAppId BOT_TOKEN='YOUR BOT
…
What you will learn:
- Intro to Heroku, git and micro-bot npm package
- Deploying to Heroku
- Testing Bot after deployment
- And a lot more...
Requirements:
- Please watch previous parts
- Basic Programming (everything will be taught from basics).
- Telegram Account.
Example Bot:
Search for @covid_19_india_bot on telegram or click here
https://t.me/covid_19_india_bot
Top comments (1)
Worked? ?