

How this works is: When a user sends a word to the bot, the word is retrieved and sent through the Oxford Dictionary API which gets the various definitions of the word returned in a JSON format. Setting up the Oxford Dictionary APIĪs stated earlier, we’ll be creating a bot that responds with the meaning/definitions of the word a user sends to it.

Next, let’s sign up for the Oxford Dictionary API.

#Telegram rss bot install
Npm install axios node- telegram- bot- api dotenv body- parser express
#Telegram rss bot code
Scaffolding the Applicationįirstly let’s go ahead and create a directory for the application, head over to a convenient directory on your system and run the following code in your shell/terminal:

Now that we have a basic understanding of what a Telegram bot is and how it works, let’s go ahead and start building one to give us a more practical understanding. Essentially the way we would interact with a Telegram bot is to send it messages or commands through the Telegram chat UI, the bot receives such message or command and interacts with it in a certain way based on how it has been programmed to. Telegram has an existing bot API that allows us to connect bots to their system and also provides ways for us to use this API to control these bots. Users can interact with bots by sending them messages, commands and inline requests. Telegram gives a short and concise explanation:īots are third-party applications that run inside Telegram. You can get the final code of the application here. If you currently have a lower version you can use nvm to install that version(11.6) alongside your current Node version. It is also important to note that the code in this article uses certain features of ES2019 which requires Node version 11.6 or higher so you may encounter errors if you are using a lower Node version.
#Telegram rss bot how to
You’ll also need to have Node and NPM installed, If you don’t have the Node package installed you can get it from the official Node.js website, adequate instructions are provided there on how to get it setup. To follow along with this article, it is expected that you have a basic understanding of Node.js and Javascript. You’ll also gain a very practical understanding by developing a bot that retrieves an English word from a user and then returns the various dictionary definitions of that word using the Oxford Dictionary API. TL DR In this article you’ll learn how to build a Telegram bot using Node.js.
