At the command line:
$ pip install permabots
permabots to your
INSTALLED_APPS, and run:
$ python manage.py migrate permabots
Instant messaging providers uses webhooks to send messages to your bots. Add permabots processing urls to your urlpatterns:
url(r'^processing/', include('permabots.urls_processing', namespace="permabots"))
Webhooks are generated with
django.contrib.sites. You need it installed and
SITE_ID configured. If you want to generate webhook manually you can do it:
MICROBOT_WEBHOOK_DOMAIN = 'https://yourdomain.herokuapp.com'
It is usefull when you don’t have
https in your public domain but you have it in your autogenerated domain. i.e. heroku.
Bots are associated to Django Users. You need at least one user, for example the admin user.
Permabots comes with a REST API to manage all elements. If you want to use REST API (recommended) permabots requires
rest_framework.authtoken. Added them to your
And then configure urls:
url(r'^api/v1/', include('permabots.urls_api', namespace="api"))
API uses Token authentication. Generate token when user is created:
@receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_auth_token(sender, instance=None, created=False, **kwargs): if created: Token.objects.create(user=instance)
You can check API in official Permabots.com implementation.
Permabots uses celery to delegate processing to workers and release webhooks. Permabots do not require any special settings for celery.
Just remember using DB as broker will slow down the processing. Do not used in order to avoid delay in bot replays.
Cache is extensively used by Permabots. Set your preferred cache backend to reduce processing time.
Once a chat bot is configured most of their models are static
templates, etc so it is not required to access
DB each message arrives to permabots