Before you start coding, you need to set up your bot properly on Telegram. First, it’s necessary to have a Telegram account. If you don’t have one yet, you can create one by visiting the official Telegram website.

Remember to keep your bot’s token secret as it can be used to control your bot.

Using wrappers for bot creation

  1. Ensure you have Node.js installed on your system. If not, you can download it from the official Node.js website.
  2. Initialize a new Node.js project using npm init. This will create a new package.json file for your project:
npm init -y
  1. Install the node-telegram-bot-api library using npm:
npm install node-telegram-bot-api
  1. Create a new JavaScript file (e.g., index.js) and add the following code to create a basic Discord bot:
// Importing the node-telegram-bot-api library
const TelegramBot = require("node-telegram-bot-api");

// Configuring the API key
const token = "your token here";

// Initializing the bot
const bot = new TelegramBot(token, { polling: true });

// Getting bot information
bot.getMe().then((botInfo) => {
  // Getting the bot's name
  const botName = botInfo.username;

  // Defining a route for messages that are not commands
  bot.on("message", (msg) => {
    // Getting the chat ID
    const chatId =;
    // Getting the user's message
    const userMsg = msg.text;
    // Formatting the message to be sent
    const responseMsg = `${botName} Says: ${userMsg}`;
    // Sending the message
    bot.sendMessage(chatId, responseMsg);

  // Printing the bot's name

Creating the squarecloud config file

Learn about: how to make the configuration file for Square Cloud.

The file is a configuration file that will be used to configure your application; it will be used to define the name, description, version, main file, among other things.

Configuring the START Field

Only use this field if you are really sure about what you are doing.

In the Square Cloud configuration file, the START field is optional and only needed if you are using a custom script to start the bot. In the provided example, the START field is not necessary.

Uploading your project to Square Cloud

After following all the steps, package your application files into a zip file where the configuration file is and upload the bot at Upload. Remember to include the requirements.txt file, but do not include files like __pycache__. You can get more information about unnecessary files when hosting at automatic-file-deletion-when-deploying-an-application-on-squarecloud.

Testing the Bot

If you have done everything correctly, simply search for your bot on Telegram and send a message; it will echo it back to you.

Additional Resources

For more information on creating bots with telebot, visit the official telebot documentation. There, you’ll find detailed guides, tutorials, and API documentation to help you make the most of these libraries.

If you continue to experience any issues, please don’t hesitate to contact our support team.