Use this method to send photos.

Use this method to send photos. On success, the sent Message is returned.

See sendPhoto official docs for a list of supported parameters and other info.

Sending Photo Using Image URL

The ability to send an image directly from a URL is also supported in the library. Instead of supplying a local path and filename, you may just pass the image URL and it'll take care of downloading and sending it to the Telegram directly.

Example

use Telegram\Bot\Api;

$telegram = new Api('BOT TOKEN');

$response = $telegram->sendPhoto([
	'chat_id' => 'CHAT_ID', 
	'photo' => 'http://example.com/photos/image.jpg',
	'caption' => 'Some caption'
]);

$messageId = $response->getMessageId();
$response = Telegram::sendPhoto([
	'chat_id' => 'CHAT_ID', 
	'photo' => 'http://example.com/photos/image.jpg',
	'caption' => 'Some caption'
]);

$messageId = $response->getMessageId();

🚧

Sending Photo using a File or URL!

The API Explorer below doesn't support file upload or URL based photo sending. You can only use it to test using an existing file_id, if you have one.

This is a limitation of this API Explorer, Not the SDK.

Language
Click Try It! to start a request and see the response here!