Automate posting messages to a Telegram channel via API

You can use bots to send message to channels. But there is some limitation, like size of files.

  1. create your bot, by sending message to @botfather
  2. add the bot to your channel. stackoverflow
  3. write a code to send message to your channel. bot api

After 1 year of working with telegram API, I wanted to update this answer for best possible ways to interact with telegram API.

For posting to channels, both telegram API and telegram bot API can post to channels.

I worked directly with both the APIs, but I found the following clients for telegram API and bot API to be faster and easier to interact with telegram.

Telegram API client:

https://github.com/LonamiWebs/Telethon

Telegram bot API:

https://github.com/python-telegram-bot/python-telegram-bot