Skip to main content

A Django wrapper with webhook for ChatbotAI

Example code

Installation

pip install django-chatbot

Usage

For Web Bot

in settings.py add the following:

 INSTALLED_APPS = [
  ...
  'django.chatbot',
  ...
]

CHATBOT_TEMPLATE = <ChatBotAI template file path>
START_MESSAGE = "Welcome to ChatBotAI"

in urls.py add the following:

 from django.chatbot.views import web_hook


 urlpatterns = [
   ...
   path("webhook/", web_hook, name="webhook"),
   ...
]

Web Hook API (should authenticate before API request)

URL: /webhook/
Method: POST
Data: {
        last_message_id: 5,
        message: "what is dosa"
      }
Response: {
      "status": "Success",
      "messages": [
           {
             "id": 6, "text": "what is dosa",
             "created": "2020-03-22 19:42:59",
             "by": "user"
            }, {
              "id": 7,
              "text": "A dosa is a cooked flat thin layered rice batter, originating from South India, made from a fermented batter....",
              "created": "2020-03-22 19:42:59",
              "by": "bot"
            }
      ]
}

For Microsoft Bot Framework Webhook

pip install django-background-task

in settings.py add the following:

 INSTALLED_APPS = [
  ...
  'background_task',
  'django.chatbot',
  ...
]

CHATBOT_TEMPLATE = <ChatBotAI template file path>
START_MESSAGE = "Welcome to ChatBotAI"
APP_CLIENT_ID = "<Microsoft App ID>"
APP_CLIENT_SECRET = "<Microsoft App Secret>"

in urls.py add the following:

 from django.chatbot.views import botframework

 urlpatterns = [
   ...
   path("webhook/",
        botframework.web_hook,
        name="botframework-webhook"),
   ...
]

Release files for django-chatbot 0.0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-chatbot 0.0.2.3
File Size Uploaded
django-chatbot-0.0.2.3.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-chatbot 0.0.2.3
File Interpreter ABI Platform
django_chatbot-0.0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / django-chatbot-0.0.2.3.tar.gz

Download URL django-chatbot-0.0.2.3.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
def5cae44bdefac194de7387260f2574321bf7a9daa5c23790b723278c7c8a3d
BLAKE2b-256 checksum
How to use checksums
e87fec5ed6f15b86c95b5d5bf02176db9f57515926bcdc1d5bff648fd3986f9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release files / django_chatbot-0.0.2.3-py3-none-any.whl

Download URL django_chatbot-0.0.2.3-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91130ad1f084aa5c1176eb37e6328c2f83138adfc75486b25e79e1a62b0b2447
BLAKE2b-256 checksum
How to use checksums
1ea95ad8284fac5a48b42c0994ea63f3b031ca804bebe312531589d76ecf02a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.2.3 This release

2 release files

0.0.2

2 release files

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page