Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Auto Approve Telegram Join Requests with ease using a powerful PHP user bot. If you’re managing a private Telegram channel, you’ve likely experienced the growing challenge of handling join requests manually. As your community expands, manually approving each request becomes tedious, slows down growth, and eats into your valuable time—time that could be spent engaging with your audience or creating content.
Fortunately, there’s a smarter and more efficient way to handle this. By automating the approval process, you can streamline your channel management and ensure new members are approved instantly without delays.
In this step-by-step guide, you’ll learn how to set up a Telegram user bot using PHP and the reliable MadelineProto library to automatically approve all pending join requests—helping your channel grow without the manual burden.
Let’s get started! 🚀
To approve join requests, you must use a Telegram user account (not a bot token). Here’s what to do:
This user will later act as the approver bot for incoming join requests.
You need these credentials to interact with Telegram’s API through MadelineProto:
JoinApproverBot
joinbot
Save both—you’ll use them when initializing the bot.
To approve requests via script, you’ll need the internal Telegram Channel ID.
Option A: Use @userinfobot
@userinfobot
.Channel ID: -100xxxxxxxxxx
.Option B: Get It via MadelineProto (optional)
You can also use a simple script later in this guide to extract the channel ID from your user bot session.
Now we’ll create a user bot that auto-approves all pending join requests using MadelineProto. Before doing this, we need to install the package first.
composer require danog/madelineproto
Create userbot.php and paste the following:
<?php
require 'vendor/autoload.php';
use danog\MadelineProto\API;
use danog\MadelineProto\Settings;
use danog\MadelineProto\Settings\AppInfo;
// Telegram credentials
$api_id = XXXXXXXX; // replace this with your app id
$api_hash = 'XXXXXXXXXXXXXXXXXXXXXXXX'; // replace this with your app hash
// Session path
$sessionPath = __DIR__ . '/userbot.session';
// Settings
$settings = (new Settings)
->setAppInfo(new AppInfo([
'api_id' => $api_id,
'api_hash' => $api_hash,
]));
$MadelineProto = new API($sessionPath, $settings);
$MadelineProto->start();
try {
$channelId = -XXXXXXXXXXX; // replace this with the channel or group you want to approve the pending requests
// âś… List pending join requests
$requests = $MadelineProto->messages->getChatInviteImporters([
'peer' => $channelId,
'requested' => true,
'limit' => 100
]);
if (empty($requests['importers'])) {
echo "No pending join requests.\n";
exit;
}
foreach ($requests['importers'] as $importer) {
$userId = $importer['user_id'];
echo "Approving user: {$userId}\n";
$MadelineProto->channels->inviteToChannel([
'channel' => $channelId,
'users' => [$userId],
]);
}
echo "Done approving all requests!\n";
} catch (\Throwable $e) {
echo "Error: {$e->getMessage()}\n";
}
Run it in your terminal:
php auto_approver.php
When run the first time, you’ll need to enter:
To keep this running, you can:
By following these 4 steps, you can Auto Approve Telegram Join Requests with ease, saving hours of manual work. This is especially useful for:
With a simple PHP script and the MadelineProto library, you’ve now got a powerful tool to automate channel management!
Now that you’ve learned how to create a user bot, if you’re interested in building a standard Telegram bot using PHP, be sure to check out Create a Telegram Bot with PHP in 3 Simple Steps – Beginner’s Guide.