Can the Telegram bot API play sound from an online audio streaming URL?

4.7k views Asked by At

Telegram BOT API has functions to send audio files and documents ,But can it play from an online sound streaming URL?

4

There are 4 answers

0
MarcoBuster On

No, you can't with Telegram Bot APIs. You must download the file and upload it on Telegram servers.

2
Matteo Enna On

Yes. I use:

define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
$sendto =API_URL."sendmessage?chat_id=".$chatID."&text=".urlencode($url_track);
file_get_contents($sendto);

For example in row 74 in https://github.com/Ellusu/Jamendo_SearchBot/blob/master/index.php

0
Vahid Msm On

It will just show preview of link and if it's an audio, an audio bar will be shown. so the answer is yes, but it will not start automatically and user should download and play it.

0
fuggi On

The userbot VoiceChatStreamer claims to allow exactly that.