How to Auto Approve Telegram Join Requests in 4 Simple Steps (PHP + MadelineProto)

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! 🚀

Step 1: Add a Telegram User to the Channel and Grant Permission

To Auto Approve Telegram Join Requests, add your Telegram user account to the channel as an admin and enable the “Approve new members” permission. MadelineProto works with user accounts, not bots, so these permissions are required for automatic approvals.

  1. Log in with your secondary or dedicated Telegram user account.
  2. Open your private Telegram channel.
  3. Go to Channel Settings > Administrators.
  4. Add the user account and grant at least:
    • Add Subscribers permission

This user will later act as the approver bot for incoming join requests.

Step 2: Get Telegram API ID and API Hash

You need a Telegram API ID and API Hash to authenticate your account in the auto-approval script. Create them from the Telegram Developer portal. These credentials let your script connect safely and Auto Approve Telegram Join Requests.

  1. Visit: https://my.telegram.org
  2. Log in with your Telegram user account.
  3. Click API Development Tools.
  4. Fill in the form:
    • App title: JoinApproverBot
    • Short name: joinbot
  5. You’ll now get your:
    • API ID
    • API Hash

Save both—you’ll use them when initializing the bot.

Step 3: Get Your Channel ID and Invite Link

Your script needs both the Channel ID and the Invite Link to Auto Approve Telegram Join Requests.

  • To get the invite link, open your Telegram channel → InfoInvite Links → copy the link you want the script to monitor.
  • To get the Channel ID, forward a message from your channel to @userinfobot, which will return an ID starting with -100.

How to Get Your Channel ID

  1. Open your Telegram channel.
  2. Forward any message from the channel to @userinfobot.
  3. The bot will reply with details, including:
Channel ID: -100xxxxxxxxxx

Copy this -100… number — you will use it in the script.

  1. Go to your channel → tap the channel nameEdit (top right).
  2. Open Invite Links.
  3. Create a new link or use an existing one.
  4. Copy the full invite link (e.g. https://t.me/+abcdEFGhijk).

This invite link is used by the script to fetch and approve pending join requests.

Step 4: Build the PHP Script to Auto Approve Telegram Join Requests

With API credentials, admin permission, and Channel ID ready, you can create a PHP script that uses MadelineProto to Auto Approve Telegram Join Requests. The script connects to your account, checks pending requests from your invite link, and approves users automatically.

Create a file userbot.php and paste the following:

<?php

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}

require_once 'madeline.php';

use danog\MadelineProto\API;
use danog\MadelineProto\RPCErrorException;

// ACTION REQUIRED: REPLACE THIS LINE WITH YOUR CHANNEL'S FULL INVITE LINK
// Example: https://t.me/+AbCdEfGhIjK_lMnOpQ
$channelIdentifier = 'https://t.me/+XXXXXXXXXXXXXX';
// --- END CONFIGURATION ---

// Initialize and Start MadelineProto
$MadelineProto = new API('session.madeline');
$MadelineProto->start();

echo "MadelineProto started. Attempting to approve requests using invite link.\n";

try {
    echo "Forcing peer resolution via getPwrChat with invite link...\n";

    // getPwrChat can resolve the invite link and store the numerical ID in the database.
    $channelPeer = $MadelineProto->getPwrChat($channelIdentifier);

    // Now that the Peer is resolved, we extract its final numerical ID for subsequent calls
    // The Peer object returned by getPwrChat has a consistent 'id' field.
    $channelId = $channelPeer['id'];

    // FETCH PENDING JOIN REQUESTS
    echo "Fetching pending requests for ID: {$channelId}...\n";
    $requests = $MadelineProto->messages->getChatInviteImporters([
        'peer'      => $channelId, // Now use the resolved numerical ID
        'requested' => true,
        'limit'     => 100
    ]);

    if (empty($requests['importers'])) {
        echo "No pending join requests found. Exiting.\n";
        exit;
    }

    $approvedCount = 0;

    // APPROVE REQUESTS
    foreach ($requests['importers'] as $importer) {
        $userId = $importer['user_id'];

        echo "Approving user ID: {$userId}...\n";

        $MadelineProto->channels->inviteToChannel([
            'channel' => $channelId, // Use the resolved numerical ID
            'users'   => [$userId],
        ]);

        $approvedCount++;
        usleep(50000);
    }

    echo "\n✅ Successfully approved **{$approvedCount}** pending requests!\n";
} catch (RPCErrorException $e) {
    echo "Error: Telegram API (RPC) Error occurred: {$e->getMessage()}\n";
} catch (\Throwable $e) {
    echo "Error: A general exception occurred: {$e->getMessage()}\n";
    echo "Final troubleshooting step required: Delete the session and retry with the invite link.\n";
}

Run it in your terminal:

php auto_approver.php

When run the first time, you’ll need to enter:

  • API ID and API hash
  • Phone number
  • Login code (from Telegram)
  • 2FA password (if set)

⚠️ Important Note
For the best results, run your MadelineProto script on Linux or macOS.
Running it on Windows (including XAMPP, Laragon, or Windows CMD/Powershell) is not recommended, because several MadelineProto functions — including peer handling, event loops, and async operations — may fail or behave inconsistently.

If you’re on Windows, use WSL (Windows Subsystem for Linux) to run the script.

To keep this running, you can:

  • Schedule it with a cron job
  • Run it on a server using Supervisor
  • Convert it into a daemon that checks every few minutes

Conclusion

By following these 4 steps, you can Auto Approve Telegram Join Requests with ease, saving hours of manual work. This is especially useful for:

  • Private communities
  • Paid membership channels
  • Training or subscription-based content groups

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.

Senghok
Senghok

Senghok is a web developer who enjoys working with Laravel and Vue.js. He creates easy-to-follow tutorials and guides to help beginners learn step by step. His goal is to make learning web development simple and fun for everyone.

Articles: 44

Newsletter Updates

Enter your email address below and subscribe to our newsletter

3 Comments

  1. I can’t approve more than like 9 before hitting the flood wait limit. Then that increases to hours when I attempt to approve 5 more after waiting with this method. You don’t run into that issue?

Leave a Reply

Your email address will not be published. Required fields are marked *