Skip to main content

Official Python SDK for the VZaps public API.

Project description

VZaps Python SDK

CI PyPI Python

Official Python SDK for the VZaps public API.

Requirements

  • Python 3.10+
  • client_token and client_secret from VZaps
  • instance_token for instance-scoped operations

Installation

pip install vzaps

For local development:

pip install -e ".[dev]"

Quick Start

from vzaps import VZapsClient

with VZapsClient(
    client_token="your-client-token",
    client_secret="your-client-secret",
) as client:
    instances = client.instances.list()
    print(instances)

Send a text message:

from vzaps import VZapsClient

client = VZapsClient(client_token="...", client_secret="...")

client.messages.send_text(
    instance_id="VZ...",
    instance_token="instance-token",
    phone="5511999999999",
    message="Hello from Python",
)
client.close()

Async

from vzaps import AsyncVZapsClient

async with AsyncVZapsClient(
    client_token="your-client-token",
    client_secret="your-client-secret",
) as client:
    await client.messages.send_text(
        instance_id="VZ...",
        instance_token="instance-token",
        phone="5511999999999",
        message="Hello from async Python",
    )

Authentication

The SDK exchanges client_token and client_secret for an access token using POST /token. Tokens are cached and refreshed before expiration. Requests include:

  • Authorization: Bearer <access_token>
  • X-Client-Token
  • X-Instance-Token when the call is scoped to an instance

Resources

The client exposes:

  • auth
  • instances
  • sessions
  • messages
  • webhooks
  • contacts
  • groups
  • users
  • queues
  • typebots
  • chatwoot
  • chats
  • events

All request arguments use Python snake_case.

Generic Request

client.request(
    "POST",
    "/instances/get",
    body={"id": "VZ..."},
)

Realtime

Realtime subscriptions are async-first:

async with AsyncVZapsClient(client_token="...", client_secret="...") as client:
    async with client.events.subscribe(
        instance_id="VZ...",
        instance_token="instance-token",
        events=["Message", "Connected"],
    ) as sub:
        @sub.on("Message")
        async def handle_message(event):
            print(event.id, event.data)

        await sub.wait_closed()

Handlers registered for All receive every event. The SDK sends an ack after handlers complete and reconnects by default with last_event_id tracking.

Errors

from vzaps import VZapsAPIError, VZapsAuthenticationError, VZapsRateLimitError

try:
    client.instances.get("VZ...")
except VZapsAuthenticationError:
    ...
except VZapsRateLimitError:
    ...
except VZapsAPIError as exc:
    print(exc.status_code, exc.details)

Documentation

See docs.vzaps.com for API and SDK guides.

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

vzaps-0.1.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

vzaps-0.1.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file vzaps-0.1.0.tar.gz.

File metadata

  • Download URL: vzaps-0.1.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vzaps-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5818d5c0a30e71c3cb9c676e7e5b510a8847eb064928b4b3b7e0e48f0b5e9fc3
MD5 ce0d12a891b4201b09154589df3b352e
BLAKE2b-256 6ab73a004754f40c34ea6f796fd1571f695fa4d2c9d724db822f8b8e1ddde905

See more details on using hashes here.

Provenance

The following attestation bundles were made for vzaps-0.1.0.tar.gz:

Publisher: release.yml on VZaps/vzaps-sdk-python

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

File details

Details for the file vzaps-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vzaps-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vzaps-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2754962047a591adf2ea1a38eddcb7470b2a1dbc860dd14bc3a35d9113e458f4
MD5 4e517007b8c9c95c1d5cc131002fcb8b
BLAKE2b-256 ab17019ca1b09efab0197dfd9b4ae6aa995b7dfdeed2351ff78b0fe072a7e2b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for vzaps-0.1.0-py3-none-any.whl:

Publisher: release.yml on VZaps/vzaps-sdk-python

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