4

As telegram bots reads groups updates, is there any way to read channel updates also?

mohammad falahat
  • 757
  • 1
  • 4
  • 11

4 Answers4

10

At the moment, Telegram Bots API doesn't allow bots to receive messages in channels, so it is not possible to read them (unless you use a Telegram API one.

Update

Since November update, the api now supports channel post and edition updates.

Ruben Bermudez
  • 2,293
  • 14
  • 22
4

for not your channel: if the channel is public, you can scrape from html code with address : https://t.me/s/ChannelName/messageId if the channel is private, nothing to do

for your channel: you can create a dummy group, then request 'forwardMessage' to forward from channel to dummy group

0

Yes, you only have to add the bot to your channel.

This is a JSON RESPONSE

{"update_id":164442191, "channel_post":{"message_id":1405,"chat":{"id":-1001066700541,"title":"Underworld'S Creatures","username":"IlSottobosco","type":"channel"},"date":1499299471,"reply_to_message":{"message_id":1403,"chat":{"id":-100106670231,"title":"Underworld'S Creatures","username":"IlSottobosco","type":"channel"},"date":1499298047,"text":"Test"}}

Luca
  • 160
  • 3
  • 14
  • Is there a way to get updates from a channel (not mine but where I am a subscriber) for every messages added? There are a lot of commercial bot that works but don't understand how they work – Giuseppe Lodi Rizzini Feb 24 '20 at 11:38
0

Yes. Just like groups and users update, but the difference is, you have to change ["message"]["text"] with ["channel_post"]["text"].

Take a look at this code:

$update = json_decode(file_get_contents("php://input"), TRUE);
$message = $update["message"]["text"]; // this will get users and groups messages.
$channel_post = $update["channel_post"]["text"]; // this will get messages send to the channel that bot is admin.
Own3r
  • 1
  • 1