N
N
neuroepoc2018-03-11 21:47:53
Python
neuroepoc, 2018-03-11 21:47:53

How to upload file to Telegram server in python to get file_id?

You need to send an audio recording in the message that is stored on disk, but to do this, it is required that the file has already been uploaded to the server and there is a file_id of this file. So how do you upload a file to the server?
the api for bots specifies three methods:
Sending by file_id
Sending by URL
and

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.

as I understand it, you need to split the file into parts and send requests with the part number, the part itself and the file_id,
but I didn’t find exactly how (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Rocky, 2018-03-26
@Aspvxrocky

You type in the address bar https://api.telegram.org/bot<ТОКЕН>/getUpdates, send the file you need to the bot, refresh the page and voila, you get the file_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question