Skip to main content

InputMediaDocument

Represents a general file to be sent.

πŸ“ Schema​

FieldTypeDescription
typestringType of the result, must be document
mediastringFile to send. Pass a file_id to send a file that exists on the Bale servers (recommended), pass an HTTP URL for Bale to get a file from the Internet, or pass β€œattach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name
thumbnailInputFile, stringOptional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass β€œattach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
captionstringOptional. Caption of the document to be sent, 0-1024 characters after entities parsing

βš™οΈ Get methods​

getType()​

Retrieves the type of the media, which should always return "document".

$type = $inputMediaDocumentObject->getType();

getMedia()​

Retrieves the media file (either file_id, HTTP URL, or attach reference) to be sent.

$media = $inputMediaDocumentObject->getMedia();

getThumbnail()​

Retrieves the thumbnail of the document file. This will either be a file_id, HTTP URL, or attach reference if uploaded using multipart/form-data.

$thumbnail = $inputMediaDocumentObject->getThumbnail();

getCaption()​

Retrieves the caption of the document to be sent. It returns a string value (0-1024 characters).

$caption = $inputMediaDocumentObject->getCaption();

βž• More​

tip

For further information, refer to the official Bale documentation for more details.