Telegram bot API can be used to create a chatbot that returns the complete details of movies, web series, and Tv series by sending the name of the movie or series as a command. Telegram provides a bunch of API’s methods to perform different functions. The telegram bot can be used to know the complete details of the movie without going to other websites like the IMDb site, etc.
- The latest version of Node (version > 10)
- The latest version of npm (version > 6)
Command to check if Node and npm are present in your system:
$ npm --v 6.14.5 $ node --version v10.15.0
Creating Bot and Getting API Token:
- Open the telegram app and search for @BotFather.
- Click on the start button or send “/start”.
- Then send “/newbot” message to set up a name and a username.
- The BotFather will then give you an API token.
Getting Movie API Key:
- Go to the OMDB (open movie database ) website.
- Create an account as per the limit.
- You will receive your own API key.
Requests: To install this module type the below command in the terminal.
$ npm install --save requests
node-telegram-bot-api: Node.js module to interact with the official Telegram Bot API.
$ npm install node-telegram-bot-api
Steps to run the program: Run bot.js file using the following command:
$ node bot.js
Now, Go to your bot and type /movie movie-name and see the results.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.