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.0.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.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eztelegramapi-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 2e46404fa6156cedeacb5d7295e2b9c968131e7302216cb88810bf434ffd7d6b
MD5 382b8d47ff599f3a23cf56ce269c8729
BLAKE2b-256 5051c3f75b00fa2867b7a0d66ed0591b8d261528ebd89a4cc776af72a07a14d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eztelegramapi-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75df103444bb90942c3a65be0f531aec9a1ec9dc8cc3d00e27dbdc8a6ab220ea
MD5 3b362e6a0487eab0eb842db674f1559f
BLAKE2b-256 fe733ec5e71ed24358268f2758bebf64c61c64a8e0f5e73ecc0693dbdec9ccb1

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