You can send files without file_id
:
There are three ways to send files (photos, stickers, audio, media,
etc.):
- If the file is already stored somewhere on the Telegram servers, you don't need to reupload it: each file object has a file_id field,
simply pass this file_id as a parameter instead of uploading. There
are no limits for files sent this way.
- Provide Telegram with an HTTP URL for the file to be sent. Telegram will download and send the file. 5 MB max size for photos and 20 MB
max for other types of content.
- Post the file using multipart/form-data in the usual way that files are uploaded via the browser. 10 MB max size for photos, 50 MB for
other files
You can use file_id
only if you have already sent it to someone before (using URL or multipart/form-data).
So if a list of files you want to send is predefined, "static", you can upload all of them once, get their file_id
's (using getUpdates
method for example), store associations between files and their respective file_id
's and finally your bot can use only file_id
to communicate with users.
On the other hand, if a list of possible files varies, you can send files only via URL or multipart/form-data.