Skip to main content

A simple Django app to integrates with https://www.tawk.to/ chat.

Project description

django-tawkto

django-tawkto is a simple Django app to it integrates with https://www.tawk.to/ chat.

Requirements

Python 3.7 to 3.10 supported.

Django 2.2 to 4.0 supported.

Quick start

Install the stable release from pypi (using pip):

pip install django-tawkto

Add tawkto to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
    ...
    'tawkto',
]

Add TAWKTO_ID_SITE in settings.py:

TAWKTO_ID_SITE='<tawkto id site>'

(Optional) Add TAWKTO_API_KEY:

TAWKTO_API_KEY='<tawkto api key>'

(Optional) For secure site (requires TAWKTO_API_KEY):

TAWKTO_IS_SECURE=True

In HTML:

{% load tawkto_tags %}

<!DOCTYPE html>
<html lang="en">
<head>
    ...
</head>
<body>
    ...
    {% tawkto_script %}
</body>
</html>

(Optional) Add visitor name and email:

{% tawkto_script user_name=request.user.get_full_name user_email=request.user.email %}

(Optional) Use a different widget for a given property (default is the default value):

TAWKTO_WIDGET_ID = "default"

or

{% tawkto_script widget_id='somewidgetid' %}

(Optional) Use a different tawkto property:

{% tawkto_script id_site='tawktosideit' api_key='tawktoapikey'%}

(Optional) Set custom metadata regarding this chat/visitor:

  • is_secure must be True.
  • You must provide a valid email.
  • Metadata is represented by key and value.
  • The key is of the string data type and can contain only alphanumeric characters and ‘-‘ (dash).
  • More in https://developer.tawk.to/jsapi/ setAttributes section.
# view.py
def view(request):
    context = {'metadata': {'attr-1': 'value1', 'attr-2': 'value2'}}
    return render(request, 'template.html', context)

In template:

{% tawkto_script is_secure=True user_email=example@example.com extra_attributes=metadata %}

metadata-image

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-tawkto-0.4.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

django_tawkto-0.4-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file django-tawkto-0.4.tar.gz.

File metadata

  • Download URL: django-tawkto-0.4.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for django-tawkto-0.4.tar.gz
Algorithm Hash digest
SHA256 f744103b532f7c36c97976bcd375311a2dd46a9eee2951ca7675e6d794ffe762
MD5 63692bdfa6a0788d287387bd032ea471
BLAKE2b-256 0c6790cb46d39da8bad981bfc98a9655f71f5384f4bbebd78db9acc24d0b309f

See more details on using hashes here.

File details

Details for the file django_tawkto-0.4-py3-none-any.whl.

File metadata

  • Download URL: django_tawkto-0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for django_tawkto-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ded21f9a920be898feea6c82fc3745d8b6bdc75e9f8e989ba551efd807bac95c
MD5 1297f7171090f61fbcf8d1234bd868e7
BLAKE2b-256 ecd36ac618990f48ff4b2a282767eaa543b1b91fb945ed9700ce34e72972a022

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page