Can telegram bot also send files?

More
2 years 2 months ago #23668 by prashant
Hellos,
Playing with telegram connection & package. I am able to send messages to a user, Can I also send files?

 

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #23671 by admin
Support for telegram was introduced a while ago and not a lot of customers are using it.

It is not possible to send files at the moment. However telegram API has this feature so it should be possible to add this functionality.

Having said that, it will take a while due to the amount of testing required 

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #23673 by prashant
Hellos,
Thanks for the reply. 

No testing needed for me. I would rather spend some time on WhatsApp integration. In India , WhatsApp is massive with its adoption in almost 25%+ of general public & it's the golden standard here. 

We currently use messgebird as the service provider. I will be linking URL Logger to it soon and get few items moving.

For the telegram user , Telegram API does support file sending , this is the script which chatGPT cooked up , we can replace file_path with a variable from ETL and the file you want will sent to user
Code:
import asyncio from telegram import Bot # Your bot's token TOKEN = '7040235760:' # Your Telegram user ID USER_ID = 68xxxxxxx bot = Bot(TOKEN) async def send_file():     # Path to the file you want to send     file_path = '/Users/prashant/Downloads/poheader.csv'     with open(file_path, 'rb') as file:         await bot.send_document(chat_id=USER_ID, document=file)     print("File sent!") # Running the async function using asyncio if __name__ == "__main__":     asyncio.run(send_file())
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save