Telegram Bot Project - Group 3
Telegram bot info
Username: @is238group3telegramchatbot
Link: t.me/is238group3telegramchatbot
Demo on Youtube
https://www.youtube.com/watch?v=RLXr3sr0a6I
Group Member hosting the AWS Academy account
Alvin Lucillo
How to use the project
1. Prerequisites (this is for the .env file)
- Retrieve the Telegram token from BotFather for the associated Telegram bot
- Retrieve the SMTP information from your choice of SMTP provicer for the REPORT functionality
- Retrieve the Twilio information from Twilio for the LOGIN with OTP functionality
2. Deployment on EC2
- Create an EC2 instance on AWS
- Install the following on your EC2 instance if there is none installed by default: node, npm and git
- Download/clone the repo:
git clone https://github.com/ablucillo/is238telegrambot.git
- Within the project directory, install the project dependencies:
npm i
- Create a copy of .env.sample and rename to .env:
sudo cp .env.sample .env
- Populate the .env file with the information from the Prerequisites step
- Install pm2 globally. This will be used to start the Telegram bot app whenever the EC2 instance is restarted.
npm install pm2 -g
- Start the app and add it to pm2. Ensure that you are within the directory where app.js resides.
pm2 start app.js
- Save a snapshot of your running Node applications.
pm2 save
- Run the script generated by the following command. This step ensures that the app is started whenever the EC2 instance is restarted.
pm2 startup
- NOTE: Once the lab stops (as it does after 6 hours of use), the EC2 instance stops as well, making the Telegram bot unavailable. However, once the lab starts and subsequently the EC2 instance does too, the Telegram bot app should be up and running, which is because of pm2.