Skip to main content

A Django app that integrates with Telegram to create bots.

Project description

django-telegram-app

A Django app to integrate Telegram bots into your project.

Detailed documentation is in the docs/ directory.


Code style: Ruff Typing: Pyright Linting: Pylint Framework: Django License CI Validation


Features

  • ✅ Command-based bot architecture with step-based flow
  • ✅ Swappable TelegramSettings model
  • ✅ Inline admin integration for linking Telegram settings to users
  • ✅ Extensible: add commands per app via auto-discovery
  • ✅ Built-in system checks for misconfiguration
  • ✅ Django ORM integration (no direct API handling required)
  • ✅ Easy to test (includes custom TelegramTestCase)

Requirements (officially supported)

  • Python 3.10+
  • Django 5.2+

Quick start

  1. Install the package

    pip install django-telegram-app
    
  2. Add "django_telegram_app" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...,
        "django_telegram_app",
    ]
    
  3. Include the telegram URLconf in your project urls.py like this:

    ...
    from django_telegram_app.conf import settings as telegram_app_settings
    ...
    path(telegram_app_settings.ROOT_URL, include("django_telegram_app.urls")),
    
  4. Create your own commands in each app under {appname}/telegrambot/commands/. Refer to the documentation for more details on how to write custom commands.

  5. Add the provided telegramsettings inline to your user-model like this:

    # user/admin.py
    from django_telegram_app.admin import TelegramSettingInline
    ...
    class CustomUserAdmin(UserAdmin):
        ...
        inlines = [TelegramSettingInline]
        # or add it to an existing entry
    
  6. Configure the telegram settings. Refer to the documentation for all possible settings. Minimal configuration is like this:

    # project/settings.py
    ...
    TELEGRAM = {
        "BOT_URL": "https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/"
    }
    ...
    
  7. Run python manage.py migrate to create the models.

  8. Run python manage.py setwebhook to set the url on which you would like to receive telegram updates.

  9. Start the development server and visit the admin to edit users and add/complete TelegramSettings there.

License

This project is licensed under the MIT License — see the LICENSE file for details.

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

django_telegram_app-0.1.3.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

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

django_telegram_app-0.1.3-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file django_telegram_app-0.1.3.tar.gz.

File metadata

  • Download URL: django_telegram_app-0.1.3.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_telegram_app-0.1.3.tar.gz
Algorithm Hash digest
SHA256 463bc3d9c8e51be400c9588bfaa7cc8741804853296b072a5ca238f6c692f355
MD5 761ead9197bb5b8c0733e76d04b3984b
BLAKE2b-256 4330cb12eabd8a0c992c87bbe6c7ca82db0ac60c7cda90b708c43c579afcc1e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_telegram_app-0.1.3.tar.gz:

Publisher: release.yml on shifqu/django-telegram-app

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_telegram_app-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_telegram_app-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 84f4d63fbd941afbb7313091e81fa6243db0f392a5685d146b8fc0fbdd0f95b0
MD5 48202680fa95ddcb7472d27390f4bb92
BLAKE2b-256 0878d07dd4fe2d19c66f7fc308f24394e8bc1634012106abc4cd910d6656e59c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_telegram_app-0.1.3-py3-none-any.whl:

Publisher: release.yml on shifqu/django-telegram-app

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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