Skip to content

sahilrajput03/telegram-bot-requests

Repository files navigation

README

Visit: Guide on .env encryption (#sops)

Quick Links:

  • Styled text with message entities: Click here
  • Can i get token for my own telegram account as well so i can send messages via telegram api call? ChatGPT

Bot Libraries:

  • Javascript:
    • telegraf:
    • gramjs - (NodeJS/Browser MTProto API Telegram client library)
      • Github: Click here 1.6k*
      • A Telegram client written in JavaScript for Node.js and browsers, with its core being based on Telethon.
  • Python:
    • Python: telethon: Pure Python 3 MTProto API Telegram client library, for bots too!

Setup webhook for your bot

Source: ChatGPT

NOTE: Using telgramf in general way deletes your webhook url, please check file learn-telegraf.js for more info.

  • ❤️ You can create webhook via - https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://yourdomain.com/webhook
    • ✅ Now, you can handle the post requests to handle incoming messages to the bot.
  • ❤️ You can delete the webhook via - https://api.telegram.org/bot<YOUR_BOT_TOKEN>/deleteWebhook

✅Example with webhook url:

export const telegramWebhookController = (req, res) => {
  console.log("Received message:", req.body);
  // Output:
  // {
  //   update_id: 308413898,
  //   message: {
  //     message_id: 14295,
  //     from: {
  //       id: 711263195, // * `userChatId`
  //       is_bot: false,
  //       first_name: 'Sahil',
  //       last_name: 'Rajput',
  //       username: 'SahilRajput03', // * `username`
  //       language_code: 'en'
  //     },
  //     chat: {
  //       id: 711263195,
  //       first_name: 'Sahil',
  //       last_name: 'Rajput',
  //       username: 'SahilRajput03',
  //       type: 'private'
  //     },
  //     date: 1758737582,
  //     text: '❤️❤️❤️😍😍🙂🙂' // * `message`
  //   }
  // }
  return void res.sendStatus(200);
};

app.post("/api/v1/telegram/webhook", telegramWebhookController);

Telegram Calling Bot

️1. Official Telegram audio/video call api docs: AWESOME:DOCS

Click here [NOT TESTED]

2. ❤️ Telegram radio experiment Using lemonjamsbot (My Latest Experiment)

Click here, lemonjamsbot

3. Using magnaluna and php-libtgvoip

# Installation
sudo apt-get install libopus-dev libssl-dev build-essential php7.4-dev php7.4
git clone https://github.com/copernicamarketingsoftware/PHP-CPP && cd PHP-CPP && make -j$(nproc) && sudo make install && cd ..
git clone --recursive https://github.com/danog/php-libtgvoip && cd php-libtgvoip && make && sudo make install

# Installs the XML extension for PHP 7.4.
sudo apt-get install php7.4-xml
# Installs the Multibyte String (mbstring) extension for PHP 7.4.
sudo apt-get install php7.4-mbstring

# Download magnaluna script
wget https://github.com/danog/magnaluna/raw/master/magna.php

 # Run magnaluna script
php magna.php
# FYI: When asked for number use 918360****** and use automated process to login instead of using the user api and api_tokens.

Thanks.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published