Skip to main content

Asynchronous library for Yandex Dialogs (Alice) API

Project description


AsyncIO library for Yandex Alice (Yandex Dialogs)


  • Work with classes, don't bother parsing JSON
  • Auto answer to webhook even if you were not fast enough to create answer - there won't be a server error, but you'll get a log

Auto response will not help if you are not using async IO. So consider not to use any long processing synchronous tasks inside handlers

  • Handy handlers to match incoming commands
  • Finite-State Machine
  • Easy images upload, easy answers generation


# make sure you use virtual env and python 3.6+:
python3.6 -m venv aliceenv
source ./aliceenv/bin/activate

pip install pip -U
pip install setuptools -U
pip install uvloop  # uvloop if you want

pip install aioalice -U
# Or install from GitHub:
# pip install git+ -U

# or if you don't have git installed:
# 1. download ZIP
# 2. unarchive and go to dir
# 3. run:
python install

Quick start

Hello alice

dp = Dispatcher()

async def handle_all_requests(alice_request):
    return alice_request.response('Hello world!')


JSON serializing

If you want to use a faster json library, install rapidjson or ujson, it will be detected and used automatically

Skills using aioAlice

Testing and deployment

In all examples the next configuration is used:

WEBHOOK_URL_PATH = '/my-alice-webhook/'  # webhook endpoint

WEBAPP_HOST = 'localhost'  # running on local machine
WEBAPP_PORT = 3001  # we can use any port that is not use by other apps

For testing purposes you can use ngrok, so set webhook to (endpoint has to be WEBHOOK_URL_PATH, because WebApp expects to get updates only there), post has to be WEBAPP_PORT (in this example it is 3001)

For production you can use Nginx, then edit Nginx configuration and add these lines inside the server block:

location /my-alice-webhook/ {  # WEBHOOK_URL_PATH
    proxy_pass;  # addr to reach WebApp, in this case it is localhost and port is 3001
    proxy_redirect     off;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aioAlice, version 1.4.0
Filename, size File type Python version Upload date Hashes
Filename, size aioAlice-1.4.0.tar.gz (20.6 kB) File type Source Python version None Upload date Hashes View
Filename, size aioAlice-1.4.0-py3-none-any.whl (28.3 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page