A simple Node.js Telegram bot that returns IMDb ratings for movies and series using the OMDb API.
You send the bot a title (like Inception or Breaking Bad) and it replies with the title, year, type (movie/series), IMDb rating, and a link to the IMDb page. You can try it live at @ImdbRatings_bot.
- Get IMDb rating for a movie or series by title.
- Uses the free OMDb API as the data source. [web:114]
- Built with:
- Node.js
node-telegram-bot-apiaxiosdotenv
These steps show how to run the bot locally on your own machine.
- Node.js (v16 or later recommended) installed on your system. [web:37]
- A Telegram account.
If you want to run your own copy of this bot (instead of using @ImdbRatings_bot):
- Open Telegram and start a chat with @BotFather.
- Send
/startif needed. - Send
/newbotand follow the instructions:- Choose a display name.
- Choose a unique username ending with
bot. [web:71]
- BotFather will give you an HTTP API token. Save this; you will use it as
TELEGRAM_BOT_TOKEN.
- Go to https://www.omdbapi.com/apikey.aspx. [web:117]
- Request a free API key and wait for it to be activated.
- You will use this as
OMDB_API_KEY.
-
Clone this repository:
git clone https://github.com/<your-username>/Imdb_bot.git cd Imdb_bot
-
Install dependencies:
npm install Create a .env file in the project root -
Create a .env file in the project root:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here OMDB_API_KEY=your_omdb_api_key_here
The project uses the dotenv package to load these values into process.env. [web:64][web:57]
-
Start the bot:
npm start
If everything is configured correctly, the process will start without errors and keep running.
- Talk to your bot on Telegram:
- Open Telegram.
- Search for your bot’s username (for this repo it is @ImdbRatings_bot).
- Click Start and send a title like:
- Node.js
- Inception
- Interstellar
- Breaking Bad The bot should respond with the IMDb rating and a link.
-
The bot uses long polling to receive new messages from Telegram (via node-telegram-bot-api). [web:108]
-
When a user sends a movie/series name: -The bot calls the OMDb API endpoint https://www.omdbapi.com/ with the title and your API key. [web:114] -OMDb returns information including: -Title -Year -Type (movie/series/episode) -imdbRating -imdbID [web:26]
-
The bot formats this data into a message and sends it back to the user.
The project expects these variables:
-TELEGRAM_BOT_TOKEN– your Telegram bot token from BotFather.
-OMDB_API_KEY – your OMDb API key.
When deploying to platforms like Railway or Render, set these values in the platform’s environment/variables section instead of using a .env file. [web:99][web:101]