A telegram bot shares the list of ebooks with URL, reader can clicks on the link to read the ebooks file.
ebooks_bot.mp4
- Google Drive with a folder for eBooks
- Telegram chatbot token, see https://t.me/BotFather
[1] Goto https://script.google.com/home
Click "New Project"
[2] Rename the project
Click on the "Untitled project" to rename the project as something else. Example, "Ebooks bot".
[3] Write the scripts, copy paste from below template url :
https://raw.githubusercontent.com/WingsMaker/ebooks_readerbot/main/ebooks_readerbot.txt
[4] Deploy as google web app
In the Google App Script project, go to "Publish" in the top navigation bar. Under "Deploy as web app", select "Deploy". This will open a pop-up window. Your web app URL will be listed in the "Current web app URL" field.
Click on the "Deploy - New Deployment"
Click "Select type - Web App"
Fill in the form and click "Deploy". ( for more see https://www.youtube.com/watch?v=-AlstV1PAaA )
Copy the web app url to the clipboard for later use.
[5] Update the values of webhook in the script.
Change the value of statement, paste the url address into here.
var webhook = "_your web app url";
[6] Update the values of token in the script.
Find your Telegram chatbot token by logging into the BotFather in Telegram, selecting your bot, and clicking the "API Token" button. ( see https://www.youtube.com/watch?v=aNmRNjME6mE )
Change the value of statement, paste the bot token into here.
var token = "your telegram bot token__";
[7] Update the values of FOLDER_NAME in the script.
If your ebooks in located at the "eBooks" folder in the google drive, leave it alone. Otherwise, update the value of FOLDER_NAME.
var FOLDER_NAME = "eBooks"; // assuming there is a folder called eBooks in your google drive.
[8] Save the script and REDO the deployment process in step 4
since the code has been changed, need to udpate the value of webhook in [7].
[9] Run the "setWebhook" function for only once to make sure actual telegram bot able to callback this google web app.
Your telegram bot is ready !