The telegram API supports downloading attachments. It would be really great to be able to send a voice message to a telegram bot and have it play on a media_player component. I’m not a Python guy so I’d probably screw it up.
This json is received:
{
'date':1514860312,
'voice':{
'mime_type':'audio/ogg',
'file_size':6663,
'duration':2,
'file_id':'AwADAQADCgADwUlYRoRzTvFKgdjdAg'
},
'from':{
'id':111111,
'language_code':'en-US',
'is_bot':False,
'first_name':'John',
'last_name':'Smith'
},
'message_id':1553,
'chat':{
'type':'private',
'id':1111111,
'first_name':'John',
'last_name':'Smith'
}
}
Then via the getFile API you can get the file path like:
https://api.telegram.org/bot<bot_token>/getFile?file_id=the_file_id
Which returns:
{
"ok":true,
"result":{
"file_id":"AwADAQADCgADwUlYRoRzTvFKgdjdAg",
"file_size":6663,
"file_path":"voice/file_1533"
}
}
Then you can use download the file via:
https://api.telegram.org/file/bot<token>/<file_path>