Receive and save files sent to a Telegram-Bot

It would be awesome to be able to save files and/or voice messages sent to a telegram-bot. Currently i can see the information about the received files in the log, but cannot save the attachments.

for JPEG-Attachment:

WARNING (MainThread) [homeassistant.components.telegram_bot] Message without text data received: {‘message_id’: 1962, ‘chat’: {‘first_name’: ‘FName’, ‘type’: ‘private’, ‘last_name’: ‘LName’, ‘id’: 123456}, ‘date’: 1502115079, ‘document’: {‘mime_type’: ‘image/jpeg’, ‘thumb’: {‘file_size’: 3606, ‘file_id’: ‘AABBCCDDff-MABcDEeFfFm7jcENRAAIC’, ‘width’: 90, ‘height’: 50}, ‘file_size’: 860269, ‘file_name’: ‘A_picture_in_JPEG_format.jpg’, ‘file_id’: ‘BQMABcDEeFfFm7jcENRAAICaAg’}, ‘from’: {‘first_name’: ‘FName’, ‘language_code’: ‘en-EN’, ‘last_name’: ‘LName’, ‘id’: 123456}}

or for Voice-Message:

WARNING (MainThread) [homeassistant.components.telegram_bot] Message without text data received: {‘message_id’: 1964, ‘chat’: {‘first_name’: ‘FName’, ‘type’: ‘private’, ‘last_name’: ‘LName’, ‘id’: 123456}, ‘date’: 1502115975, ‘voice’: {‘mime_type’: ‘audio/ogg’, ‘file_id’: ‘AwAwAwAwZwAwTw9wSBdDvtr9J1aNAg’, ‘file_size’: 7222, ‘duration’: 1}, ‘from’: {‘first_name’: ‘FName’, ‘language_code’: ‘eN-EN’, ‘last_name’: ‘LName’, ‘id’: 123456}}

It would be awesome if those attachments could be saved locally, to use them in Automations i.e. to play the voice message over the media_device.

Have someone tryed to get such a construction to work?

Thank you for reading this :slight_smile:

2 Likes

+1 for that.
I think this topic needs to be in ‘Feature Requests’

I’ve put a feature request in: