Auto Approve Telegram Join Requests

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

Introduction

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 approve join requests, you must use a Telegram user account (not a bot token). Here’s what to do:

  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 these credentials to interact with Telegram’s API through MadelineProto:

  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

To approve requests via script, you’ll need the internal Telegram Channel ID.

Option A: Use @userinfobot

  1. Forward a message from your channel to @userinfobot.
  2. The bot will reply with something like 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.

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

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:

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

Automate Script for Auto Approve Telegram Join Requests

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

Final Thoughts

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.

Leave a Reply

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