Metadata-Version: 2.4
Name: django-deskcrew
Version: 1.0.1
Summary: Live chat, AI support chatbot and helpdesk ticketing for Django: the DeskCrew widget as a template tag or middleware, plus a client that turns contact forms into tickets. Free plan.
Author-email: DeskCrew <support@deskcrew.io>
License: MIT
Project-URL: Homepage, https://deskcrew.io/integrations/django
Project-URL: Documentation, https://deskcrew.io/board/deskcrew/kb
Project-URL: Source, https://github.com/webmilmind1/django-deskcrew
Project-URL: Issues, https://github.com/webmilmind1/django-deskcrew/issues
Project-URL: Changelog, https://deskcrew.io/board/deskcrew/changelog
Keywords: django,live chat,chat widget,customer support,helpdesk,help desk,support tickets,ticketing,ai chatbot,ai support,knowledge base,help center,contact form,intercom alternative,crisp alternative,tawk.to alternative,zendesk alternative,deskcrew
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Office/Business
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.2
Dynamic: license-file

# django-deskcrew

![DeskCrew widget for Django](https://deskcrew.io/packages/deskcrew-django.gif)

**Live chat, an AI support chatbot and helpdesk ticketing for Django, in one package.** django-deskcrew adds the [DeskCrew](https://deskcrew.io) support widget to a Django project: visitors chat with an AI that answers from your knowledge base, anything it cannot answer becomes a ticket, and a human approves every reply before it sends. A template tag for your base template or an opt-in middleware, plus a small client so a contact form, a view or a Celery task can open a ticket from Python.

Works with Django 4.2 to 5.2, HTMX, Django REST Framework sites with a template front end, Wagtail and django-allauth. Nothing to add to static files or a bundler. Free plan, no credit card: https://deskcrew.io/signup

## Use it for

- **Live chat on a Django site** without writing JavaScript: one template tag, or one setting for every page.
- **An AI chatbot for customer support** that only answers from your own help articles and hands off to a person when unsure.
- **Contact form to support ticket**: pass the cleaned form data to `create_ticket` and the message lands in your inbox as a ticket, no email backend needed.
- **A help center and knowledge base** for a SaaS, an online store, a Wagtail site or an internal tool.
- **Replacing a paid chat widget** (Intercom, Crisp, Tawk.to, Zendesk, Freshdesk, HelpScout) with one that starts free and never sends a reply you did not approve.

## Install

```
pip install django-deskcrew
```

```python
# settings.py
INSTALLED_APPS = [..., "deskcrew"]

DESKCREW = {
    "WIDGET_KEY": os.environ.get("DESKCREW_WIDGET_KEY"),  # pub_... from Dashboard → Install
    "BOARD": "your-board",                               # optional
    "SITE_URL": "https://www.example.com",               # this site's public origin
    # "COLOR": "#4f46e5", "POSITION": "right", "GREETING": "Hi! How can we help?",
}
```

## Show the widget

In your base template, just before `</body>`:

```django
{% load deskcrew %}
{% deskcrew_widget %}
```

Or set `"AUTO_INJECT": True` and add `"deskcrew.middleware.DeskcrewMiddleware"` to `MIDDLEWARE`; the tag is then added to every successful HTML response. JSON, redirects, streaming responses, errors and pages that already carry the tag are left alone.

## Allow your domain

Once per environment:

```
python manage.py deskcrew_register_origin
```

## Create tickets from your code

```python
from deskcrew.client import create_ticket

create_ticket(email=request.user.email, message=form.cleaned_data["message"], name=request.user.get_full_name())
```

Returns `True` when DeskCrew accepted the ticket. It never raises into your request cycle and gives up after ten seconds.

## FAQ

### How do I add live chat to a Django project?

`pip install django-deskcrew`, add `"deskcrew"` to `INSTALLED_APPS`, put your widget key in the `DESKCREW` setting, and add `{% load deskcrew %}{% deskcrew_widget %}` before `</body>` in your base template. Every template that extends it gets the chat bubble. Set `"AUTO_INJECT": True` with the middleware instead if you would rather not touch templates.

### Does it work with HTMX, Wagtail or Django REST Framework?

Yes. The widget mounts once into its own container, so HTMX swaps and partial updates do not touch it. Wagtail pages render through your base template like any other. A DRF project only needs it on the templates that serve a browser; the middleware skips JSON responses.

### Do I need to add anything to static files, Whitenoise or a bundler?

No. The widget is a single external script loaded from deskcrew.io, not a static asset. There is nothing to collect, pin or bundle.

### Can I create a support ticket from a view, a form or a Celery task?

Yes. `create_ticket(name=, email=, message=)` posts the ticket and returns True or False. It never raises into your request cycle and times out after ten seconds, so call it from a task (Celery, Django-Q, Huey) when you create tickets in bulk.

### Is the AI chatbot going to make things up?

It answers only from the knowledge base you publish on DeskCrew and says so when it does not know. Anything it cannot answer becomes a ticket, and a person approves every outbound reply. The AI never emails a customer on its own.

### Is there a free plan?

Yes. The free plan includes the chat widget, ticketing, a public help center and a monthly AI answer allowance, with no credit card. Paid plans add inbound email, white-label and more AI answers: https://deskcrew.io/pricing

### Does it work with Flask or FastAPI?

The client in `deskcrew.client` is plain Python and works anywhere. The template tag, middleware and management command are Django-only; on Flask or FastAPI paste the one-line widget snippet from https://deskcrew.io/integrations/django into your base template instead.

## What the app sends to DeskCrew

One script tag pointing at `https://deskcrew.io/desk.js` with your public key and the optional board, colour, position and greeting, each validated and escaped. `deskcrew_register_origin` posts your `SITE_URL` and key to `https://deskcrew.io/api/widget/register-origin`. `create_ticket` posts the name, email and message to `https://deskcrew.io/api/widget/submit` with `SITE_URL` as the Origin. Nothing else leaves your project. Terms: https://deskcrew.io/terms. Privacy: https://deskcrew.io/privacy.

## Requirements

Python 3.9 to 3.13. Django 4.2, 5.0, 5.1 or 5.2.

## License

MIT
