apadana
apadana

Reputation: 14640

Telegram api send an already uploaded photo

Telegram bot api supports sending an already uploaded photo. Does telegram api also support sending an already uploaded photo?

I looked at the api documentation but couldn't find any relevant method.

Upvotes: 1

Views: 1211

Answers (2)

Alexey Shablowski
Alexey Shablowski

Reputation: 71

if you use this lib https://github.com/TelegramBot/Api, it's working code:

$chat_id = <chat_id>;
$token = <token>;
$bot = new \TelegramBot\Api\BotApi($token);

try {

    $bot->sendPhoto($chat_id, <file_id>, 'caption');

} catch (\TelegramBot\Api\Exception $e) {

    $e->getMessage();

}

if not, this is simple GET method:

https://api.telegram.org/bot<token>/sendPhoto?chat_id=<chat_id>&photo=<file_id>

more info Telegram Bot API

Upvotes: 1

Sean Wei
Sean Wei

Reputation: 7985

You can obtain file_id in response of sendPhoto, just use it as photo field like chat_id.

For instance:

callAPI("sendPhoto", [
    "chat_id": 109780439,
    "file_id": "AAAAAAXXX"
]

Upvotes: 1

Related Questions