TGViewer
PWRTelegram API channel PWRTelegram API channel @pwrtelegram · 725 subscribers
Post #499 928

Forwarded from MadelineProto | Official Channel (Daniil Gentili 🇺🇦)

MadelineProto now offers a simple broadcast API, that can be used to asynchronously broadcast messages to all users of a bot or userbot in the background, without incurring in timeouts or other issues.

Note that unlike the bot API, MadelineProto can be used to fetch the full list of users, chats and channels of a normal bot, simply using its bot token.

Here's a simple example, explaining how to broadcast a message and a photo to every user of a bot:
<?php
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('bot.madeline');

// Works OK with both bots and userbots
$MadelineProto->start();

$id = $MadelineProto->broadcastMessages([
['message' => 'This broadcast is powered by @MadelineProto!'],
['message' => 'This media broadcast is powered by @MadelineProto!', 'media' => [
'_' => 'inputMediaUploadedPhoto',
'file' => 'https://docs.madelineproto.xyz/logo-hover.png'
]],
]);



You can also forward messages:

// Send messages, showing the "Forwarded from" header
$id = $MadelineProto->broadcastForwardMessages(
from_peer: 101374607,
ids: [1, 2, 3, 4],
drop_author: false,
);

// Send messages WITHOUT showing the "Forwarded from" header
$id = $MadelineProto->broadcastForwardMessages(
from_peer: 101374607,
ids: [1, 2, 3, 4],
drop_author: true,
);


The methods return an integer ID that can be used to:

- Get the current broadcast progress with getBroadcastProgress
- Cancel the broadcast using cancelBroadcast

Note that to avoid manually polling the progress, MadelineProto will also periodically emit updateBroadcastProgress updates to the event handler, containing a Progress object for all broadcasts currently in-progress.

Filtering is also available, as well as support for custom broadcast actions.

See here » for a full example of the broadcast API, and here » for the full documentation.
docs.madelineproto.xyz Broadcasting messages to all users MadelineProto can be used to broadcast messages to all users, chats and channels of a bot or userbot.
More from @pwrtelegram
  1. Oct 17, 2026Introducing MadelineProto 8.8.8, with video calls, group calls, livestreams and end-to-end…
  2. May 11, 2025And then, a long overdue post about my Autonomous System (AS198747), and an over more over…
  3. May 11, 2025The first series of posts I'll be adding here will be some technical deep dives into the p…
  4. May 11, 2025Happy to announce I've launched a blog, where I'll be posting news about all my different…
  5. Aug 25, 2024#FreeDurov.
  6. May 30, 2024MadelineProto was updated! MadelineProto 8.1.0 introduces an official Grafana dashboard fo…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →