django-telegram-support


Namedjango-telegram-support JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryReusable Django support/contact form that sends messages to Telegram.
upload_time2025-09-08 08:19:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords django telegram support contact form
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
pip install django-telegram-support
```

Add to `INSTALLED_APPS` in **settings.py**:

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

Include URLs in your **urls.py**:

```python
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](https://t.me/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**:

```python
# 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"`                                           |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-telegram-support",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "django, telegram, support, contact, form",
    "author": null,
    "author_email": "Andrei Mazur <agrshkv@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7c/df/f1a62b2ac9f31faabfb2d6952b75681df382379c63f50d5b2a10c042f299/django_telegram_support-0.1.0.tar.gz",
    "platform": null,
    "description": "# Django Telegram Support\n\nA reusable **Django app** that provides a simple support/contact form and delivers messages directly to **Telegram**.  \nLightweight, pluggable, and configurable \u2014 drop it into any Django project in minutes.\n\n---\n\n## Features\n\n- Support form with **email** + **message** fields  \n- Basic anti-spam (honeypot + per-IP throttling)  \n- Messages delivered straight to your Telegram chat  \n- Adds a `SOURCE` tag so one bot can serve multiple projects  \n- Templates are overrideable via settings  \n- Safe for Telegram API limits (messages trimmed to 4096 chars)  \n\n---\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install django-telegram-support\n```\n\nAdd to `INSTALLED_APPS` in **settings.py**:\n\n```python\nINSTALLED_APPS = [\n    # ...\n    \"django_telegram_support\",\n]\n```\n\nInclude URLs in your **urls.py**:\n\n```python\nfrom django.urls import path, include\n\nurlpatterns = [\n    # ...\n    path(\"support/\", include(\"django_telegram_support.urls\", namespace=\"django_telegram_support\")),\n]\n```\n\nNow open `/support/` in your browser.\n\n---\n\n## Setting up your Telegram bot\n\n1. Open Telegram and chat with **[@BotFather](https://t.me/BotFather)**.  \n2. Send `/newbot` and follow the prompts. You\u2019ll receive a **bot token**.  \n3. Start a chat with your new bot (click **Start**).  \n4. Get your **chat_id** by visiting in a browser:  \n\n   ```\n   https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates\n   ```\n\n   Then send any message to your bot. Your `chat.id` will appear in the JSON response.  \n\n---\n\n## Settings\n\nAdd these to your **settings.py**:\n\n```python\n# Required\nDJANGO_TELEGRAM_SUPPORT_BOT_TOKEN = \"123456789:ABCdefGhIJKlmNoPQRstuVWxyZ\"\nDJANGO_TELEGRAM_SUPPORT_CHAT_ID = \"123456789\"\nDJANGO_TELEGRAM_SUPPORT_SOURCE = \"MyProject\"   # project identifier\n\n# Optional: template path (default is internal fallback)\nDJANGO_TELEGRAM_SUPPORT_TEMPLATE = \"support/custom_support_form.html\"\n\n# Optional: context passed to template\nDJANGO_TELEGRAM_SUPPORT_CONTEXT = {\n    \"brand_name\": \"Django Telegram Support\",\n    \"page_title\": \"Contact Support\",\n}\n\n# Limits\nTELEGRAM_SUPPORT_MAX_MESSAGE_LEN = 3500   # max user input length\nTELEGRAM_SUPPORT_THROTTLE_SECONDS = 60    # per-IP cooldown\n```\n\n### Setting Reference\n\n| Setting                             | Description                                                        | Default value                                                                  |\n|-------------------------------------|--------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| `DJANGO_TELEGRAM_SUPPORT_BOT_TOKEN` | Bot token from BotFather                                           | `None`                                                                         |\n| `DJANGO_TELEGRAM_SUPPORT_CHAT_ID`   | Chat/channel/user id for message delivery                          | `None`                                                                         |\n| `DJANGO_TELEGRAM_SUPPORT_SOURCE`    | Tag used in message header to identify project                     | `\"unknown-project\"`                                                            |\n| `DJANGO_TELEGRAM_SUPPORT_TEMPLATE`  | Path to override form template                                     | `\"support/custom_support_form.html\"`                                           |\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Reusable Django support/contact form that sends messages to Telegram.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "django",
        " telegram",
        " support",
        " contact",
        " form"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "69b3338d58287f9f6a5ef694e79861cda53eeeda62b227684977087ed3362d5b",
                "md5": "2ab69a35337588b72ed0924373169374",
                "sha256": "d7caf076a6acbcd22a2abad84375d8f351e22efa97c2ac25723ee6de04fd695a"
            },
            "downloads": -1,
            "filename": "django_telegram_support-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2ab69a35337588b72ed0924373169374",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8074,
            "upload_time": "2025-09-08T08:19:51",
            "upload_time_iso_8601": "2025-09-08T08:19:51.146706Z",
            "url": "https://files.pythonhosted.org/packages/69/b3/338d58287f9f6a5ef694e79861cda53eeeda62b227684977087ed3362d5b/django_telegram_support-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7cdff1a62b2ac9f31faabfb2d6952b75681df382379c63f50d5b2a10c042f299",
                "md5": "02cd9a3eeb463860ba9621fc8fe65f9d",
                "sha256": "bfb5126d85944641a6e6ec70573e83d1966ccc80f65ca4c70e9c417da1771962"
            },
            "downloads": -1,
            "filename": "django_telegram_support-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "02cd9a3eeb463860ba9621fc8fe65f9d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7765,
            "upload_time": "2025-09-08T08:19:52",
            "upload_time_iso_8601": "2025-09-08T08:19:52.289194Z",
            "url": "https://files.pythonhosted.org/packages/7c/df/f1a62b2ac9f31faabfb2d6952b75681df382379c63f50d5b2a10c042f299/django_telegram_support-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-08 08:19:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-telegram-support"
}
        
Elapsed time: 1.53580s