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
SOURCEtag 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
-
Open Telegram and chat with @BotFather.
-
Send
/newbotand follow the prompts. You’ll receive a bot token. -
Start a chat with your new bot (click Start).
-
Get your chat_id by visiting in a browser:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatesThen send any message to your bot. Your
chat.idwill 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb5126d85944641a6e6ec70573e83d1966ccc80f65ca4c70e9c417da1771962
|
|
| MD5 |
02cd9a3eeb463860ba9621fc8fe65f9d
|
|
| BLAKE2b-256 |
7cdff1a62b2ac9f31faabfb2d6952b75681df382379c63f50d5b2a10c042f299
|
File details
Details for the file django_telegram_support-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_telegram_support-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7caf076a6acbcd22a2abad84375d8f351e22efa97c2ac25723ee6de04fd695a
|
|
| MD5 |
2ab69a35337588b72ed0924373169374
|
|
| BLAKE2b-256 |
69b3338d58287f9f6a5ef694e79861cda53eeeda62b227684977087ed3362d5b
|