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
- tldr; Use gramjs
- Javascript:
telegraf:- Github: Click here 8.9k*
- Docs: Click here
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!- Github: Click here 6.4K*
- Python:
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);Click here [NOT TESTED]
# 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.