Skip to main content

Simple Telegram helper

Project description

EzTelegramAPI

Python versions

The simplest way to send Telegram messages from Python.
Two functions. Zero boilerplate. Just send.


🔗 GitHub: https://github.com/EmptyOverlord/EzTelegramAPI
📦 PyPI: https://pypi.org/project/eztelegramapi/

Installation

pip install EzTelegramAPI

Quickstart

from eztelegramapi import send_message, edit_message

TOKEN   = "123456789:AABBCCDDEEFFaabbccddeeff-1234567890"  # from @BotFather
CHAT_ID = 987654321                                         # your chat ID

msg_id = send_message(TOKEN, CHAT_ID, "Hello from EzTelegramAPI! 🚀")
edit_message(TOKEN, CHAT_ID, msg_id, "Updated message ✏️")

That's it. Seriously.

Why EzTelegramAPI?

EzTelegramAPI Other libraries
Setup None Config, classes, handlers...
Lines to send a message 1 5–20+
Dependencies requests Multiple
Learning curve Zero Non-zero

API Reference

send_message(token, chat_id, text, *, return_message_id=True)

Parameter Type Description
token str Your bot token from @BotFather
chat_id int Target chat or user ID
text str Message text (supports emoji ✅)
return_message_id bool If True (default) returns message_id, else raw Response

Returns: int (message_id) or requests.Response


edit_message(token, chat_id, message_id, text)

Parameter Type Description
token str Your bot token from @BotFather
chat_id int Target chat or user ID
message_id int ID of the message to edit
text str New message text

Returns: requests.Response


Examples

Live progress update:

import time

msg_id = send_message(TOKEN, CHAT_ID, "⏳ Job started...")
time.sleep(5)
edit_message(TOKEN, CHAT_ID, msg_id, "✅ Job finished!")

Alert on error:

try:
    risky_operation()
except Exception as e:
    send_message(TOKEN, CHAT_ID, f"🔴 Error: {e}")

Cron job notification:

from datetime import datetime
now = datetime.now().strftime("%Y-%m-%d %H:%M")
send_message(TOKEN, CHAT_ID, f"✅ Backup finished at {now}")

How to get your Chat ID

  1. Start a chat with @userinfobot
  2. Send /start
  3. It replies with your numeric ID — use that as chat_id

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eztelegramapi-0.2.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eztelegramapi-0.2.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file eztelegramapi-0.2.1.tar.gz.

File metadata

  • Download URL: eztelegramapi-0.2.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for eztelegramapi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9ee15a2eab12f1428bf7ab85b549b5e314de2664b4a90fd4057d67d33da9990f
MD5 581eced61fc2eb4c1a364fb29bea5a55
BLAKE2b-256 6babae3396af4ccf2b5f36b40b3eec281d10880379f5fff97f95bb89c506aa26

See more details on using hashes here.

File details

Details for the file eztelegramapi-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: eztelegramapi-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for eztelegramapi-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bbfef02bd3fa7656dc78c700d1d7ef9eea70145aca591e73c25cee7b3dfbdaf
MD5 240d5ef2cde835c562118494d21c39d2
BLAKE2b-256 a84d52cb347f576c4937b6f172eb7879680af0929cfe09fd122cdd71cfbc58c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page