DEV Community

loading...
Cover image for Build your first telegram Bot with Nodejs

Build your first telegram Bot with Nodejs

iamnotstatic profile image Abdulfatai Suleiman ・2 min read

What is telegram?

Telegram is one of top social media apps/platforms that offers security with encryption and on a completely free, fast, and distributed system.

What is a chatbot?

A bot is a software program that operates on the Internet and performs repetitive tasks.

What is a Telegram Bot?

Telegram Bots are accounts operated by software – not people – and they'll often have AI features. ... They can do anything – teach, play, search, broadcast, remind, connect, integrate with other services, or even pass commands to the Internet of Things.

Getting started

Step 1: Getting Permission From BotFather

Sign In to your telegram account and search for BotFather himself and start a conversation with him.

Screenshot_20201127-223612.png

Screenshot_20201127-223700.png

We’ll now invoke the process of creating a new bot with:

/newbot

Screenshot_20201127-223908.png

Give it a name and a username:

Once that process is complete, you’ll get an API Token to use, copy it somewhere, we’ll be using it soon in our application.

Screenshot_20201127-230658.png

Step 2: Set up your project directory

Now that we have Node.js and npm installed and our Telegram account is ready, we can start with the project. Open up your preferred terminal and run these commands:

Create a directory

mkdir movie-finder-telegram-bot

Move into the directory

cd movie-finder-telegram-bot

Now we have a directory for our Telegram bot, but we need a package.json, this tells npm information about our project. To do this, (in the same terminal window) we need to run this:

Continue Reading at https://iamnotstatic.hashnode.dev/build-your-first-telegram-bot-with-nodejs

Hopefully, this article can be useful for readers. If given the opportunity, I will explain about Node.js again or anyone has a request?
Please criticize and advise, do not forget to leave a comment and give Clap 👏👏

Discussion (3)

pic
Editor guide
Collapse
henryong92 profile image
henry_ong_92

Where can the JavaScript code be hosted for it to be accessed anywhere?

Collapse
iamnotstatic profile image
Abdulfatai Suleiman Author • Edited

You can host it on Heroku or AWS, any hosting provider that supports nodejs

I will probably make an article on how to host your nodejs telegram bot on Heroku

Collapse
henryong92 profile image