Skip to main content

Reusable Django support/contact form that sends messages to Telegram.

Project description

Django Telegram Support

A reusable Django app that provides a simple support/contact form and delivers messages directly to Telegram.
Lightweight, pluggable, and configurable — drop it into any Django project in minutes.


Features

  • Support form with email + message fields
  • Basic anti-spam (honeypot + per-IP throttling)
  • Messages delivered straight to your Telegram chat
  • Adds a SOURCE tag so one bot can serve multiple projects
  • Templates are overrideable via settings
  • Safe for Telegram API limits (messages trimmed to 4096 chars)

Installation

Install from PyPI:

pip install django-telegram-support

Add to INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    # ...
    "django_telegram_support",
]

Include URLs in your urls.py:

from django.urls import path, include

urlpatterns = [
    # ...
    path("support/", include("django_telegram_support.urls", namespace="django_telegram_support")),
]

Now open /support/ in your browser.


Setting up your Telegram bot

  1. Open Telegram and chat with @BotFather.

  2. Send /newbot and follow the prompts. You’ll receive a bot token.

  3. Start a chat with your new bot (click Start).

  4. Get your chat_id by visiting in a browser:

    https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
    

    Then send any message to your bot. Your chat.id will appear in the JSON response.


Settings

Add these to your settings.py:

# Required
DJANGO_TELEGRAM_SUPPORT_BOT_TOKEN = "123456789:ABCdefGhIJKlmNoPQRstuVWxyZ"
DJANGO_TELEGRAM_SUPPORT_CHAT_ID = "123456789"
DJANGO_TELEGRAM_SUPPORT_SOURCE = "MyProject"   # project identifier

# Optional: template path (default is internal fallback)
DJANGO_TELEGRAM_SUPPORT_TEMPLATE = "support/custom_support_form.html"

# Optional: context passed to template
DJANGO_TELEGRAM_SUPPORT_CONTEXT = {
    "brand_name": "Django Telegram Support",
    "page_title": "Contact Support",
}

# Limits
TELEGRAM_SUPPORT_MAX_MESSAGE_LEN = 3500   # max user input length
TELEGRAM_SUPPORT_THROTTLE_SECONDS = 60    # per-IP cooldown

Setting Reference

Setting Description Default value
DJANGO_TELEGRAM_SUPPORT_BOT_TOKEN Bot token from BotFather None
DJANGO_TELEGRAM_SUPPORT_CHAT_ID Chat/channel/user id for message delivery None
DJANGO_TELEGRAM_SUPPORT_SOURCE Tag used in message header to identify project "unknown-project"
DJANGO_TELEGRAM_SUPPORT_TEMPLATE Path to override form template "support/custom_support_form.html"

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_support-0.1.0.tar.gz (7.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_support-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file django_telegram_support-0.1.0.tar.gz.

File metadata

  • Download URL: django_telegram_support-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for django_telegram_support-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfb5126d85944641a6e6ec70573e83d1966ccc80f65ca4c70e9c417da1771962
MD5 02cd9a3eeb463860ba9621fc8fe65f9d
BLAKE2b-256 7cdff1a62b2ac9f31faabfb2d6952b75681df382379c63f50d5b2a10c042f299

See more details on using hashes here.

File details

Details for the file django_telegram_support-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_telegram_support-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7caf076a6acbcd22a2abad84375d8f351e22efa97c2ac25723ee6de04fd695a
MD5 2ab69a35337588b72ed0924373169374
BLAKE2b-256 69b3338d58287f9f6a5ef694e79861cda53eeeda62b227684977087ed3362d5b

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