Skip to main content

Installations & preparations

Installing Node.js

To use Opengram, you'll need to install Node.js. Opengram requires Node v16.14.0 or higher.


To check if you already have Node installed on your machine (e.g., if you're using a VPS), run node -v in your terminal. If it outputs v16.14.0 or higher, then you're good to go! Otherwise, continue reading.

On Windows, it's as simple as installing any other program. Download the latest version from the Node.js website, open the downloaded file, and follow the steps from the installer.

On macOS, either:

  • Download the latest version from the Node.js website, open the package installer, and follow the instructions
  • Use a package manager like Homebrew with the command brew install node

On Linux, you can consult this page to determine how you should install Node.

Preparing the essentials

To use Opengram, you'll need to install it via npm (Node's package manager). npm comes with every Node installation, so you don't have to worry about installing that. However, before you install anything, you should set up a new project folder.

Navigate to a suitable place on your machine and create a new folder named telegram-bot (or whatever you want). Next you'll need to open your terminal.

Opening the terminal


If you use Visual Studio Code, you can press Ctrl + ` (backtick) to open its integrated terminal.

Or if you use Webstorm or IntelliJ IDEA you can press ⌥F12 on macOS, or Alt + F12 on Windows and Linux

On Windows, either:

  • Shift + Right-click inside your project directory and choose the "Open command window here" option
  • Press Win + R and run cmd.exe, and then cd into your project directory

On macOS, either:

  • Open Launchpad or Spotlight and search for "Terminal"
  • In your "Applications" folder, under "Utilities", open the Terminal app

On Linux, you can quickly open the terminal with Ctrl + Alt + T.

With the terminal open, run the node -v command to make sure you've successfully installed Node.js. If it outputs v16.9.0 or higher, great!

Initiating a project folder

npm init

This is the next command you'll be running. This command creates a package.json file for you, which will keep track of the dependencies your project uses, as well as other info.

This command will ask you a sequence of questions–you should fill them out as you see fit. If you're not sure of something or want to skip it as a whole, leave it blank and press enter.

npm init -y

Once you're done with that, you're ready to install Opengram!

Installing Opengram

Now that you've installed Node.js and know how to open your console and run commands, you can finally install Opengram! Run the following command in your terminal:

npm i opengram

And that's it! With all the necessities installed, you're almost ready to start coding your bot.

Installing a linter

While you are coding, it's possible to run into numerous syntax errors or code in an inconsistent style. You should install a linter to ease these troubles. While code editors generally can point out syntax errors, linters coerce your code into a specific style as defined by the configuration. While this is not required, it is advised.