Skip to main content

Yandex Dialogs Developer API client — programmatic skill creation, draft management, OAuth Device Flow

Project description

ya-dialogs-api

Async Yandex Dialogs Developer API client — programmatic skill creation, draft management, OAuth Device Flow.

CI PyPI Python 3.12+ License: MIT

What this is

A framework-agnostic Python library that drives the Yandex Dialogs Developer API — the meta-API at dialogs.yandex.ru/developer-api/v2/ used to programmatically create and manage Alice skills (Smart Home and custom dialog skills). Where every other Yandex Alice library on PyPI handles the runtime side (incoming webhook requests from end users), this one handles the provisioning side: sign in via Yandex Passport Device Flow, create a skill, upload a logo, set the webhook backend URL, publish a draft, poll for publication state.

It exists because Yandex doesn't publish a developer-API SDK and the only known Python implementation lived inside the Music Assistant ma-provider-yandex-smarthome plugin. This library is that code, extracted and made generic.

Features

  • Full skill auto-creation pipeline — Device Flow OAuth → CSRF/cookie session → POST /apps → POST /skills/{id}/draft → publication polling → callback URL extraction.
  • Two channel typesskill_type="smart_home" for Yandex Smart Home skills, skill_type="dialog" for Alice custom dialog (aliceSkill) skills.
  • Incremental state machineSkillCreationArtifacts snapshots progress after every step. On transient failure, retry resumes from the last completed step instead of restarting.
  • Framework-agnostic — caller provides a WebserverAdapter Protocol implementation for hosting the short-lived Device Code activation page. Works with aiohttp, FastAPI, Starlette, or any ASGI/aiohttp-compatible webserver.
  • Strictly typedmypy --strict clean, PEP 561 py.typed marker.
  • Security-awareSecretStr redacts tokens in repr/str/format/tracebacks (re-exported from ya-passport-auth).

Installation

pip install ya-dialogs-api

Quick start

import asyncio
from ya_dialogs_api import (
    SkillCreationArtifacts,
    SkillCreationState,
    WebserverAdapter,
    auto_create_skill,
    load_default_logo_bytes,
)

# 1. Implement WebserverAdapter against your HTTP framework.
#    See docs for an aiohttp reference implementation.
my_webserver: WebserverAdapter = ...

# 2. Drive the pipeline. Persist artifacts between calls — the next
#    invocation will resume from the last completed step.
async def main() -> None:
    artifacts = SkillCreationArtifacts(state=SkillCreationState.PENDING)
    result = await auto_create_skill(
        webserver=my_webserver,
        connection_type="direct",
        skill_name="My Smart Home",
        artifacts=artifacts,
        cloud_instance_id="...",
        direct_client_secret="...",
        logo_bytes=load_default_logo_bytes(),
        session_id="cfg-flow-1",
        skill_type="smart_home",
    )
    if result.state == SkillCreationState.DONE:
        print(f"Skill created: skill_id={result.skill_id}")
    else:
        print(f"Failed at step {result.state}: {result.last_error}")

asyncio.run(main())

Status

Beta. The API is stable enough to depend on, but the underlying Yandex dev- console endpoints are unofficial (reverse-engineered from DevTools traces) and may break without notice. The library is actively maintained against the current production endpoint behavior.

See also

License

MIT

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

ya_dialogs_api-1.0.0.tar.gz (73.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ya_dialogs_api-1.0.0-py3-none-any.whl (62.5 kB view details)

Uploaded Python 3

File details

Details for the file ya_dialogs_api-1.0.0.tar.gz.

File metadata

  • Download URL: ya_dialogs_api-1.0.0.tar.gz
  • Upload date:
  • Size: 73.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for ya_dialogs_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b563acbda0d8a390c0879ff4f0754274b7fd34d30cc524a2b8385554b3758fe9
MD5 01e5c03edc3405dbfb0c2b66d00bc008
BLAKE2b-256 2086cfb86341d4a1c8c2f8fa9150e7b68846a5abfee3cf7b236a01a43563f750

See more details on using hashes here.

Provenance

The following attestation bundles were made for ya_dialogs_api-1.0.0.tar.gz:

Publisher: release.yml on trudenboy/ya-dialogs-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ya_dialogs_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ya_dialogs_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 62.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for ya_dialogs_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 454bdf14f796e0299a01a3f14e08541c94915b4f798bd22b3a9345abc47da651
MD5 bc6595cafc1b7b960b9abf2072260190
BLAKE2b-256 e2a4699a56caf5c22fb6f3b40055bed8fb6fd01cb466b7b994467acde992fb0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ya_dialogs_api-1.0.0-py3-none-any.whl:

Publisher: release.yml on trudenboy/ya-dialogs-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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