Telegram Send Photo to Channel (using python-telegram-bot)

Install python-telegram-bot

pip install python-telegram-bot --upgrade
import telegramTELEGRAM_BOT_TOKEN = '880123456:AAGe...'TELEGRAM_CHAT_ID = '-1001306...'PHOTO_PATH = 'img/sample.png'bot = telegram.Bot(token=TELEGRAM_BOT_TOKEN)bot.send_message(chat_id=TELEGRAM_CHAT_ID, text="From Telegram Bot")bot.send_photo(chat_id=TELEGRAM_CHAT_ID, photo=open(PHOTO_PATH, 'rb'))

NOTE: Refer Create Telegram Bot to get TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.