/tg-channel-api

serverless API for public Telegram channel messages

Primary LanguageGo

Telegram Channel API

A JSON API for latest messages of public Telegram channels.

Try it now:

Usage

You can use this Web API to get the latest messages, or any one of recent 20 messages, from any public Telegram channel, anonymously.

The official demo is at t-me.vercel.app.

Request: GET /:channel_username/:message_id?

Parameters of request:

  • channel_username (string) : the substring of the channel link after "t.me", e.g. durov is the channel_username of t.me/durov
  • message_id (integer, within [1, 20] for now, optional) : the ordinal number of the message, e.g. 1 for the latest message, 2 for the second-latest message, etc. Default is 1.

For response format, check https://t-me.vercel.app/durov.

Technical details

It's running on Vercel and uses its Go runtime to serve the API.

To deploy your own instance, simplely fork this repository and connect your copy to Vercel.

TO DO

  • Add support for optional fields
    • photos .tgme_widget_message_photo_wrap
    • sender's name .tgme_widget_message_from_author
    • etc.

Contributing

Contributions are welcome!

Try these ideas:

  • make progress to the to-do list above
  • deploy to a new platform
  • propose/add a new feature
  • find/fix a bug
  • improve the performance